fooder-api/Readme.md
2026-04-08 12:02:35 +02:00

32 lines
1.7 KiB
Markdown

# FOODER
Simple API for food diary application. It uses FastAPI and async postgres.
## Overview and key points of configurating and deploying API
API is maily suited for being run as docker container, either via docker compose or inside kubernetes/openshift, tho no configuration for those are provided in this repository. Example `docker-compose.yml` for deployment is provided in `doc/install/docker-compose.yml`.
Configuration is passed through env variables. Sample configuration is provided in `doc/install/env.template`.
Database migrations are handled through alembic. For ease of use, `doc/install/Makefile` provides formula for `make migrate` that upgrades database to head migration.
## Development
Project architecture design was summarized in `ARCHITECTURE.md`, altho summary was generated with usage of AI for now so might not be perfect or informative ;)
Overall, project consists of:
- `fooder/alembic` - alembic python scripts, migrations, autogenerated
- `fooder/context` - context with authorized session, repositories
- `fooder/domain` - sqlalchemy domain definitions
- `fooder/controller` - controllers for domain models, controllers hold logic linked with only one model
- `fooder/repository` - repositories for domain models, again single repo per model, altho because of joins there are some methods that touch more than one model
- `fooder/model`- pydantic models
- `fooder/view` - fastapi routes
- `fooder/utils` - utils
- `fooder/app` - fastapi app definitions
- `fooder/db` - sqlalchemy database core functionality
- `fooder/recaptcha` - recaptcha implementation
- `fooder/exc` - exceptions live there
- `fooder/router` - fastapi main router
- `fooder/settings` - pydantic-settings for app