How emn90909/strut works
Purpose and Runtime Entry Points
Struta is a multi-tenant funeral-services platform for bereaved families, funeral homes, vendors, staff, administrators, and developer API consumers. The primary runtime is a Vite React SPA plus a Node/TypeScript API server: src/main.tsx, src/App.tsx, and server/index.ts. app/page.tsx and app/layout.tsx indicate a parallel/minimal Next.js surface, but README-directed development uses Vite and the API together.
Portal and Role-Based Frontend
The SPA is organized by actor-specific feature areas rather than a single generic dashboard. Family memorial/request experiences, provider operations, funeral-home operations, marketplace, ERP, staff consoles, and admin functions are separate UI domains. Representative boundaries: src/features/bereaved/pages/Dashboard.tsx, src/features/manager/pages/Dashboard.tsx, src/features/erp/pages/Dashboard.tsx, src/features/admin/pages/Dashboard.tsx, and src/developer/pages/Dashboard.tsx. Shared portal framing and route-level entitlement controls sit in src/components/layout/PortalLayout.tsx and src/components/ProFeatureRoute.tsx.
Identity, Authorization, and Tenancy
Supabase is the identity and primary data boundary. The browser client is configured in src/integrations/supabase/client.ts; server-side privileged operations use server/supabase-admin.ts. Authentication UI/state and access decisions originate in src/components/auth/AuthProvider.tsx, src/features/auth/pages/AuthCallback.tsx, and server routes such as server/routes/authSecurityRoutes.ts. Database migrations encode roles, RLS, tenant isolation, account controls, staff access, and security policy, notably supabase/migrations/0005_access_roles_rls_preferences.sql, supabase/migrations/0028_role_based_struta_erp.sql, and supabase/migrations/202606190003_fix_otp_and_pro_tenant_isolation.sql.
Service Requests, Operations, and ERP Flow
Families can create and manage memorials and service requests; providers/homes receive, schedule, staff, and fulfill them. The request workflow spans UI components such as src/components/RequestSender.tsx and src/components/ProviderRequests.tsx, backend handling in server/routes/paymentRequestRoutes.ts, and operational workspaces in src/features/manager/pages/TasksWorkspace.tsx and src/features/pro-erp/pages/Workspace.tsx. Workflow automation is a distinct server boundary in server/routes/workflowAutomationRoutes.ts, backed by queue-oriented schema migrations including supabase/migrations/202606191430_workflow_automation_queue.sql.
Payments, Billing, and External Commerce
Billing supports subscriptions, payment requests, manual payments, refunds, disputes, and provider payout concerns. HTTP payment adapters are separated by gateway in server/routes/paystackRoutes.ts, server/routes/paypalRoutes.ts, and server/routes/stripe-routes.ts; domain orchestration is in server/services/billing-service.ts, server/services/checkout-service.ts, and server/services/payment-capture-service.ts. Paystack is explicitly configured for frontend checkout and server verification; PayPal and Stripe integrations are also present. Payment-sensitive persistence and RLS changes live under supabase/migrations/0020_fix_payments_rls_and_admin_access.sql and later Paystack hardening migrations.
Async, Realtime, Notifications, and AI
The API includes internal queue, cache, moderation, realtime, push, and scheduled-work layers: server/jobs/queue.ts, server/performance/redisCache.ts, server/realtime/realtimeHub.ts, server/push-server/pushServer.ts, and server/moderation/moderationWorker.ts. Browser push uses VAPID/web-push and public/push-sw.js, rather than Firebase. User-facing realtime notifications are represented by src/components/RealtimeNotifications.tsx. Jamila AI is exposed in the UI through src/components/JamilaAssistant.tsx; an additional Go API service includes AI-related logic in go-services/api-backend/jamila.go.
Deployment and Auxiliary Services
The main application is containerized and deployable to Render, Docker, or Oracle through Dockerfile, render.yaml, and oracle.yaml; the Docker path runs migrations before starting. Supabase additionally hosts the JWT-protected provider-verification Edge Function at supabase/functions/provider-verification/index.ts, which calls Google Maps/Places and optionally Resend, then writes verification outcomes to platform records. The repository also contains independently runnable Go services for notifications, Paystack, SMTP mail, family AI, background work, and tribute handling, with examples at go-services/notifications-service/main.go, go-services/paystack-service/main.go, and go-worker/main.go; treat these as separate deployment units from the Node API.
Main entry points: client.ts Supabase auth and data · index.ts Node TypeScript API · main.tsx Vite React SPA · billing-service.ts Billing orchestration
Components 20
Web clients
- Vite React SPA · Primary browser runtime.
src/main.tsx - Role portals · Family, provider, home, ERP, staff, admin, and developer experiences.
src/features/bereaved/pages/Dashboard.tsx - Portal shell · Shared framing and entitlement controls.
src/components/layout/PortalLayout.tsx - Request workflow UI · Creates requests and exposes provider operations.
src/components/RequestSender.tsx - Realtime and AI UI · Notifications and Jamila assistant.
src/components/RealtimeNotifications.tsx - Minimal Next surface · Parallel, non-primary application surface.
app/page.tsx
Node API
- Node TypeScript API · Primary server for application and integration endpoints.
server/index.ts - Auth and security routes
server/routes/authSecurityRoutes.ts - Payment request routes
server/routes/paymentRequestRoutes.ts - Workflow automation · Schedules operational workflow work.
server/routes/workflowAutomationRoutes.ts - Billing orchestration · Checkout, capture, subscriptions, refunds, and disputes.
server/services/billing-service.ts - Async and realtime runtime · Queue, Redis cache, moderation, realtime hub, and push delivery.
server/jobs/queue.ts
Supabase platform
- Supabase auth and data · Primary identity, tenant data, and RLS boundary.
src/integrations/supabase/client.ts - Roles and tenant RLS · Roles, access controls, and tenant isolation policy.
supabase/migrations/0005_access_roles_rls_preferences.sql - Workflow queue schema
supabase/migrations/202606191430_workflow_automation_queue.sql - Provider verification function · JWT-protected verification writes provider outcomes.
supabase/functions/provider-verification/index.ts
Auxiliary deployments
- Go service deployments · Notifications, payments, mail, AI, tributes, and background work.
go-services/notifications-service/main.go - Go background worker
go-worker/main.go
Other components
- Payment gateways · Paystack, PayPal, and Stripe adapters.
server/routes/paystackRoutes.ts - Maps and email providers · Google Places/Maps and optional Resend.
Connections 25
- Vite React SPA → Role portals: renders
- Role portals → Portal shell: uses
- Role portals → Request workflow UI: includes
- Vite React SPA → Realtime and AI UI: shows
- Vite React SPA → Supabase auth and data: browser auth and data
- Vite React SPA → Node TypeScript API: API calls
- Minimal Next surface → Supabase auth and data: uses
- Node TypeScript API → Auth and security routes: mounts
- Node TypeScript API → Payment request routes: mounts
- Node TypeScript API → Workflow automation: mounts
- Node TypeScript API → Billing orchestration: uses
- Node TypeScript API → Async and realtime runtime: uses
- Auth and security routes → Supabase auth and data: privileged auth access
- Payment request routes → Billing orchestration: creates payment requests
- Payment request routes → Supabase auth and data: persists requests
- Workflow automation → Async and realtime runtime: enqueues work
- Workflow automation → Workflow queue schema: uses queue records
- Billing orchestration → Payment gateways: charges and verifies
- Billing orchestration → Supabase auth and data: persists payment state
- Async and realtime runtime → Realtime and AI UI: notifications and push
- Supabase auth and data → Roles and tenant RLS: enforces
- Provider verification function → Supabase auth and data: writes outcomes
- Provider verification function → Maps and email providers: verifies providers
- Go service deployments → Supabase auth and data: integrates independently
- Go background worker → Go service deployments: background processing