N Nexus Docs
Architecture

Tech Stack

Full technology stack used in the NexusCommerce platform, with version details and rationale.

Overview

NexusCommerce is built on a modern, TypeScript-first stack with a Python AI worker fleet. Every technology choice was made to balance developer velocity, operational simplicity, and production scale.

Key Concepts

Monorepo — All code (frontend, backend, packages, services) lives in a single pnpm workspace managed by Turborepo. This enables shared TypeScript types, coordinated versioning, and unified CI/CD.

TypeScript First — The entire application layer (Next.js, NestJS, packages) is written in TypeScript. This catches integration bugs between services at compile time.

Getting Started

To understand how to work with the stack, read:

Features

Frontend

TechnologyVersionPurpose
Next.js15React framework with App Router, Server Components
React19UI component library
Tailwind CSSv4Utility-first CSS with design token system
shadcn/uiLatestAccessible component primitives
TypeScript5.xType safety
pnpm9.xPackage manager
Turborepo2.xMonorepo build system

Design System — The packages/ui package exports the shared component library with custom design tokens:

  • bg-0, bg-1, bg-2 — Background hierarchy tokens
  • text-0, text-1, text-2 — Text hierarchy tokens
  • border-0, border-1 — Border tokens
  • accent copper#C8956C — Primary accent color

The frontend uses a dark-only "Luxury Instrument Panel" theme. Light mode is not supported.

Key Libraries:

  • @tanstack/react-query — Server state management
  • recharts — Charts for analytics dashboard
  • @dnd-kit/core — Drag-and-drop for FlowForge canvas
  • zod — Form validation schemas

Backend API

TechnologyVersionPurpose
NestJS11Node.js API framework
TypeScript5.xType safety
Supabase JS2.xDatabase client
BullMQ5.xJob queue (backed by Redis)
@nestjs/schedule4.xCron-based adapter scheduling
Zod3.xInput validation

Module Structure — The NestJS API follows the Module + Service + Controller triplet pattern. Each domain has its own module registered in app.module.ts.

Domain modules:

  • CatalogModule — Products, listings, images
  • FulfillmentModule — Orders, shipments
  • InventoryModule — Warehouses, stock levels, adjustments
  • IntelligenceModule — Pricing rules, recommendations, Buy Box
  • AnalyticsModule — ClickHouse queries, custom reports
  • AdsModule — Ad campaigns and performance
  • ReviewsModule — Review import and sentiment
  • ConnectionsModule — Marketplace connection management
  • WorkersModule — AI job dispatch and monitoring
  • BillingModule — Stripe subscription management
  • AuthModule — JWT validation, API key management

Database

TechnologyVersionPurpose
SupabaseCloud / self-hostedPrimary database + auth + storage + realtime
PostgreSQL15Relational data store
Row Level SecurityMulti-tenant data isolation

Supabase provides:

  • PostgreSQL with 25+ tables and RLS policies
  • Supabase Auth for user authentication and JWT issuance
  • Supabase Storage for product images and CSV exports
  • Supabase Realtime for live dashboard updates

Analytics

TechnologyVersionPurpose
ClickHouse24.xColumnar analytics database
ClickHouse HTTP interfaceUsed by NestJS for query execution

ClickHouse hosts the analytics tables (orders, pricing events, inventory events) and materialized views for sub-second dashboard queries. Data is ETL'd from Supabase via the NestJS ETL service.

AI Workers

TechnologyVersionPurpose
Python3.12Worker runtime
FastAPI0.111Worker API framework
OpenAI Python SDK1.xLLM API access
httpx0.27Async HTTP client for marketplace APIs

Workers receive job parameters via HTTP from the NestJS API (which picks jobs from the BullMQ queue), execute the AI task, and write results back to Supabase via the Supabase Python client.

Infrastructure

TechnologyPurpose
Docker / Docker ComposeContainerized development and production deployment
CaddyProduction reverse proxy with automatic Let's Encrypt TLS
Redis 7BullMQ job queue backing store
Kubernetes / HelmCluster deployment with HPA autoscaling
GitHub ActionsCI/CD — image builds, VPS deploy, K8s deploy
GitHub Container RegistryDocker image storage (ghcr.io)
GrafanaMonitoring dashboards (ClickHouse + Redis datasources)

See Deployment for production setup details.

Configuration

Key package.json scripts across the monorepo:

# Root
pnpm build        # Build all packages and apps
pnpm dev          # Start all services in development mode
pnpm lint         # Lint all packages
pnpm typecheck    # Run TypeScript compiler checks

# apps/web
pnpm dev          # Next.js dev server on port 3000
pnpm build        # Production build

# apps/api
pnpm dev          # NestJS dev server on port 4000
pnpm build        # Compile TypeScript to dist/

# services/workers
uvicorn main:app --reload --port 8000