Architecture Overview
Technical architecture documentation for the GaugeWell platform.
System Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Browser β
ββββββββββββ¬βββββββββββββββββββββββββββββββββββ¬ββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββ βββββββββββββββββββββββ
β Client Portal β β Admin Portal β
β (Next.js) β β (Next.js) β
β portal.gaugewell β β admin.gaugewell β
ββββββββββββ¬βββββββββββ ββββββββββββ¬βββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Shared Database (Neon PostgreSQL) β
β portal_users, portal_organizations, cms_clients, β
β crm_leads, crm_clients, goals, kpis, action_items, ... β
ββββββββββββ¬βββββββββββββββββββββββββββββββββββ¬ββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββ βββββββββββββββββββββββ
β Integration Layer β β Northstar Auditor β
β (Python services) β β (Scanner API) β
β CRM, CMS, Content β β 11-stage pipeline β
β Billing, Social β β Score calculation β
βββββββββββββββββββββββ βββββββββββββββββββββββTechnology Stack
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16, React 19, TypeScript | Server & client rendering |
| Styling | Tailwind CSS v3, @gaugewell/theme | Shared design system |
| Auth (Portal) | Custom JWT + 2FA/TOTP | Portal user authentication |
| Auth (Admin) | Custom JWT + RBAC | Admin role-based access |
| Database | Neon PostgreSQL (serverless) | Primary data store |
| Background Jobs | Inngest | Async task processing |
| Payments | Stripe | Subscriptions and billing |
| Hosting | Vercel | Edge deployment |
| Error Tracking | Sentry | Runtime error monitoring |
| Analytics | Vercel Analytics | Performance monitoring |
| Integrations | Python microservices | CRM, CMS, Content AI, Social |
Application Structure
Monorepo Layout
GaugeWell Web/ # Next.js monorepo (pnpm workspaces)
βββ apps/
β βββ admin/ # Admin portal (admin.gaugewell.io)
β βββ portal/ # Client portal (portal.gaugewell.io)
β βββ docs/ # Documentation site (docs.gaugewell.io)
β βββ landing/ # Marketing site (gaugewell.io)
βββ packages/
β βββ theme/ # Shared design system (@gaugewell/theme)
βββ migrations/ # SQL migration files
βββ scripts/ # Utility scripts
GaugeWell Integrations/ # Python microservices monorepo
βββ apps/
β βββ billing-integration/
β βββ cms-integration/
β βββ content-ai/
β βββ crm-integration/
β βββ northstar-auditor/
β βββ proofing-integration/
β βββ social-integration/
βββ shared/ # Shared utilitiesAuthentication Model
The platform uses two parallel authentication systems:
Portal Authentication β For client users:
- Custom JWT stored in
portal_tokencookie - UUID-based user IDs (
portal_userstable) - Organization membership via
portal_org_members - Optional 2FA via TOTP
Admin Authentication β For GaugeWell staff:
- Custom JWT stored in
admin_tokencookie - Integer-based user IDs (
admin_userstable) - Role-based access control (RBAC) with granular permissions
- Session validation against
admin_sessionstable
GaugeWell staff access client portals via impersonation, not membership. Staff emails (@gaugewell.io) should never be added to portal_org_members or cms_memberships.
Multi-Tenant Architecture
Each client organization can have:
- A shared database connection (default β uses the platformβs Neon database)
- A dedicated tenant database (provisioned via Neon branching for data isolation)
Tenant resolution follows this priority:
cms_tenant_databasesβ Dedicated database if provisionedcms_membershipsβ Shared database with client scopingDATABASE_URLfallback β Shared database for dev/demo accounts
Key Design Principles
- Server Components First β Use React Server Components by default; client components only for interactivity
- Shared Theme Package β All UI tokens, components, and chart themes live in
@gaugewell/theme - Granular Permissions β Every admin API route uses specific
AuthConfigs(e.g.,clientsRead,contentManage) - Audit Everything β All mutations are automatically logged to
admin_audit_logs - Graceful Degradation β Portal pages handle missing data with empty states and skeleton loading
- Vertical Awareness β Scoring, dashboards, and content adapt to the clientβs business type
Decision Records
See Architecture Decision Records for documented decisions on technology choices, patterns, and trade-offs.
Last updated on