Skip to content

maxbeaudoin/fastapi-cqrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI CQRS

FastAPI CQRS is an open-source project that demonstrates the implementation of the Command Query Responsibility Segregation (CQRS) pattern in a FastAPI application.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Python 3.11
  • Docker
  • Poetry

Installation

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

Setup

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.

Running the Application

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

Contributing

Please read CONTRIBUTING.md (TBD) for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • FastAPI
  • Docker
  • Poetry

About

FastAPI + CQRS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published