Proyek
Lihat di GitHub
Lolomgrofl/fastapi-genesis
Tentang
Generator templat proyek FastAPI untuk mempermudah pekerjaan Anda ๐งฌ ๐
Pengembangan web dan aplikasiYang dapat Anda lakukan
- Docker and docker-compose for local development
- FastAPI application with uvicorn server
- AsyncPG for asynchronous access to PostgreSQL
- Pydantic for data validation
Pertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliFastAPI Genesis ๐งฌ - Project Template Generator ๐
Simple FastAPI project template with Docker, Alembic, PostgreSQL, Poetry and pre-commit to kickstart your new projects.
How to use it ๐ค
Go to the directory where you want to create your project and run:
pip install cookiecutter
cookiecutter https://github.com/Lolomgrofl/fastapi-genesis.git
What's included in the template ๐
- Here is an explanation of the directory structure of the template:
โโโ .github <- GitHub deployment workflow
โ
โโโ alembic <- Alembic migrations
โ
โโโ app <- Source code of the application (the main package)
โ โโโ daos <- Data Access Objects (DAOs) to interact with the database
โ โโโ models <- SQLAlchemy models (the database schema)
โ โโโ routers <- FastAPI routers (endpoints)
โ โโโ schemas <- Pydantic schemas for request and response models
โ โโโ services <- Business logic layer (services)
โ โโโ db.py <- Database initialization and session management code
โ โโโ main.py <- FastAPI application instance and startup code
โ โโโ settings.py <- Settings management code (using pydantic settings)
โ
โโโ scripts <- Scripts to perform various tasks like alembic migrations, etc.
โ
โโโ static <- Static files like images, documents, etc.
โ
โโโ tests <- Unit tests, one subdirectory per application module
โ
โโโ .env <- Environment variables. Should not be committed to VCS
โ
โโโ .gitignore <- Files and directories to be ignored by git
โ
โโโ .pre-commit-config.yaml <- Configuration of pre-commit hooks (see https://pre-commit.com/)
โ
โโโ alembic.ini <- Alembic configuration file
โ
โโโ docker-compose.yml <- Docker compose configuration file
โ
โโโ Dockerfile <- Dockerfile for building the image of the application
โ
โโโ Makefile <- Makefile with useful commands for development and project setup
โ
โโโ pyproject.toml <- Python dependencies for Poetry (see https://python-poetry.org/)
โ
โโโ README.md <- File with useful information about the project and how to use it
Features ๐งฉ
- Docker and docker-compose for local development
- FastAPI application with uvicorn server
- AsyncPG for asynchronous access to PostgreSQL
- Pydantic for data validation
- Poetry for managing Python dependencies
- Alembic for database migrations
- Pre-commit hooks for code formatting and linting
- JWT token authentication
- SQLAlchemy models
- CORS (Cross Origin Resource Sharing)
- GitOps ( GitHub Workflows)
User flow as an example of how to use the template ๐ก
- It consists of the following steps:
- Register a new user
- Login with the new user
- Change password
- Get all users
- Delete user by id
- Delete all users
- This following example will show you the pattern and good practices to follow in order to continue developing your application.
Cookiecutter parameters explained ๐ช
repo_name: Name of the project repository (e.g.my_project)app_container_name: Name of the Docker container for the FastAPI application server insidedocker-compose.yamlfileapp_service_port: Port on the host machine to which the FastAPI application will be exposed insidedocker-compose.yamlfile andDockerfiledb_container_name: Name of the Docker container for the PostgreSQL database server insidedocker-compose.yamlfiledb_service_port: Port on the host machine to which the PostgreSQL database server will be exposed insidedocker-compose.yamlfilepgadmin_container_name: Name of the Docker container for the pgAdmin web interface insidedocker-compose.yamlfilepgadmin_service_port: Port on the host machine to which the pgAdmin web interface will be exposed insidedocker-compose.yamlfilenetwork_name: Name of the Docker network that will be created insidedocker-compose.yamlfile
GLHF ๐
License
This project is licensed under the terms of the MIT license.
Jelajahi proyek terkait
Memuatโฆ