Back to all projects
AIPlatform + AIfrozenNDA

Learning materials platform for an international Jewish network of educational projects

Eight FastAPI microservices behind one gateway: educators write lessons, move them through an approval chain, publish them to a library and produce printed handouts in each project's own branding. The project is frozen; the backend was done by then.

My role: Full-stack engineer: microservice architecture, access model, service backends, infrastructure and CI.

4 months
from the first line to the freeze
8
microservices behind one gateway
≈71,000
lines of Python
303
automated tests

The task

The organization prepares lessons for many educational projects in different countries. Several people work on one lesson: the author, editors and reviewers. Every project wants printed handouts in its own branding, and finished materials must go to a shared library where they are easy to find.

Hence the requirements: role-based access per project and organization, an approval chain with history, a library with search in Russian and English, files and images, email notifications and two interfaces — a CRM for staff and a library website.

Architecture

Clients talk only to the gateway. The gateway checks the token and permissions, then forwards the request to the right service. Each service has its own models, migrations, Docker image and CI; services exchange events through RabbitMQ.

  1. Clients
    CRMNext.js: lesson editor, kanban, PDF
    Library websiteNext.js: search and materials
  2. Entry
    TraefikTLS, Let's Encrypt certificates
    Gatewaysingle entry point, permission checks
  3. Services
    Authusers, roles, access scopes, JWT
    Lessonslessons, content tree, approval
    Librarymaterials, search, suggestions, facets
    File Managerfiles and images
    Notificationsemails from a queue, RU and EN
    Configshared settings and encrypted secrets
    Loggingsevent log
  4. Data and infrastructure
    PostgreSQL 17data and full-text search
    RabbitMQevents and email queue, DLQ
    PrometheusTraefik and brute-force protection metrics

Key decisions

A gateway and a separate permissions service

Every request goes through the Gateway: it checks the JWT, verifies permissions with the Auth service and only then proxies the request. Services call each other with an internal key.

Why
Access rules live in one place instead of being copied into every service.
Trade-off
An extra network hop on every request. Permissions are briefly cached in the gateway, so a role change takes effect with a delay.

Roles with a scope

Three kinds of roles: global roles, roles across all projects, and roles in one specific project or organization. Permissions like “auth.user.view” are generated for every model; the generator can be re-run without duplicates.

Why
One educator can be an editor in one project and a reader in another.
Trade-off
The access model is harder to explain and test than a flat set of roles.

Approval as a chain of steps with a log

A lesson has a chain of steps with assignees and deadlines. Actions: forward, reassign, return one step back, rewind to any step and reset the later ones, finish. Every action, with its reason, is written to a log. Only a project admin can close a lesson.

Why
You can see who returned a lesson, when and why. The CRM kanban is built from this data: the backend computes the card status.
Trade-off
More states and transitions that need test coverage.

Events through RabbitMQ

Auth publishes user changes as events, and the lessons service keeps its own copy of the data it needs. Emails go through a queue; messages that fail go to a dead-letter queue (DLQ).

Why
Services don't wait for each other, and a mail server outage doesn't lose an email.
Trade-off
User data in the lessons service is updated with a small delay.

Search on PostgreSQL instead of a separate cluster

The library uses PostgreSQL full-text search with Russian and English morphology. Type-ahead suggestions come from materials, topics and tags; facets give counters for filters.

Why
A library of this size does not need a separate Elasticsearch: less infrastructure and one database.
Trade-off
Ranking and typo tolerance are simpler than in a dedicated search engine.

An AI handout template instead of AI layout for every document

Claude generates one HTML template of an A4 page for a project's brand: colors, logo, font and style wishes. The template is cached and applied to all lessons, and Paged.js does the pagination. The prompt fixes technical rules: exactly one content slot, CSS only, page format. The model can be chosen and compared.

Why
The model is called once per brand, not per document: cheap and predictable. Lesson text is never sent to the model.
Trade-off
Template quality depends on the model and the prompt, so the result needs a human look.

Hard parts

The API contract between backend and frontend

When the frontend sent a task for the kanban, it turned out that most of it was already on the backend: step statuses, available actions, the next assignee. We answered with a point-by-point document and added what was missing: kanban card status, finishing by an admin only, return reasons and a full history.

Compatibility when the API changes

Reassignment accepted a new field name while the frontend sent the old one and got an error. The fix: accept both names and switch step numbering to a single 1-based format.

Notifications service: documentation and code

The service was compared with its documentation point by point, and the differences went into a prioritized report.

Stack

Backend
Python 3.13, FastAPI, Pydantic v2, SQLAlchemy (async), Alembic, Strawberry GraphQL, FastStream
Data and messaging
PostgreSQL 17, RabbitMQ 3.13
Infrastructure
Docker Compose, Traefik, Let's Encrypt, Prometheus, GitHub Actions
Quality
pytest, Ruff, Pyright
Frontend
Next.js, React 19, TypeScript, next-intl, Tiptap, Paged.js
AI
Claude (Anthropic SDK)

Need a similar system?

Tell me about the task — I reply within a day in RU, RO or EN.