by Ta-Tech Solutions All documents

05 - System Architecture

CivicLoop by Ta-Tech Solutions Purpose: Describe how the system is built - the platform engine it stands on, the multi-tenant model, the technology, how it works offline, where it is hosted, and how it ships. Written so an engineer reads it as a spec and a County technical reviewer reads it as due diligence.


1. The honest framing: this is not built from scratch

CivicLoop is a new product on a proven platform engine. Ta-Tech Solutions runs that same engine in production today under two other products:

What CivicLoop inherits from that engine, working and hardened:

Inherited capability What it means for CivicLoop
Multi-tenant isolation Each County is a fully isolated tenant; no query crosses the boundary
Authentication + two-factor (TOTP) Staff sign-in, MFA, trusted devices - already built
Role-based access control The Document 04 role model is configuration on an existing RBAC engine
Row-level security Tenant + role isolation enforced at the data layer, not just the UI
35-language internationalization Every string, every surface, translatable; the pipeline exists
Offline-first behavior Service worker + local store + sync queue - proven pattern
AI agent framework The structure for AI components that classify, predict, converse
Audit logging Immutable, attributable action log on every meaningful event
Dashboards + analytics shell Tile/heat-map/trend dashboard components
Branded document generation Localized, branded PDFs and printables
Build / deploy / docs pipeline Type-checked builds, deploy automation, hosted doc site

What is net-new for CivicLoop (the 9-day core build plus the 2026-05-18 wave):

This split is why a serious 311 product in nine days is realistic. Roughly half the system already exists and is in production; the team builds the 311-specific half on top.

1a. The 2026-05-18 lib modules

The 311-specific code is organized under web/src/lib/ so the boundaries are clean. Each module owns one concern, has its own RLS posture in the schema dump, and is independently testable.

Module Responsibility
web/src/lib/autopilot/ The Autopilot orchestrator (run.ts) - reads counties.autopilot_level, drives the auto-route / auto-assign / auto-notify chain on intake. Also owns the self-healing SLA escalator (heal.ts) reachable via the /api/cron/self-heal endpoint and the /admin "Run now" button. Every action attributed to actor='ai' with the AUTOPILOT: log prefix.
web/src/lib/visits/ Scheduled visits - create, cancel, complete, list. Owns the SMS + email send and the .ics payload generator that /api/visits/[id]/ics/route.ts serves.
web/src/lib/channels/ The Slack-style department-channels engine. Owns message persistence, @mention parsing, the CP-... auto-linker, substring search, and the deterministic slash-command router (/help, /open, /breaches, /summary CP-...).
web/src/lib/ai/loop-persona.ts The @loop channel AI persona. Wraps Claude Haiku, grounded in a freshly computed county snapshot (open count, breaches, last-24h status mix). Never replies to slash commands.
web/src/lib/predict/ The forecast engine (forecast.ts). 12-week mean times recent seasonality per (category, council_district). Triggered by the director "Run forecast now" button; writes predicted_issues.
web/src/lib/survey/ Auto-survey creation (send.ts) on RESOLVED transitions, plus the public survey page rendering helpers.
web/src/lib/dashboard/ The director-dashboard read models - equity.ts (median resolution + SLA on-time + headline by council district) and nps.ts (avg score, CSAT %, NPS from request_surveys).
web/src/lib/public/ The public transparency portal's stats aggregator (stats.ts) - last-7-day filed/resolved/open/median resolution/SLA on-time/NPS, top categories, by-district, anonymized scatter. Strict no-PII guarantee enforced at this layer.
web/src/lib/council/ The /council/[district] scoped data layer (data.ts) - the per-district slice of totals, open, resolved, SLA breaches, top categories, recent requests, and the district's slice of the forecast.

Each module imports the same supabase-js service-role client, the same audit logger, and the same actor convention. Adding a tenth module follows the same shape.

2. The surfaces

CivicLoop is one system with three front-ends, all talking to the same core.

   RESIDENT SURFACE            STAFF CONSOLE              DIRECTOR DASHBOARD
  (web + installable           (web, desktop +           (web)
   mobile / PWA)                field-mobile)
        |                           |                          |
        |  voice / text / photo     |  queue, claim, work,      |  county-wide
        |  intake; track my         |  resolve-with-proof,      |  volume, SLA,
        |  requests; public map     |  override routing         |  heat-map, trends
        |                           |                          |
        +-------------+-------------+--------------+-----------+
                      |                            |
                      v                            v
            +-------------------------------------------------+
            |                CIVICLOOP CORE                  |
            |                                                 |
            |  Request lifecycle engine  |  AI components      |
            |  Routing + SLA engine      |  Notification engine|
            |  RBAC + tenant isolation   |  Audit logging      |
            |  Open311 API               |  Geo / mapping      |
            +-------------------------------------------------+
                      |                            |
                      v                            v
            +------------------+        +-------------------------+
            |  Data layer      |        |  External integrations  |
            |  (tenant-scoped, |        |  - SMS / WhatsApp / email|
            |   row-level      |        |  - Maps / geocoding     |
            |   security)      |        |  - MyPGC / govDelivery  |
            |                  |        |  - Open311 in/out       |
            +------------------+        +-------------------------+

3. Multi-tenant model

CivicLoop is multi-tenant from the data layer up. Prince George's County is one tenant. The architecture supports many.

Why a County panel should care: it means CivicLoop is not a bespoke one-off that rots after launch. It is a product with a roadmap, a shared codebase, and other deployments hardening it - the opposite of the abandoned-app failure mode (PublicStuff, PGC311).

4. Technology

The stack is the Ta-Tech engine's proven stack. The specifics matter less than the properties, but for the technical reviewer:

5. The offline-first story (a real differentiator)

Most 311 systems assume a smartphone with a good connection. In a large, diverse county that is not always true - poor coverage areas, older devices, field workers in basements and dead zones, and the moments that matter most (storms, outages) are exactly when connectivity is worst.

CivicLoop is offline-capable by design, inherited from the engine:

We can say to the County, truthfully: residents can still report problems, and crews can still log work, during outages and in poor coverage. No competitor we surveyed does this convincingly.

6. Security architecture (summary - full detail in Document 09)

7. How it ships

CivicLoop uses the Ta-Tech engine's delivery pipeline:

For the pilot, this means changes the County asks for during the ninety days land quickly and safely, not in a quarterly release train.

8. Scalability and the platform path

CivicLoop v1 is scoped to 311 for one county. The architecture is deliberately built so the Phase 2 and Phase 3 path (Document 01, Section 9) is additive, not a rewrite:

The architecture is the moat: a competitor following us has to rebuild their core to be multi-tenant and cross-domain. CivicLoop starts there.


Next: 06 - Screens & User Flows.

PreviousRoles & Permissions
CivicLoop - Ta-Tech Solutions - Architecture & Design Documentation