RESTful API to manage a list of users and sensors. The API allows users and sensors to be created, read, updated, and deleted. Basic authentication and authorization for API access. The service is able to process simultaneous requests from multiple clients and ensure high data availability.
Python
, FastAPI
, PostgreSQL
, Docker
Clean Architecture is a software design philosophy that emphasizes the separation of concerns to make systems more flexible, maintainable, and testable. The core idea is to structure your system in layers, where the inner layers contain business rules and logic, while outer layers handle external concerns such as databases, UI, or frameworks. The system's core is independent of external technologies, making it easier to adapt and change parts of the system without affecting the whole.
src → Application sources
└ application → Application services layer
└ repositories → Repository interfaces
└ use_cases → Application business rules
└ controllers → Route handlers
└ domain → Enterprise core business layer such as domain model objects (Entities, Value Objects)
└ entities → Core business model objects
└ services → Core business logic
└ infrastructure → Frameworks, drivers and tools such as Database, the Web Framework, mailing/logging/glue code etc.
└ authentication → Logic related to authentication
└ database → Database ORM models and Repository implementations
└ sqlalchemy → Database interface made with Sqlalchemy
└ models → ORM models
└ repositories → Implementation of domain repository interfaces
└ selectors → Standalone database queries
└ webserver → Express.js Web server configuration (server, routes etc.)
└ middleware → Middlwares for authenticating, validating etc.
└ routers → Server routes
└ schemas → Schemas for validating incoming data
└ requirements.txt → Dependencies
└ main.py → Main application entry point
Run the following command to run the system locally:
docker-compose up -d
BASE URL: http://localhost:8000/api
API Documentation http://localhost:8000/api/docs/swagger.yml
POST /users/ Create User
GET /users/ Get Users
GET /users/{user_id} Get User
PUT /users/{user_id} Update User
DELETE /users/{user_id} Delete User
POST /users/register Register
POST /users/jwt-create Create Jwt
GET /users/profile/me
GET /sensors/ Get Sensors
POST /sensors/ Create Sensor
GET /sensors/{sensor_id} Get Sensor
PUT /sensors/{sensor_id} Update Sensor
DELETE /sensors/{sensor_id} Delete Sensor