API template with Clean Architecture
This is a template for building APIs with Clean Architecture. It contains two examples of APIs built with FastAPI and Flask.
src
contains the source code.src/core
: business logic (use cases, entities, decorators...).src/infra
: implementations of the interfaces defined in the core.src/infra/api/fastapi
: FastAPI implementation.src/infra/api/flask
: Flask implementation.src/infra/storage/
: Fake storage implementation.
Requirements
- Docker
Prepare
cp envExample .env
make build network
Run FastAPI
make api.fastapi.run
Run Flask
make api.flask.run
API
Welcome
curl -X 'GET' 'http://localhost:5000' -H 'accept: application/json'
Documents
curl -X 'GET' 'http://localhost:5000/api/v1/documents/?appName=app_test&clientId=client_test' -H 'accept: application/json'
SEE
curl -N -H "Accept:text/event-stream" http://localhost:5000/sse/alerts/
Description
Languages
Python
89.4%
Dockerfile
5.9%
Makefile
4.7%