RESTful Back-end project template with FastAPI + PostgreSQL + JWT + Docker + Nginx
- 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.
.
├── 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
- clone the repository
git clone [email protected]:m0kr4n3/fastapi_projetct_template.git
cd fastapi_projetct_template/app/
- 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
- 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