Skip to content

yelamanfazyl/bilimio-backend

Repository files navigation

FastAPI + MongoDB Boilerplate

Deploy on Railway

This is a FastAPI boilerplate, which includes includes:

  • MongoDB as database
  • Bcrypt for password hashing
  • JWT for user token management and verification
  • Dockerfile and docker-compose files for easy deployment
  • CORS Middleware configuration

📚 Features

  1. User registration.
  2. User authentication and token creation.
  3. User verification and token validation.
  4. Encrypted password management.

🚀 Quick Start

You'll need Docker and Docker Compose to run this application.

  1. Clone the repository
git clone https://github.com/atlekbai/fastapi-boilerplate.git
  1. Navigate to the directory
cd fastapi-boilerplate
  1. Run the application
docker-compose up -d

Copy environment configurations and edit the file.

cp .env.example .env

Export environmental configurations.

export $(cat .env)

Start the FastAPI server.

poetry install
poetry shell
sh ./scripts/launch.sh

This command will start the FastAPI server on port 8000 and the MongoDB service on port 27017. You can navigate to http://localhost:8000/docs in your browser to access the automatically generated API documentation.

📚 Project Structure

The main sections of the project are:

  • app/main.py: This is the entry point of the application.
  • app/config.py: This file contains the global configuration of the application.
  • app/auth: This folder contains the logic related to the authentication system.
  • app/auth/service.py: Contains the service layer logic for the authentication system.
  • app/auth/repository: Contains the logic for interacting with the MongoDB database.
  • app/auth/router: Contains the routing logic for the authentication API.
  • app/auth/adapters: Contains the JWT management logic.
  • app/auth/utils: Contains utility functions, such as password hashing.

🛠️ Development

Install Dependencies

This project uses poetry for dependency management. To install the dependencies, run:

poetry install

Launch the Application

This project includes a script to launch the application, which can be started with:

sh ./scripts/launch.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages