Since 29 November 2026 the fitplus.studio studio has been running on a system we designed and built ourselves: a website with the schedule and booking, a client app, a front desk with point of sale and reports, and a trainer portal. How the launch went and the numbers after the first week are on awis.group. Here we take apart the design: the technology, the architecture and the reasons behind each choice.
The brief that shaped the architecture
- One studio today, a network tomorrow, and the same system for other studios as SaaS. Separating studio data had to be in the design from day one.
- Running it for one studio has to be cheap: one server, not a cluster.
- A small team – one architect and agentic development. So one language, one repository and rules checked by machines, not only by people.
- Studio rules (cancellations, limits, reminders, trainer payouts) are configured in the admin, not hard-coded. Module settings are an entity of their own with a change history.
Technology: open source
- Language: TypeScript 6 on backend and frontend, Node.js 22.
- Backend: NestJS 11, Zod validation, Drizzle ORM, pino logging.
- Database: PostgreSQL 17 with row-level security, background jobs with pg-boss.
- Identity: Keycloak 26 – OpenID Connect with PKCE, Google sign-in.
- Frontend: React 19 and Vite 8, web components (custom elements with Shadow DOM), a PWA with a service worker and Web Push.
- Contracts: OpenAPI (12 contracts) and an AsyncAPI event catalogue.
- Monorepo and quality: Nx 24, ESLint, Vitest and Jest.
- Operations: Docker, Caddy 2 (reverse proxy, HTTPS, load balancing), a dedicated server in the EU.
- Studio website: TYPO3 on our T3WEB platform.
Why open source: no licence fees per studio or per user, which matters for SaaS. We run the system ourselves in the EU, can replace any part and can read the code of every library. We use only monitoring as a service (Sentry and Grafana Cloud in the EU) – and, naturally, the payment gateway and e-mail.
A modular monolith, not microservices
The core is a single NestJS application with eight modules that follow how a studio works: platform (studios, accounts, roles), clients, scheduling and bookings, staff, passes, billing and point of sale, notifications and reporting.
- Each module has its own PostgreSQL schema. It never touches other modules' tables and talks to other modules only through their public interface.
- ESLint dependency rules in Nx guard the boundaries. A module that reaches into another one fails the checks.
Why not microservices: for one studio they would bring network calls between services, distributed transactions and more containers to run and monitor – complexity we do not need yet. Why not a classic monolith: without guarded boundaries the code gets tangled over time and can no longer be split.
The path to services is ready. Extracting a module means running the same code in its own container, replacing its interface with an HTTP client generated from OpenAPI, sending events through NATS instead of in-process delivery and moving the module's schema into its own database. The module's code does not change.
Contract before code
Every interface starts as an OpenAPI contract, every event in the AsyncAPI catalogue. Types for backend and frontend are generated from the contracts. On every change, CI checks the contracts and verifies that modules emit only events from the catalogue.
The interfaces share common rules: errors per RFC 9457 (problem+json), an Idempotency-Key on writes – a phone app can safely retry a request without a double booking – and ETags when editing settings, so two people cannot overwrite each other's changes.
Why: the contract is where the decision is made. Frontend and backend can be built in parallel, and the agent writes against a precise brief.
Events without a message broker: outbox and pg-boss
Modules learn about changes from events. An event is stored in an outbox table in the same transaction as the change itself, and a dispatcher then delivers it to the other modules. If the transaction fails, no event goes out. If it succeeds, the event is not lost.
Example: the front desk archives a client → client.archived event → scheduling cancels their future bookings, billing cancels unpaid orders and notifications sends them a message. None of these modules calls the others directly.
Background jobs – reminders, nightly recalculations, trainer payouts – run with pg-boss directly in PostgreSQL. Why: no extra Kafka, RabbitMQ or Redis to operate. When needed, the outbox will be connected to NATS.
Notifications have a queue in the database and decide whether to send only at delivery time – based on the client's preferences, quiet hours and disabled message types. Channels sit behind an interface: e-mail and Web Push, SMS later.
Many studios in one database: row-level security
Every table with studio data has row-level security enabled in PostgreSQL. A transaction first sets the studio, and the database then returns only that studio's rows – even if a query has a bug. The application's database role cannot bypass this rule.
Roles in Keycloak are per location: the front desk of one studio sees its studio, a network manager sees all of them. Why: security is in how the system is built, not only in the application code, and the same system can carry a studio network and SaaS. A bonus: integration tests run in parallel on one database, each test with its own studio.
One core, four apps
- Website: the schedule, booking and client account are web components embedded in the TYPO3 website of fitplus.studio. Shadow DOM keeps their styles separate from the website.
- Client app: a PWA – installed from the browser, sends push messages, keeps the last screens on the phone and preloads the next ones when idle.
- Front desk: an SPA for the desk and the manager – the day, check-in, point of sale, client card, payouts and reports.
- Trainer portal: classes, attendance, availability and payouts.
Each app has its own BFF (backend for frontend) – a layer that composes screens from module interfaces and decides the rules. The frontend only displays. A BFF has no data or events of its own. The public BFF for the website caches responses (Cache-Control and ETag), so the schedule on the website stays fast under load.
Why a PWA and not native apps: one codebase for the website and the app, the same components and new versions instantly, without app store review.
Identity, security and GDPR
- Sign-in is handled by Keycloak outside the application: OpenID Connect with PKCE, Google sign-in, staff invitations, password rules and an optional second factor. The Keycloak administration is not reachable from the internet.
- When paying by card through Stripe Connect, the card number goes only to Stripe, never to our server.
- A change history shows people who did what: bookings, payments, consents, settings.
- The system collects consent before the first booking. Google Analytics loads only after consent and never sends the client's name, e-mail or id. Logs contain no query parameters, and no e-mails or IP addresses go to monitoring.
Operations
- Docker Compose: API, PostgreSQL, Keycloak and Caddy, plus the Grafana Alloy agent in production.
- The API is stateless – jobs and events live in PostgreSQL, sign-in in tokens. It scales by adding a container, and Caddy spreads the requests.
- Zero-downtime deploys: a new API container starts next to the old one, and after migrations and a health check the old one finishes its requests and stops. The apps switch as a whole release at once.
- Every release goes to pre-production first. Sentry tracks errors and request traces tagged by module and studio, and an uptime monitor checks the database and Keycloak.
Four weeks of development after a year of preparation
From the first commit on 1 November to the first class in production on 29 November took four weeks. Before that we spent almost a year putting the requirements and the studio's processes together.
We developed it agentically: an AI agent wrote the code, a human held the architecture, the contracts and the decisions. It works thanks to the rails in the design – contracts say what to build, lint guards module boundaries and CI runs lint, type checks, tests and the build on every change. What fails does not go further.
Migration is a project of its own
From Sportimea we migrated clients, trainers, the schedule, passes and the history since 1 January 2025 – classes with attendance and payments. While Sportimea was still live, pre-production synchronised with it every day, so we rehearsed the switch on real data. An app account is paired with a client only through a verified e-mail.
What it means for your solution
- Start with processes and requirements, not technology.
- Draw module boundaries along the business and let a machine guard them.
- A monolith with clear boundaries is a better start than microservices for most companies.
- Security and GDPR belong in the database and the architecture, not in later fixes.
- Open source leaves you free to choose where to run the system, what to replace and how much to pay.
Next step: we will offer the same system to other studios as SaaS. Planning your own solution? We will design it with you – choose Custom development in the free audit.
Related: How we built fitplus.studio – the launch and the numbers after the first week (awis.group)
