Files
fastapi_sqlalchemy_alembic_…/README.md
T
2026-05-03 09:14:27 +05:45

40 lines
1.2 KiB
Markdown

# 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
1. Fastapi
2. Alembic
3. Postgresql with sqlalchemy
4. Pydantic
## Features
1. Base user and /login using Oauth2
2. Api logging in audit table
3. Model for base class including soft delete, created_at, updated_at
4. Table auditing by default
5. Static files routing
6. Exception handling
# Code structure
## Utilities
1. the exceptions.py file implmenets ExceptionHandlerRoute, All routes derive from this
2. All routes are included in routes.py
3. background.py includes a write log function that stores all the request response on a table
4. middlewares.py implements a HTTP middleware, it calls background.py's log_api function
### db folder
1. config.py file contains environment files declarations
2. 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