Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lqmanh/fastapi-app
Fastapi-app is an opinionated modular FastAPI app boilerplate inspired by NestJS and Flask's Blueprint.
https://github.com/lqmanh/fastapi-app
boilerplate fastapi python
Last synced: about 2 months ago
JSON representation
Fastapi-app is an opinionated modular FastAPI app boilerplate inspired by NestJS and Flask's Blueprint.
- Host: GitHub
- URL: https://github.com/lqmanh/fastapi-app
- Owner: lqmanh
- License: mit
- Created: 2020-11-13T15:27:16.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-19T18:30:35.000Z (about 3 years ago)
- Last Synced: 2023-03-02T09:06:45.048Z (almost 2 years ago)
- Topics: boilerplate, fastapi, python
- Language: Python
- Homepage:
- Size: 141 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fastapi-app
Fastapi-app is an opinionated modular FastAPI app boilerplate inspired by [NestJS](https://nestjs.com) and Flask's [Blueprint](https://flask.palletsprojects.com/blueprints). It is suitable for small to medium sized API oriented microservices.
## Features
- ASGI server with [Uvicorn](https://github.com/encode/uvicorn)
- Active record ORM with [Tortoise](https://github.com/tortoise/tortoise-orm) and database migration with [Aerich](https://github.com/tortoise/aerich)
- Authentication with OAuth2
- Access control with [Casbin](https://github.com/casbin/pycasbin)
- Job scheduling with [Arq](https://github.com/samuelcolvin/arq)
- CLI with [Typer](https://github.com/tiangolo/typer)
- Built-in pagination support
- Preconfigured logger## Usage
```sh
cookiecutter https://github.com/lqmanh/fastapi-app
```## Project Structure
```sh
{{cookiecutter.project_slug}} #
├── {{cookiecutter.package_name}} #
│ ├── common # Common components
│ │ ├── constants.py # Constants
│ │ ├── types.py # Classes, enums, type aliases,...
│ │ └── utils.py # Helper functions, decorators,...
│ ├── modules # Where magic happens
│ │ ├── ac # Access control module
│ │ │ ├── ac_deps.py #
│ │ │ ├── ac_model.conf # Access control model
│ │ │ └── ac_policies.csv # Policies
│ │ ├── arq # Arq module
│ │ │ ├── arq_deps.py #
│ │ │ └── arq_jobs.py #
│ │ ├── logging # Logging module
│ │ │ └── logging_deps.py #
│ │ ├── pagination # Pagination module
│ │ │ ├── pagination_deps.py #
│ │ │ ├── pagination_dtos.py #
│ │ │ └── pagination_types.py #
│ │ └── users # User management module
│ │ ├── users_cli.py # CLI sub-app
│ │ ├── users_controller.py # Controller in NestJS, class-based view in Django
│ │ ├── users_deps.py # Injectable dependencies
│ │ ├── users_dtos.py # DTOs, view models
│ │ ├── users_mapper.py # Mapper that maps domain models to DTOs
│ │ ├── users_models.py # Domain models
│ │ ├── users_module.py # Module class
│ │ ├── users_service.py # Business logic, also a special kind of dependencies
│ │ └── users_types.py # Classes, enums, type aliases,...
│ ├── cli.py # Root CLI app
│ ├── config.py # Global configurations
│ └── server.py # HTTP server
├── LICENSE #
├── README.md #
├── aerich.ini # Aerich configurations
├── poetry.toml #
└── pyproject.toml #
```