GrowQR — Architectural Diagram

v1.0

Every user gets their own private Grow Agent (a Rivet Kit actor) that orchestrates sub-agents and owns a dedicated sandboxed runtime — an OpenCode container for tool execution and a Gitea container for long-term memory. The frontend talks to the actor backend over a persistent connection; agents stream events, commit memory to the user's private git, and read/write structured state in the shared database.

Vercel / OpenNext UI Next.js 16 · React 19 frontend JS – auth – actors mgmt – chat / event stream – payments auth Clerk v6 payments Stripe Threads API – session tracking – message logs Hono · /api/rivet/* Actor Backend · Hono + Rivet Kit Actor manager Actor Runner Actor Engine Actor Storage growAgent · subAgent SandBoxed Runtime · per-user Docker service scale Agent runtime · OpenCode Agent Runtime – sub-agents – skills loading – tool execution – dockerized Memory API – tracking memory – 3 layers of memory commit_memory · read_memory · list_memory service Scale Users-repos Git manager · per-user Gitea growqr-memory.git DB / PG / AWS RDS users · user_stacks · actors · repos · opencode_sessions · events fetch · JWT rivet-client spawn_sub_agent SSE events Gitea REST drizzle

UI

Next.js 16 + React 19 on Vercel / OpenNext. Auth flows, chat composer, event console, and actor management. Talks to the actor backend over the Rivet Kit client and REST endpoints with a Clerk JWT.

auth

Clerk on browser and server. JWT is verified on every request; users are mirrored into Postgres on first sight.

payments

Stripe billing — plans, metering, webhooks, and customer portal. Flows through the same JWT identity as the rest of the app.

Threads API

Hono routes for session listing and message logs. All persistent state flows through Postgres; the Rivet handler is mounted at /api/rivet/*.

Actor Backend

Rivet Kit actors orchestrated by Hono. Two actor types — growAgent (one master per user) and subAgent (workers). Runner, Engine, and Storage are provided by Rivet; durable state mirrors into Postgres.

Agent Runtime

Per-user OpenCode container spawned via dockerode on first sign-in. Hosts sub-agent sessions, skill loading, and sandboxed tool execution. Streams events back over SSE which the Grow Agent re-broadcasts to the UI.

Memory API

Three-layer memory surface exposed to the configured OpenCode Zen model as tools (commit_memory, read_memory, list_memory). L1 in-actor state, L2 session in Postgres, L3 long-term in the user's Gitea repo.

Git manager · Users-repos

Per-user Gitea container. Backend creates an admin user, mints an access token, and bootstraps a private growqr-memory repo. Long-term memory commits land here as plain markdown.

DB / PG / AWS RDS

Postgres + Drizzle ORM. Tables: users, user_stacks, actors, repos, opencode_sessions, events. In production this is AWS RDS; in development it's the Postgres service in docker-compose.