master
Template for fastapi backend for aayutech projects
Fastapi doesn't ship with support for orm, authentication etc. This repo implements all the basic tools and their integrations so we can start from here
Libraries used
- Fastapi
- Alembic
- Postgresql with sqlalchemy
- Pydantic
Features
- Base user and /login using Oauth2
- Api logging in audit table
- Model for base class including soft delete, created_at, updated_at
- Table auditing by default
- Static files routing
- Exception handling
Code structure
Utilities
- the exceptions.py file implmenets ExceptionHandlerRoute, All routes derive from this
- All routes are included in routes.py
- background.py includes a write log function that stores all the request response on a table
- middlewares.py implements a HTTP middleware, it calls background.py's log_api function
db folder
- config.py file contains environment files declarations
- db.py contains database configuration and contains safe_commit function that handles exception while commiting to database
alembic
Alembic is configured to take the postgresql from .env file
TODO:
Optional multitenant Tests
Description
Languages
Python
98%
Mako
2%