How agicto/codingcto works
1. Repository shape
- This is a two-service monorepo: api/ is the Go backend, and web/ is the Next.js 16 console.
- They are deployed as separate units and communicate over HTTP; the README explicitly emphasizes “shares contracts, not code.”
2. Backend entrypoints and runtime boundaries
- The Go side has multiple executable entrypoints under api/cmd/: main server, a local SpecForge runtime, a generator, and several tooling commands.
- internal/bootstrap and internal/wiring assemble the app, routes, database, middleware, and dependency graph. wire_gen.go indicates DI is generated via Wire.
- The HTTP API is exposed through routes/api.go and internal/infra/router, with middleware layered around it.
3. Backend layering
- The backend is organized in a DDD-flavored structure:
- internal/domain holds core entities, value objects, events, and invariants.
- internal/modules/* contains feature modules such as auth-related user, workspace, project, planning, execution, GitHub integration, audit, API keys, and verification.
- internal/infra/* contains cross-cutting infrastructure: database, Redis, cache, queue, scheduler, events, logging, metrics, tracing, HTTP client, storage, rate limiting, retry, plugin loading, and health/monitoring.
- This separation is the main architectural boundary for the Go service.
4. Core product workflow: SpecForge
- The main business flow is “idea → planning → prompt compilation → execution → CI feedback → fix attempts → delivery.”
- On the API side, this is reflected by modules for planning, execution, repocontext, project, workspace, githubintegration, and verification.
- The database migrations show the supporting persistence model: planning tables, compiled prompts, repo profiles, execution tables, fix attempts, task events, architecture snapshots, skills, runtimes, and project tables.
5. Execution system and local runtime
- Execution is not just a queue job; it is a distributed claim/execute loop.
- The API schedules and stores tasks, while cmd/specforge-runtime runs locally beside a checked-out repository, claims codex_cli tasks, sends heartbeats, streams task events, and submits results back to the API.
- The execution module and internal/infra/queue, schedule, workflow, and events packages suggest orchestration is event- and task-driven rather than synchronous.
6. GitHub integration boundary
- GitHub is a major external dependency, with dedicated integration code under internal/modules/githubintegration.
- The repository models GitHub app configuration, settings, repository clients, webhook parsing, and webhook event storage.
- This integration appears to be how CodingCTO links product plans and execution results back to repositories, pull requests, and CI signals.
7. Security, identity, and audit
- Authentication and access control are handled by API keys, JWT, password reset tokens, user records, and workspace/project scoping.
- audit persists business-relevant actions, and migrations add audit log business fields.
- This indicates a strong separation between authenticated product usage and the execution/runtime credentials used by the local worker.
8. Persistence and data model
- Persistence is migration-first, with an explicit database/migrations folder and seeders.
- The backend supports multiple storage concerns: relational data in the main DB, Redis-backed rate limiting/cache, file/object storage, and event stores/logs where needed.
- The presence of observed database logging and migration tooling suggests operational visibility is part of the architecture, not an afterthought.
9. Configuration, observability, and resilience
- The infra layer includes config loading/watching, logging, metrics, tracing, health checks, circuit breaker, retry, singleflight, and request middleware.
- These cross-cutting systems are applied around the API rather than embedded in business modules.
- This matters for diagrams because the API is more like a platform service with many guardrails than a thin CRUD server.
10. Web app structure
- The frontend is a Next.js App Router application with route groups for public site, auth, protected console, and devtools.
- The console under src/app/(protected)/(console) mirrors the product domains: projects, SpecForge, skills, agents, settings, and codingcto-specific views.
- middleware.ts and the auth route handlers show that session gating happens at the web edge as well as in the backend.
11. Frontend feature architecture
- The web app is organized feature-first under src/features/*, not by page-only structure.
- Major client-side domains include auth, project, specforge, agents, skills, and example, each with components, hooks, services, and domain logic.
- This is important for an architecture diagram because much of the UI state and workflow logic lives in reusable feature packages rather than directly in page components.
12. Frontend data flow
- The web app uses server-side API routes as a proxy layer for some auth/session operations and a catch-all /api/v1/[...path] bridge to the backend API.
- Client features use hooks, stores, and services to consume backend data and drive console state.
- There is a clear separation between presentation components, browser state, and server-side request/session handling.
13. Shared product concerns in the console
- The console is centered on operational views of the SpecForge pipeline: project onboarding, repository context, planning review, prompt compilation, runtime setup, execution health, CI review, and delivery status.
- The UI is not just a dashboard; it is a workflow surface for manipulating the artifacts produced by the backend pipeline.
14. Tooling, tests, and delivery
- The repo has strong automated support: Go unit/integration/feature tests, Kest flow tests, generated DI, and CI workflows in GitHub Actions.
- The API also ships developer tools like APIDoc parsing, route helpers, and migration/testing utilities.
- The web side includes linting, type-checking, Vitest, and a substantial design-system/component layer.
15. How to draw the main system boundary
- The clearest high-level diagram is: user/browser → Next.js console → Go API → database/Redis/GitHub/external AI runtime.
- The API owns durable state, orchestration, and integrations; the web app owns interaction and workflow visualization.
- The local SpecForge runtime is a third operational actor that connects the API to real repository execution on a developer or runner machine.
Main entry points: api API service · modules Feature modules · web Web app · app.go Bootstrap
Components 22
Monorepo
Two deployable services plus shared operational tooling.
- codingcto · Two-service monorepo: Go API plus Next.js console.
Go API
Backend service with domain modules, infrastructure, and multiple command entrypoints.
- API service · Main Go application boundary exposed over HTTP.
api - Server cmd · Primary HTTP server executable.
api/cmd/server/main.go - SpecForge runtime · Local runtime that claims execution tasks beside a repository checkout.
api/cmd/specforge-runtime/main.go - Generator cmd · Code generation and scaffolding entrypoint.
api/cmd/generator/main.go - Bootstrap · Assembles app startup, HTTP, migration, and seeding flows.
api/internal/bootstrap/app.go - Wiring · Generated dependency graph and module assembly.
api/internal/wiring/wire_gen.go - API routes · Top-level route surface for the backend API.
api/routes/api.go - Router · HTTP router and middleware integration.
api/internal/infra/router/router.go - Domain model · Core entities, value objects, events, and invariants.
api/internal/domain - Feature modules · Business modules such as auth, project, planning, execution, verification, and GitHub integration.
api/internal/modules - Infrastructure · Database, cache, queue, scheduler, logging, metrics, tracing, HTTP clients, storage, and resilience primitives.
api/internal/infra - Database · Migration-first relational store for product, workflow, and audit data.
api/database - Redis · Backing store for cache, limiter, and fast coordination.
api/internal/infra/redis/redis.go - GitHub · Repository, webhook, and CI integration boundary.
api/internal/modules/githubintegration - AI runtime · Prompt compilation and execution-facing AI capability boundary.
api/internal/capabilities/ai/ai.go
Next.js Console
Frontend console and edge proxy layer.
- Web app · Next.js console and API proxy boundary.
web - Web middleware · Session gating and request interception at the frontend edge.
web/middleware.ts - API bridge · Auth routes and catch-all proxy to the backend API.
web/src/app/v1/[...path]/route.ts - Console UI · Protected console routes for projects, SpecForge, skills, agents, and settings.
web/src/app/(protected)/(console)/console - Feature packages · Reusable client features for auth, project, SpecForge, agents, skills, and example flows.
web/src/features - Client state · Hooks, stores, query state, and feature services used by the console.
web/src/store
Connections 27
- codingcto → API service: contains · Monorepo includes the Go backend service.
- codingcto → Web app: contains · Monorepo includes the Next.js console.
- API service → Server cmd: starts · Primary service is launched from the server command.
- API service → SpecForge runtime: starts · Execution worker runs as a separate runtime process.
- API service → Generator cmd: starts · Generator is a separate tooling entrypoint.
- Server cmd → Bootstrap: boots · Server entrypoint delegates startup assembly to bootstrap.
- Bootstrap → Wiring: uses · Bootstrap relies on generated dependency wiring.
- Bootstrap → API routes: mounts · Bootstrap connects the API route surface.
- API routes → Router: runs on · Top-level routes sit on the shared router and middleware stack.
- Router → Feature modules: dispatches · Router hands requests into feature modules.
- Feature modules → Domain model: models · Feature modules implement business logic over core domain types.
- Feature modules → Infrastructure: depends on · Modules use infra services for persistence, queueing, logging, and integrations.
- Infrastructure → Database: persists · Infrastructure layer manages database access and migrations.
- Infrastructure → Redis: coordinates · Infrastructure uses Redis for cache and distributed coordination.
- Feature modules → GitHub: integrates · Dedicated module boundary for GitHub repositories, webhooks, and settings.
- Feature modules → AI runtime: calls · Planning and execution flows depend on AI-backed capabilities.
- SpecForge runtime → API service: claims tasks · Local runtime exchanges heartbeats, events, and results with the API.
- Web app → Web middleware: gates · Frontend edge applies auth/session gating.
- Web app → API bridge: proxies · Web routes proxy auth and API traffic to the backend.
- Web app → Console UI: renders · Protected App Router console is the main user surface.
- Console UI → Feature packages: composes · Pages are built from feature-first UI packages.
- Feature packages → Client state: uses · Features share hooks, stores, and service clients.
- API bridge → API service: HTTP to · Frontend bridge forwards requests to the Go API.
- Console UI → API service: fetches from · Console workflow views are backed by the backend API.
- API service → Database: reads/writes · Backend owns durable product and workflow state.
- API service → Redis: uses · Backend uses Redis-backed coordination and rate limiting.
- API service → GitHub: webhooks · GitHub events and repository state feed product workflows.