FastAPI CQRS is an open-source project that demonstrates the implementation of the Command Query Responsibility Segregation (CQRS) pattern in a FastAPI application.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Python 3.11
- Docker
- Poetry
Clone the repository:
git clone https://github.com/maxbeaudoin/fastapi-cqrs.git
cd fastapi-cqrs
Activate the virtual environment:
poetry shell
Install dependencies using Poetry:
poetry install
Before running the application, you need to set up your environment variables.
Navigate to /src
directory and create a .env
file:
cd src
touch .env
Open .env
, add your API key:
API_KEY=your_api_key
Replace your_api_key
with your actual API key.
Terminal
Start the FastAPI server:
uvicorn --port 8000 --reload --factory main:create_app
Docker
Build and run the Docker image:
docker build -t fastapi-cqrs --target development .
docker run -p 8000:8000 fastapi-cqrs
Docker Compose
Start the services defined in the Docker Compose configuration:
docker compose up
Accessing the API and Documentation
After starting the server, you can access the API at:
https://localhost:8000
You can also view the Swagger UI and interact with the API documentation at:
https://localhost:8000/docs
Please read CONTRIBUTING.md (TBD) for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE file for details.
- FastAPI
- Docker
- Poetry