This project is the first step in developing a simple social media application.
The goal of this exercise is to design a small Python program that stores and retrieves social media posts from a database and to automate testing using GitHub Actions.
Develop a Python application that can:
- Store social media posts in a database containing:
- πΌοΈ Image
- π¬ Text (comment)
- π€ User
- Retrieve the latest post from the database.
- Define the post information (image, text, user).
- Store multiple posts in a SQLite database.
- Implement functionality to retrieve the latest post.
- Write unit tests to verify database storage and retrieval logic.
- Ensure the program runs correctly and returns the expected data.
- Create a GitHub Actions workflow that:
- Automatically runs tests on pull requests.
- Ensures all tests pass before merging.
- Commit all developed code and workflow configurations.
- Push the final version to GitHub.
| Task Area | Angelo Ottendorfer | Martin Ferschl |
|---|---|---|
| 1. Python Application | Implement database.py (SQLite setup, add/retrieve posts) |
Support by testing functions manually, react setup |
| 3. Testing | Provide testable database functions | Create tests/test_app.py using pytest |
| 4. GitHub Actions | Review pipeline configuration | Create .github/workflows/ci.yml and ensure CI runs only on pull requests |
| 5. Final Steps | Commit app code | Commit tests + CI config and verify all tests pass |
| Branch | feature/backend |
react |
This project is the next step in developing the simple social media application.
The goal of this exercise is to create a REST API to expose the functionality developed in Part 1 and integrate it with a React web frontend.
Develop a REST API and a web application that can:
- Send, retrieve, and search social media posts via API endpoints.
- Expose the functionality of the Python application from Part 1.
- Provide a React frontend to interact with the API.
- Implement API endpoints to:
- Submit a new post
- Retrieve posts
- Search posts by user or content
- Provide an FastAPI specification for your REST API.
- Extend the testing framework to include API tests (e.g., using
pytest+requests). - Ensure all API endpoints work as expected.
- Develop a React frontend that can:
- Submit a post
- List and display all posts
- Search and display posts by user
- Commit code frequently.
- Track feature requests in GitHub issues.
- Use feature branches and pull requests to integrate changes.
| Task Area | Martin Ferschl |
|---|---|
| 1. REST API | Implement all endpoints for submitting, retrieving, and searching posts |
| 2. OpenAPI Spec | Create OpenAPI/Swagger documentation for the API |
| 3. Testing | Expand testing framework to cover all API functionality |
| 4. React Frontend | Develop web frontend to submit, list, and search posts |
| 5. Git & GitHub | Commit frequently, track features, manage feature branches & pull requests |
| Branch | feature/react |
This project focuses on containerizing the social media application to make it easy to deploy and compatible with other REST API definitions.
The goal is to package the REST API as a Docker container and automate container workflows with GitHub Actions.
Develop a Docker container for the REST API and integrate GitHub Actions to automate the build and deployment process.
The application should be easy to deploy and run in any environment.
- Create a Dockerfile for the REST API including:
- All necessary libraries and dependencies
- Configuration for executing the API from Docker
- Ensure the container can be built and run locally using Docker commands.
- Create a GitHub Actions workflow that:
- Automatically builds the Docker container on push or pull request
- Pushes the container to a container registry (e.g., Docker Hub or GitHub Container Registry)
- Verify that the workflow runs correctly and the container is available in the registry.
| Task Area | Angelo Ottendorfer | Martin Ferschl |
|---|---|---|
| 1. Docker Container | Create Dockerfile and configure container to run REST API | - |
| 2. GitHub Actions | - | Implement CI workflow to build and push Docker container |
| Branch | feature/docker |
feature/docker-ci |
This project focuses on orchestrating the social media application using Docker Compose.
The goal is to separate the application logic from the data, persist data across releases, and allow environment-specific configuration.
Develop a Docker Compose setup that:
- Separates containers for the REST API, database, and any other required infrastructure
- Persists data during container re-deployment
- Supports environment-specific configurations using a
.envfile
This allows the application to be easily deployed and updated without losing data.
- Create a Docker Compose file that defines services for:
- Backend REST API
- Frontend web application
- Database (SQLite persisted via Docker volume)
- Configure volumes to persist data across container restarts.
- Ensure services can communicate through the Docker network.
- Create a
.envfile to define environment-specific variables:- Backend and frontend ports
- Database URL
- Other configuration options
- Ensure backend reads database configuration from environment variables.
| Task Area | Angelo Ottendorfer | Martin Ferschl |
|---|---|---|
| 1. Docker Compose Orchestration | Configure backend, frontend, and volumes for data persistence | Adapted files for postgres addition |
| 2. Environment Configuration | Setup .env file and configure backend to use environment variables |
Added postgres as seperate container for data storage |
| 3. Testing | Test container orchestration and persistence | Tested orchestration with now 3 containers, persistent data |
| Branch | feature-testing |
'feature-postgres' |
| Time Required | 1h | ~1h |
This exercise extends the social media application with an event-driven architecture to improve image loading performance.
Instead of serving only full-size images, the application now processes images asynchronously to generate reduced-size versions using a dedicated microservice triggered by a message queue.
Enhance the application by introducing an image processing microservice that:
- Stores both full-size and reduced-size images
- Uses a message queue to trigger image resizing asynchronously
- Separates image processing logic into an independent container
- Updates the REST API and frontend to support optimized image delivery
This approach improves scalability, performance, and user experience.
- Store both original and resized versions of uploaded images
- Submit image-processing tasks to a message queue after image upload
- Implement a separate image resize service that:
- Listens to the queue
- Processes images asynchronously
- Stores the resized image
- Provide the image resize functionality as a dedicated container
- Integrate the image processing service into the existing Docker Compose setup
- Ensure services communicate via the message queue
- Extend the REST API to:
- Serve full-size images
- Serve reduced-size images
- Update the REST API + WebApp as needed to enable reduced-size + full-size images
- Add unit and integration tests for:
- Backend API
- Image processing service
- Create GitHub Actions workflows to:
- Automatically test all services
- Build and push Docker images for:
- Backend
- Frontend
- Image processing service
| Task Area | Angelo Ottendorfer | Martin Ferschl |
|---|---|---|
| 1. Event-Driven Design | - | Design message queue integration |
| 2. Image Processing Service | Implement image resize microservice | - |
| 3. REST API & Frontend Updates | Extend API and frontend for image handling | - |
| 4. GitHub Actions | - | Configure CI workflows for testing and container publishing |
| Branch | feature-messagequeue |
feature-messagequeue, feature-testing |
| Time Required | 4h | ~3h |
This exercise extends the social media application by introducing machine-learningβbased microservices to enhance user experience.
Pre-trained GPT-2 / DistilGPT-2 models are integrated into the system to provide sentiment analysis and text generation, leveraging an event-driven architecture for asynchronous processing.
Enhance the application by introducing ML-powered microservices that:
- Analyze user-generated content using sentiment analysis
- Generate context-aware reply suggestions
- Process ML tasks asynchronously using a message queue
- Store additional ML metadata in the database
- Integrate seamlessly into the existing microservice architecture
This approach improves scalability, responsiveness, and user engagement while demonstrating real-world ML system design.
- Submit text-analysis tasks to a message queue after post creation
- Perform sentiment analysis asynchronously using a pre-trained GPT-2 model
- Compute and store a confidence score for the sentiment prediction
- Generate reply suggestions using a GPT-based language model
Sentiment analysis is handled asynchronously via RabbitMQ, ensuring non-blocking API responses.
- Implement ML inference as a dedicated GPT-2 worker service
- Separate ML logic from the main backend service
- Integrate the ML worker into the existing Docker Compose setup
- Ensure services communicate exclusively via a message queue
- Extend the database schema to store:
- Sentiment label
- Sentiment confidence score
- Adapt REST API endpoints to expose ML-enriched post data
- Add a sentiment badge to the frontend UI
- Enable on-demand reply suggestion generation from the frontend
- Display AI-generated suggestions directly in the WebApp
- Add ML worker service to container orchestration
- Ensure reproducible environments for:
- Backend
- Frontend
- GPT-2 worker
- Message broker (RabbitMQ)
- DistilGPT-2
- Faster inference
- Lower memory footprint
- Suitable for real-time applications
- Hugging Face
transformerslibrary