How emn90909/struta works
Purpose and entry points
Struta is a multi-tenant funeral-services platform for bereaved families, funeral homes, vendors, staff, administrators, and developer API consumers. The primary browser app is a Vite/React SPA bootstrapped by src/main.tsx and routed from src/App.tsx. A separate Next shell exists at app/page.tsx, but the README’s development path indicates the Vite app plus API server is the operational entry point.
Client portal and role surfaces
The client is organized by domain/role rather than a single generic dashboard: family memorials and requests, provider operations, staff workspaces, marketplace, ERP, administration, and developer portal. These surfaces share authentication, layouts, Supabase access, localization, and UI components.
• src/features/bereaved/pages/Dashboard.tsx
• src/features/manager/pages/Dashboard.tsx
• src/features/erp/pages/Dashboard.tsx
• src/developer/pages/Dashboard.tsx
Identity, authorization, and tenant boundaries
Supabase Auth provides client identity; AuthProvider and role/profile helpers drive route and UI access. The Node API applies server-side request security and permissions, while database migrations establish RLS, role, tenant-isolation, and RPC controls. Admin MFA and provider verification are specialized security gates.
• src/components/auth/AuthProvider.tsx
• server/security/requestSecurity.ts
• server/security/permissions.ts
• supabase/migrations/0028_role_based_struta_erp.sql
Core API and service layer
The TypeScript Node server is the main API boundary: it loads configuration, mounts domain routes, and uses a Supabase service-role client for privileged work. Routes delegate payment, subscription, notification, email/OTP, audit, connector, and refund behavior to services rather than embedding it in the SPA.
• server/index.ts
• server/routes/proErpRoutes.ts
• server/routes/workflowAutomationRoutes.ts
• server/services/subscription-service.ts
• server/supabase-admin.ts
Operations workflow, ERP, and automation
Service requests flow from families into provider/funeral-home operations, staff assignments, tasks, schedules, vehicles, and reporting. Pro ERP adds tenant workspace and workflow-canvas capabilities. Server routes and a queue support automation execution; UI includes a workflow builder and task workspace.
• src/components/workflow/RequestWorkflowBuilder.tsx
• src/features/manager/pages/TasksWorkspace.tsx
• server/jobs/queue.ts
• server/routes/workflowAutomationRoutes.ts
Persistence, realtime, media, and background processing
Supabase/Postgres is the system of record for profiles, organizations, memorials, requests, billing, notifications, ERP, and developer usage. Migrations also define storage and RLS policies. Realtime hub, web-push server, Redis-capable cache, moderation scheduler/worker, and queue provide asynchronous or live behavior.
• supabase/migrations/0004_funeral_operations_platform.sql
• server/realtime/realtimeHub.ts
• server/push-server/pushServer.ts
• server/moderation/moderationWorker.ts
• server/performance/redisCache.ts
External integrations and deployable runtimes
Payments support Paystack, Stripe, and PayPal through server routes/services. Provider verification is a JWT-protected Supabase Edge Function using Google Maps/Places and optionally Resend. Browser push uses VAPID and a service worker. The repository also contains independently deployable Go services, Python calendar/email service, and a Go MCP API server. Deployment targets include Render, Docker, and Oracle.
• supabase/functions/provider-verification/index.ts
• server/routes/paystackRoutes.ts
• public/push-sw.js
• go-services/api-backend/main.go
• MCP/cmd/mcp/main.go
• render.yaml
Main entry points: index.ts Node API server · 0004_funeral_operations_platform.sql Supabase Postgres · render.yaml Render deployment · App.tsx App router
Components 22
Browser client
- Vite React SPA · Primary operational browser entry point.
src/main.tsx - App router
src/App.tsx - Auth provider · Supabase identity and role-aware client access.
src/components/auth/AuthProvider.tsx - Role workspaces · Family, provider, ERP, and developer portal surfaces.
src/features/manager/pages/Dashboard.tsx - Workflow and tasks · Request workflow design and staff task execution.
src/components/workflow/RequestWorkflowBuilder.tsx
Node API
- Node API server · Loads configuration and mounts domain routes.
server/index.ts - Request security · Applies server-side request protection and permissions.
server/security/requestSecurity.ts - ERP routes · Tenant ERP workspace operations.
server/routes/proErpRoutes.ts - Automation routes · Starts workflow automation execution.
server/routes/workflowAutomationRoutes.ts - Subscription service
server/services/subscription-service.ts - Service-role client · Server-only Supabase access for privileged work.
server/supabase-admin.ts
Data and async platform
- Supabase Postgres · Stores tenant data, memorials, requests, billing, ERP, and notifications.
supabase/migrations/0004_funeral_operations_platform.sql - RLS and tenant controls · Database roles, tenant isolation, and RPC controls.
supabase/migrations/0028_role_based_struta_erp.sql - Job queue · Queues automation and background work.
server/jobs/queue.ts - Realtime and push · Realtime hub and browser push delivery.
server/realtime/realtimeHub.ts - Moderation and cache · Moderation worker with Redis-capable caching.
server/moderation/moderationWorker.ts
External and deployable services
- Payment providers · Paystack, Stripe, and PayPal integrations.
server/routes/paystackRoutes.ts - Provider verification · JWT-protected provider verification using Maps/Places and optional email.
supabase/functions/provider-verification/index.ts - Browser push worker · Receives VAPID browser push messages.
public/push-sw.js - Go API backend
go-services/api-backend/main.go - Go MCP server
MCP/cmd/mcp/main.go - Render deployment · Repository deployment configuration.
render.yaml
Connections 23
- Vite React SPA → App router: boots
- App router → Auth provider: uses
- App router → Role workspaces: routes to
- Role workspaces → Workflow and tasks: operational work
- Auth provider → Supabase Postgres: authenticates with
- Role workspaces → Node API server: API requests
- Workflow and tasks → Automation routes: automation commands
- Node API server → Request security: protects requests
- Request security → ERP routes: authorizes
- Request security → Automation routes: authorizes
- Node API server → Subscription service: delegates billing
- Node API server → Service-role client: privileged access
- Service-role client → Supabase Postgres: reads and writes
- RLS and tenant controls → Supabase Postgres: secures
- Automation routes → Job queue: enqueues jobs
- Job queue → Moderation and cache: background work
- Supabase Postgres → Realtime and push: data changes
- Realtime and push → Browser push worker: push notifications
- Subscription service → Payment providers: charges through
- Node API server → Provider verification: provider verification
- Render deployment → Node API server: deploys
- Render deployment → Go API backend: deploys
- Render deployment → Go MCP server: deploys