Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ency07/B2B/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through everything needed to run both the public marketing site and the authenticated ERP dashboard on your local machine. By the end you’ll have a fully functional development environment with live Supabase connectivity, seeded test data, and hot-module replacement running at http://localhost:3000.
Prerequisites before you begin:
  • Node.js 20.x or later — 22.x LTS is recommended for best performance
  • npm 10+ — ships with Node.js 22
  • A Supabase project — either a local Supabase instance (npx supabase start) or a free cloud project at supabase.com

Hardware Requirements

ResourceDev (Minimum)Dev (Recommended)Prod (Minimum)Prod (Recommended)
RAM8 GB16 GB2 GB4 GB
CPU4 cores8 cores2 cores4 cores
Storage10 GB free20 GB SSD20 GB SSD40 GB SSD
Node.js20.x22.x20.x LTS22.x LTS
OSmacOS / Linux / Windows (WSL2)
The primary performance bottleneck is Supabase (Postgres + storage), not the Next.js frontend. For high-traffic workloads (>10k req/min), use Vercel Pro or horizontal scaling with containers.

Steps

1

Clone the repository

git clone https://github.com/ency07/B2B.git
cd B2B
2

Install dependencies

npm install
All dependencies use exact pinned versions — no ^ ranges — ensuring every developer and CI run resolves identical packages. A full install takes roughly 60–90 seconds on a cold cache. Do not run npm update without first consulting docs/15_frontend/DEPENDENCY_GUIDE.md.Key pinned versions installed:
  • next 16.2.9 · react 19.2.4 · typescript 5.9.3
  • @supabase/supabase-js 2.108.2 · zod 4.4.3 · vitest 3.1.3
  • tailwindcss 4.3.1 · framer-motion 12.40.0 · recharts 3.8.1
3

Configure your environment

Copy the example file to create your local environment:
cp .env.example .env.local
Then open .env.local and fill in the four required variables:
# ── Supabase public (exposed to browser via NEXT_PUBLIC_ prefix) ──────────
NEXT_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here

# ── Default tenant slug ───────────────────────────────────────────────────
NEXT_PUBLIC_DEFAULT_TENANT_CODE=acme

# ── Supabase server-only (never exposed to the browser) ──────────────────
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here
You can find NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, and SUPABASE_SERVICE_ROLE_KEY in your Supabase project dashboard under Project Settings → API.
4

Run database migrations

Apply all SQL migrations to your Supabase project:
npx ts-node scripts/deploy-migrations.ts
This executes every file in supabase/migrations/ in timestamp order. Make sure .env.local is pointing to the correct Supabase project before running. After the command completes, verify integrity:
npx ts-node scripts/check-rls-coverage.ts
npx ts-node scripts/check-index-collisions.ts
5

Seed test data (optional)

Populate the database with two pre-configured tenants (acme and apex) plus test users for each role:
npm run seed:test
To remove all seeded data later:
npm run seed:test:clean
6

Start the development server

npm run dev
The application starts at http://localhost:3000:
  • / — Public marketing landing page
  • /wizard — Lead generation multi-step wizard
  • /portal — Public tenant portal
  • /dashboard — Authenticated ERP dashboard (requires login)

Available npm Scripts

ScriptCommandDescription
devnext devStart dev server with standard HMR
dev:turbonext dev --turboStart dev server with Turbopack (faster HMR)
buildnext buildProduction build
startnext startServe the production build
test:unitvitest runRun all unit tests once
test:watchvitestRun tests in interactive watch mode
test:coveragevitest run --coverageRun tests with V8 coverage report
linteslintRun ESLint across the codebase
audit:securitynpm audit --audit-level=highFail on high+ CVEs
deps:pinnode scripts/pin-versions.jsRe-pin all versions from package-lock.json
Use npm run dev:turbo during development for significantly faster Hot Module Replacement powered by Turbopack. Turbopack is production-ready in Next.js 16 and reduces cold-start and rebuild times substantially on large codebases like this one.

Build docs developers (and LLMs) love