How mihneacatana/multi-tenants-scheduler-app works
Simi is a multi-tenant SMB management SaaS: users enter a tenant-specific React workspace, authenticate, and manage clients, appointments, staff, services, resources, and availability through a Fastify API backed by isolated tenant databases. Platform administration provisions tenants and manages feature flags through the shared global database. The graph reflects documented architecture and source-index references; some feature-specific backend route and controller links are not evidenced in the excerpts, so those connections are omitted.
Main entry points: App.tsx React workspace · SchedulingPage.tsx Scheduling workspace · admin.controller.ts Admin handlers · app.ts Fastify app
Components 27
Web application
- React workspace
frontend/src/App.tsx - Auth state
frontend/src/lib/auth.tsx - API client
frontend/src/lib/api.ts - Client workspace
frontend/src/features/clients/ClientsWorkspace.tsx - Scheduling workspace
frontend/src/features/scheduling/SchedulingPage.tsx - Admin console
frontend/src/features/admin/AdminConsole.tsx - Tenant context
frontend/src/lib/tenant.ts
Backend API
- Fastify app
backend/src/app.ts - Auth routes
backend/src/routes/auth.routes.ts - Admin routes
backend/src/routes/admin.routes.ts - Auth handlers
backend/src/controllers/auth.controller.ts - Admin handlers
backend/src/controllers/admin.controller.ts
Identity and tenancy
- Authentication
backend/src/modules/auth/service.ts - Tenant authentication
backend/src/modules/auth/tenant-service.ts - Tenant provisioning
backend/src/modules/tenants/provision.ts - Tenant resolution
backend/src/plugins/tenant.ts
Scheduling domains
- Appointment lifecycle
backend/src/modules/scheduling/service.ts - Availability
backend/src/modules/availability/service.ts - Services catalog
backend/src/modules/services-catalog/service.ts - Resource management
backend/src/modules/resources/service.ts - Staff management
backend/src/modules/staff/service.ts
Persistence
- Global PostgreSQL
backend/src/db/client.ts - Tenant DB pools
backend/src/db/tenant-pool.ts - Global schema
backend/src/db/schema/global/index.ts - Tenant schema
backend/src/db/schema/tenant/index.ts
Other components
- Tenant user
- Platform administrator
Connections 29
- Tenant user → React workspace: uses
README.md - React workspace → Auth state: provides
frontend/src/App.tsx - React workspace → Client workspace: routes to
frontend/src/App.tsx - React workspace → Scheduling workspace: routes to
frontend/src/App.tsx - React workspace → Admin console: routes to
frontend/src/App.tsx - Client workspace → API client: requests data
frontend/src/features/clients/ClientsWorkspace.tsx - Auth state → API client: calls
frontend/src/lib/auth.tsx - React workspace → Tenant context: renders tenant context
- API client → Fastify app: HTTP requests
README.md - Fastify app → Auth routes: registers routes
backend/src/app.ts - Auth routes → Auth handlers: dispatches
backend/src/routes/auth.routes.ts - Admin routes → Admin handlers: dispatches
backend/src/routes/admin.routes.ts - Auth handlers → Authentication: authenticates global user
backend/src/controllers/auth.controller.ts - Auth handlers → Tenant authentication: authenticates tenant user
backend/src/controllers/auth.controller.ts - Admin handlers → Tenant provisioning: provisions tenant
backend/src/controllers/admin.controller.ts - Fastify app → Tenant resolution: registers plugin
backend/src/app.ts - Authentication → Global PostgreSQL: reads and writes
backend/src/modules/auth/service.ts - Tenant authentication → Tenant schema: uses schema
backend/src/modules/auth/tenant-service.ts - Admin handlers → Global PostgreSQL: reads and writes tenant registry
backend/src/controllers/admin.controller.ts - Admin handlers → Tenant DB pools: opens or closes pool
backend/src/controllers/admin.controller.ts - Appointment lifecycle → Tenant DB pools: queries tenant data
backend/src/modules/scheduling/service.ts - Appointment lifecycle → Tenant schema: uses schema
backend/src/modules/scheduling/service.ts - Global PostgreSQL → Global schema: registers schema
backend/src/db/client.ts - Tenant DB pools → Tenant schema: registers schema
backend/src/db/tenant-pool.ts - Platform administrator → Admin console: administers tenants
README.md - Scheduling workspace → Availability: availability workflow
- Scheduling workspace → Services catalog: service setup
- Scheduling workspace → Resource management: resource setup
- Admin console → Staff management: staff administration