Architecture

Architecture

WeWorks is a Yarn 4 + Turbo monorepo with separate deployable applications and shared packages.

Repository layout

weworks/
├── apps/
│   ├── api/          # Fastify API, Prisma, PostgreSQL
│   ├── client/       # Next.js 14 — main web app
│   ├── landing/      # Next.js 15 — public marketing site
│   └── docs/         # Nextra docs (this site)
├── packages/
│   ├── config/       # Shared ESLint config
│   └── tsconfig/     # Shared TypeScript config
├── docker-compose.yml
├── Dockerfile
└── INSTALL.md        # Extended server install guide

Tech stack

LayerTechnology
Frontend (client)Next.js 14, React 18, Tailwind, shadcn/ui
Frontend (landing)Next.js 15, Tailwind
DocsNextra 3, nextra-theme-docs
APIFastify 4, TypeScript
DatabasePostgreSQL 15, Prisma 5
PaymentsStripe
AuthSession JWT/cookies, OAuth/OIDC/SAML

How apps communicate

Browser  →  Client (3001)  →  /api/v1/* proxy  →  API (5003)  →  PostgreSQL
Browser  →  Landing (3000)  →  public pages + links to client auth
Browser  →  Docs (3002)     →  static documentation

The client app proxies API requests through pages/api/v1/[...path].ts so the browser uses same-origin /api/v1 while the server forwards to the Fastify API.

API structure

apps/api/src/
├── controllers/    # Route handlers (tickets, auth, wallet, hardware, …)
├── lib/            # Auth, sessions, roles, email, notifications
├── prisma/         # Schema, migrations, seed
└── main.ts         # Server entry (port 5003)

Key domains: tickets, users, wallet/credit, hardware orders, tasker seeds, admin config, webhooks, email queues.

Client structure

apps/client/
├── pages/              # Next.js routes (issues, admin, hardware-shop, …)
├── components/         # UI components (CreateTicketForm, TaskerDashboard, …)
├── @/shadcn/           # shadcn/ui components and hooks
├── locales/*/weworks.json   # i18n strings
└── store/              # Session/user state

Production deployment (Docker Compose)

The root docker-compose.yml runs five services:

ServiceImageHost port
weworks_postgrespostgres:15-alpine5432
weworks_apighcr.io/…/api5003
weworks_landingghcr.io/…/landing80 → 3000
weworks_clientghcr.io/…/client3001
weworks_docsghcr.io/…/docs3002

Images are built via GitHub Actions and published to GHCR. The API container runs Prisma migrations and seed on startup.

Environment configuration

  • API: apps/api/.envDATABASE_URL, SECRET, JWT_SECRET, STRIPE_SECRET_KEY, FRONTEND_URL
  • Client: apps/client/.envAPI_URL, NEXT_PUBLIC_API_URL, Stripe publishable key
  • Copy from each app’s .env.example when setting up locally