Skip to main content

Platform Architecture Overview

The Shift Platform is a Bun/TypeScript monorepo that provides infrastructure tooling for AI coding agents. Each service is an independent git submodule with its own repository, mounted into the platform monorepo. A single Hono-based gateway aggregates all service APIs in-process, exposing them on port 3000.

High-Level Design

At its core, the platform follows three key architectural principles:

  1. Monorepo with submodule isolation -- Services share patterns and core libraries but are developed, versioned, and deployed as part of a unified gateway.
  2. In-process API aggregation -- The gateway imports each service's createApp() factory and mounts it directly. There is no inter-service HTTP proxying (with the exception of the optional Stage proxy).
  3. Pluggable storage -- Every service defines a store interface. The backing implementation (Convex, file-based, or gateway-backed) is selected at runtime via the SHIFT_STORAGE environment variable.

Gateway Routing

All client traffic enters through the gateway on port 3000. The gateway mounts service APIs under versioned prefixes:

Client --> Gateway (:3000)
|-- /healthz (platform-core health)
|-- /api/v1/catalog/* (yellowpages)
|-- /api/v1/passport/* (passport)
|-- /api/v1/pulse/* (pulse)
|-- /api/v1/ledger/* (ledger)
|-- /api/v1/palette/* (palette)
|-- /api/v1/communication/* (communication)
|-- /api/v1/inference/* (inference)
|-- /api/v1/git/* (git)
|-- /api/v1/stage/* (stage -- proxy or in-process)
+-- /* (static web UI)

Services are conditionally mounted based on feature flags. If a service's feature flag is disabled, its routes are not registered and requests to its prefix return 404.

Service Topology

ServiceDirectoryTypeDev Port (API)Dev Port (Web)Storage Dir
Gatewaypackages/gatewayAPI gateway3000 (prod)----
Platform Corepackages/coreShared library------
Yellow Pagesyellowpages/CLI + API + Web40014101.yellowpages/
Passportpassport/CLI + API + Web40024102.passport/
Pulsepulse/CLI + API + Web40034103.pulse/
Ledgerledger/CLI + API + Web40044104.ledger/
Stage (CLI)stage-cli/CLI + API + Web40054105--
Stage (Next.js)stage/Web + API routes3000 (standalone)--Convex-backed
Palettepalette/CLI + API + Web40064106.palette/
Communicationcommunication/CLI + API + Web40074107.communication/
Inferenceinference/CLI + API4008--.inference/
Gitgit/CLI + API4009--.shift-git/
Billingbilling/CLI + API + Web40104110.billing/

Admin dashboard overview of all platform services

Apps catalog showing published Stage apps with metadata

Per-Service Package Structure

Each service submodule follows a four-package layout:

<service>/
packages/
shared/src/ # Types, store interfaces, store implementations
api/src/ # Hono API (createApp() factory, routes)
cli/src/ # Commander.js CLI (commands, main entry)
web/src/ # React SPA (pages, components)
  • shared -- Defines the service's data types and the ServiceStore interface. Contains store implementations for each backend (file, convex, gateway).
  • api -- Exports a createApp() factory that returns a Hono app. The gateway imports this factory to mount the service in-process.
  • cli -- Commander.js CLI with commands that support the output triple: human-readable (default), --json, and --quiet.
  • web -- React SPA served as static files by the gateway. Each service's web UI is built into the gateway's public/ directory.

Shared Code: @shift/platform-core

The packages/core directory publishes @shift/platform-core, a shared library used by all services:

Export PathPurpose
@shift/platform-core/outputChalk-based output helpers (success, error, info, warn, table, barChart)
@shift/platform-core/exit-codesSemantic exit codes (0 through 5)
@shift/platform-core/api/responseAPI response envelope (ok(), err(), ApiResponse<T>)
@shift/platform-core/api/error-handlerHono error handler middleware + HttpError, badRequest(), notFound(), conflict()
@shift/platform-core/api/healthhealthRoute() factory for /healthz endpoints
@shift/platform-core/storageRepository<T>, EventRepository<T> interfaces + getStorageBackend()
@shift/platform-core/convex-clientGeneralized Convex HTTP client (convexQuery(), convexMutation())
@shift/platform-core/featuresFeature flag definitions and isFeatureEnabled()

Git Submodule Workflow

Services are git submodules -- independent repositories mounted in the platform. This means each service has its own commit history, branches, and release cycle.

# Clone with submodules
git clone --recurse-submodules <repo-url>

# Update all submodules to latest
git submodule update --remote --merge

# Work in a submodule
cd yellowpages
git checkout -b feature/my-change
# ... make changes, commit, push ...
cd ..
git add yellowpages
git commit -m "Update yellowpages submodule"

When making changes to a submodule, you must commit and push within the submodule first, then update the submodule reference in the platform root.