Skip to content

RESTful Back-end project template with FastAPI + PostgreSQL + JWT + Docker + nginx

License

Notifications You must be signed in to change notification settings

m0kr4n3/fastapi_project_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastapi_project_template

RESTful Back-end project template with FastAPI + PostgreSQL + JWT + Docker + Nginx

Features

  • Docker with FastAPI and PostgresSQL.
  • Authentication and securing Item routes with JWT tokens
  • Fastapi which means an interactive API documentation.
  • Scalable and evolutive structure for large projects.

Built on Python: 3.11.

Routes

routes

File Structure

.
├── app
│   ├── Dockerfile
│   ├── main.py
│   ├── requirements.txt
│   ├── .env
│   └── src
│       ├── api
│           ├── endpoints
│               ├── items.py
│               ├── user.py
│               └── login.py
│           ├── api.py
│           └── deps.py
│       ├── core
│           ├── config.py
│           └── security.py
│       ├── crud
│           ├── base.py
│           ├── crud_user.py
│           └── crud_item.py
│       ├── db
│           ├── base_class.py
│           ├── base.py
│           ├── init_db.py
│           └── session.py
│       ├── models
│           ├── item.py
│           └── user.py
│       └── schemas
│           ├── item.py
│           ├── msg.py
│           ├── token.py
│           └── user.py
└── docker-compose.yml

Installation and usage

  • clone the repository
git clone git@github.com:m0kr4n3/fastapi_projetct_template.git
cd fastapi_projetct_template/app/
  1. Using python
  • use venv virtual environment
pip install venv
python -m venv venv
source $PWD/venv/bin/activate
  • Install dependencies
pip install -r requirements.txt
  • Create env from env template:
cp example.env .env #only once
  • Put there the necessary info
  • Run main.py
python main.py
  1. Using docker Install docker-compose if it's not done already
sudo apt install docker-compose
  • Run docker-compose in the repo root directory :
sudo docker-compose up