Andolasoft

FastAPI starter framework

ZENLEAF: a FastAPI starter framework for reusable services.

ZENLEAF is a FastAPI starter that gives every new project the same predefined services, folder pattern and generator. Your team writes the business logic, and the common platform services come built in.

Animated illustration: Services, Generator, Platform

What ZENLEAF reuses in every project

Each platform service is set up once, then reused. Your team focuses on the rules that make your product different.

ServicePackagePurpose
Database accessSQLAlchemy 2, asyncAsync models and queries for each service
Authenticationfastapi-usersLogin with OAuth2 and JWT tokens, with ready endpoints
Single sign-onFiefOne login across several applications
Pagination and filtersfastapi-queryThe same paging and filter rules on every list endpoint
Access controlRBACRoles and permissions applied per service
LoggingLoguruOne logging setup for all services
WorkflowsPrefectRepeatable data and background jobs
EventingApache KafkaServices publish and react to events
SchedulingrruleRecurring tasks written as recurrence rules

Folder structure for each service

ZENLEAF uses a microservice folder pattern. Each business service has the same files, so any developer can find their way around.

FileWhat it holds
model.pyDatabase models for the service
schema.pyRequest and response shapes
event.pyEvents the service publishes or listens to
dependency.pyShared dependencies, such as the current user
service.pyBusiness logic that runs the use case
repository.pyDatabase reads and writes
rule.pyBusiness rules, kept apart from the service flow
router.pyThe API endpoints for the service

A generator that builds the service folders

The generator uses templates to create the folder structure and basic CRUD for each service. It starts from a JSON description of the service.

  1. 01

    Describe the service in JSON: its name, fields and relations.

  2. 02

    Run the generator. It writes the folder for the service, with model, schema, repository, service and router files.

  3. 03

    Add your business rules to rule.py and service.py. The generated CRUD endpoints stay in place.

Where your team adds value

The platform handles the common parts. Your team owns the decisions that are specific to your business.

Business logic

Written in rule.py and service.py, where it is easy to test and review.

Your data model

Designed per service, with the shared database setup underneath.

Your integrations

Connected through events and dependencies, not through shared code paths.

Your front end

Kept in the frontend folder, separate from the backend services.

FAQ

Questions

Ask us directly
What is a FastAPI starter framework?

It is a project base for FastAPI, the Python web framework. It sets up the folders, database access, authentication and common services once, so each new project starts from the same base.

Which parts of ZENLEAF are reused in every project?

Database access, authentication, pagination and filters, access control, logging, workflows, eventing and scheduling. Each project uses the same setup for these services.

How does the JSON generator work?

You describe a service in a JSON file. The generator fills in templates and writes the service folder with basic create, read, update and delete endpoints. Your team then adds the business rules.

Can ZENLEAF handle authentication and single sign-on?

Yes. Authentication uses OAuth2 and JWT tokens through fastapi-users. Fief provides single sign-on, so users can sign in once across several applications.

Do we own the code ZENLEAF produces?

Yes. The code you get is yours, agreed in writing before work starts.

Starting several Python projects?

Tell us what you are building. We will show how a shared base would fit your team and your next release.