Understanding the organization of the Zyeta backend codebase
src/
)src/services/
)service.py
: The main service implementation with HTTP-exposed methodsschema.py
: Pydantic models for request/response validation__base/
)__base/
directory contains core service infrastructure:
acquire.py
: Dependency injection containermanager.py
: Service discovery and registrationsrc/models/
)*_model.py
naming convention and defines one or more related models.
Models follow this pattern:
src/database/
)models.py
: Base model class and CRUD operationspostgres.py
: PostgreSQL connection setup__init__.py
: Exports session factories and utilitiessrc/middlewares/
)exceptions.py
: Global exception handlingratelimit.py
: Rate limiting middlewaresrc/dependencies/
)security.py
: JWT bearer token authentication and RBACsrc/libs/
)s3/
: Amazon S3 compatible storagevectorstore/
: Vector embeddings and similarity searchtools_factory/
: Dynamic tool generationtests/
)docs/
)alembic.copy.ini
alembic.ini
and updated with your database connection details.
.env.local
.env
and populated with your configuration values.
pyproject.toml
ruff.toml
mypy.ini
src/models/
if you need database entitiessrc/services/
with appropriate business logictests/
directorydocs/
directoryAcquire
classhttp_exposed
property{http_method}_{resource}
post_signup
, get_user
, put_update_profile
{entity}_model.py
user_model.py
, organization_model.py
schema.py
(within service directories)test_{component}.py