Project Structure
Understand the RocketX monorepo layout: API routes, shared models, and the web app.
The project uses Turborepo for workspace management and npm workspaces.
Monorepo Overview
.
├── apps/
│ ├── api/ # Express.js backend (TypeScript, OpenAPI/Scalar, RBAC)
│ └── web/ # Next.js frontend (React, Tailwind v4, Shadcn UI)
└── packages/
└── shared/ # Mongoose models, session crypto, email, PayID utils
docker-compose.yml— runs MongoDB and both apps locally.turbo.json— build pipeline configuration.
Apps
apps/api — Express Backend
All REST routes live under /v1/. Responses follow { success, data, message }.
| Path | Purpose |
|---|---|
src/routes/developer.ts | Strategy CRUD, GitHub OAuth, version submissions, framework detection |
src/routes/marketplace.ts | Public strategy discovery and instance activation |
src/routes/payments.ts | CRDTS wallet top-ups and transfers |
src/routes/subscriptions.ts | Plan checkout, renewal, and reconciliation |
src/routes/webhooks.ts | Incoming GitHub App webhooks |
src/middleware/auth.ts | Session and API key verification |
src/middleware/rbac.ts | Team role enforcement |
apps/web — Next.js Frontend
The App Router separates concerns into three route groups:
| Route group | Purpose |
|---|---|
app/(site)/ | Public landing page, guides, legal |
app/(app)/ | Authenticated dashboard, marketplace, developer portal, instances |
app/(auth)/ | Login, register, password reset |
Key frontend paths:
app/(app)/marketplace/— browse and activate strategies.app/(app)/developer/— developer portal: create and manage strategies.app/(app)/developer/strategies/[strategyId]/— version submissions, pipeline results.app/(app)/instances/— monitor running strategy instances.app/(app)/wallet/— CRDTS balance, top-up, transaction history.utils/marketplace/— typed API service layer and shared interfaces.
Shared Package
packages/shared
Single source of truth for all Mongoose models consumed by both the API and web server components.
| Module | Contents |
|---|---|
lib/models/ | User, Team, Strategy, StrategyVersion, StrategyInstance, Wallet, etc. |
lib/notifications/events.ts | Canonical notification event type registry |
utils/ | Session encryption, email helpers, PayID PKCE |
packages/tsconfig
Shared TypeScript compiler settings for consistent strictness across the monorepo.
Key Patterns
- Schema-driven: All API request/response shapes flow from shared Mongoose models → TypeScript interfaces in
utils/marketplace/types.ts→ typed service methods → UI. - Server-side auth: Sessions are verified on the Express API; Next.js RSCs read the session via
ENCRYPTION_KEYfor server-rendered pages. - Proxy rewrites:
next.config.tsrewrites/api/*to the Express server so the browser talks to one origin.