This is a simple RESTful API application built with FastAPI for managing news articles and their comments.
This application follows the principles of clean architecture, which emphasizes separation of concerns and independence of frameworks. The codebase is organized into distinct layers - repository, service, and router - each responsible for specific functionalities. This separation allows for better maintainability, testability, and scalability of the application. Additionally, the use of dependency injection ensures loose coupling between components, making it easier to replace or modify individual parts of the system without affecting the overall functionality. Overall, clean architecture promotes a clear and modular design, facilitating easier understanding and development of complex software systems.
- Python 3.12.2: Programming language used for development.
- FastAPI: Web framework used to build the RESTful API.
- Pydantic: Data validation and parsing library used for defining schemas and parsing data.
- Docker Compose: Tool used for defining and running multi-container Docker applications.
- Ruff: Code formatting and linting tool for Python.
Make sure you have Docker and Docker Compose installed on your machine.
To run the application using Docker Compose, follow these steps:
- Clone this repository to your local machine:
git clone https://github.com/stirk1337/cyberlympha-test-task
- Navigate to the root directory of the project:
cd cyberlympha-test-task
- Start the application using Docker Compose and Makefile:
make dev
- Once the containers are up and running, you can access the API at
http://localhost:8000
. Additionally, you can explore the interactive documentation provided by Swagger UI by navigating tohttp://localhost:8000/docs
A Makefile is provided with useful commands for development tasks:
- dev: Start the application using Docker Compose.
- lint: Run code formatting and linting checks using Ruff.
To run these commands, simply execute make <command>
in your terminal.