Skip to content

CarlosAndreo/fastapi-mongodb

Repository files navigation

FastAPI MongoDB

Contributors Forks Stargazers Issues License Coverage

🧠 About

This is a ready-to-use project template for building FastAPI applications with MongoDB as the database. It's designed to help you get started quickly with a clean architecture, pre-configured settings, and best practices for scalability and maintainability.

Features

  • JWT-based authentication.
  • Refresh token.
  • Tests with pytest.
  • Log handler.
  • Add indexes to MongoDB.

Roadmap

  • Email verification.
  • Handler exceptions.

🛠️ Stack

  • Python - Programming language.
  • FastAPI - Python framework for web applications to expose the API.
  • MongoDB - NoSQL database.

🚀 Getting Started Locally

Install Docker following the instructions for your operating system:

Clone the repository:

git clone https://github.com/CarlosAndreo/fastapi-mongodb.git
cd fastapi-mongodb

Build the Docker image:

docker compose build

Run the Docker container:

docker compose up -d

The application will be available at http://localhost:8000/api/v1/docs.

The mongo-express UI will be available at http://localhost:8081.

🧪 Test

Warning

When run the tests, the database is cleaned.

To test the application, access to the fastapi container:

docker exec -it fastapi-mongodb sh

Finally, execute:

uv run pytest

Contributors