twizrr is a Nigerian social commerce marketplace for shoppers and store owners. Stores publish products and posts, shoppers discover items through the web app and WhatsApp, and every checkout is protected by twizrr Buyer Protection.
This repository is a pnpm/Turborepo monorepo with:
apps/backend- NestJS API for auth, stores, products, orders, payments, delivery, notifications, WhatsApp, and admin operations.apps/web- Next.js App Router web app for the public landing site, shopper app, store workspace, and admin surfaces.packages/shared- shared TypeScript types, DTOs, and enums.
- Node.js 20+
- pnpm
- PostgreSQL 16 with pgvector enabled
- Redis using a Redis protocol URL,
redis://orrediss:// - Provider accounts for the integrations you enable locally
Do not use npm or yarn for this repo.
Install dependencies from the repo root:
pnpm installStart local infrastructure if you want Docker-managed services:
docker compose up -d postgres redisDocker is optional for local development. You can also point local env files at managed PostgreSQL and Redis services.
Copy env examples and fill only local/dev values:
Copy-Item apps/backend/.env.example apps/backend/.env.local
Copy-Item apps/web/.env.example apps/web/.env.localDo not commit .env.local or real secrets.
Backend:
DATABASE_URLis the pooled app connection string.DIRECT_URLis the direct database connection string for Prisma migrations.REDIS_URLmust beredis://...orrediss://....- Do not use Upstash REST
https://...URLs asREDIS_URL.
Web:
NEXT_PUBLIC_API_URLpoints to the backend API base URL.NEXT_PUBLIC_WEB_URLis the product-app web origin.NEXT_PUBLIC_MARKETING_URLis the public marketing origin.NEXT_PUBLIC_MARKETPLACE_ENABLED=falsekeeps unfinished app/marketplace routes gated on public pre-launch environments.
Use apps/backend/.env.example and apps/web/.env.example as the source for
supported env names.
Validate the schema:
cd apps/backend
pnpm exec prisma validate --schema=prisma/schema.prismaGenerate Prisma client:
cd apps/backend
pnpm exec prisma generate --schema=prisma/schema.prismaApply migrations to a shared/dev/staging/production database:
cd apps/backend
pnpm exec prisma migrate deploy --schema=prisma/schema.prismaUse migrate dev only for local migration authoring. Never use db push for
shared Twizrr environments.
Backend:
cd apps/backend
pnpm run devWeb:
cd apps/web
pnpm run devDefault local URLs:
- Web:
http://localhost:3000 - Backend:
http://localhost:4000 - Backend health:
http://localhost:4000/health
Build the full workspace from the repo root:
pnpm run buildBuild only the backend and its workspace dependencies:
pnpm exec turbo run build --filter=@twizrr/backend...Build only the web app and its workspace dependencies:
pnpm exec turbo run build --filter=@twizrr/web...Using Turbo for filtered builds matters because shared packages must be compiled before dependent apps.
Twizrr should stay deployment-provider-neutral. The codebase should not depend on one host-specific configuration file or one provider-specific runtime path.
Deploy apps/backend as a Node.js 20+ service that can run the NestJS API and
the BullMQ processors required by the app.
Recommended generic backend lifecycle:
pnpm install --frozen-lockfile
pnpm exec turbo run build --filter=@twizrr/backend...
cd apps/backend
pnpm exec prisma migrate deploy --schema=prisma/schema.prisma
pnpm run start:prodBackend host requirements:
- Runs Node.js 20+.
- Provides persistent process execution for the API.
- Provides environment variables securely.
- Connects to managed PostgreSQL and managed Redis.
- Exposes
/healthfor readiness checks. - Does not assume Redis is available at
localhostin deployed environments.
If an HTTP serverless platform is used for the API, BullMQ workers still need a separate long-running worker process. Background queues should not rely on a short-lived serverless request lifecycle.
Deploy apps/web as a Next.js 14 app.
Recommended generic web lifecycle:
pnpm install --frozen-lockfile
pnpm exec turbo run build --filter=@twizrr/web...The same apps/web app can serve both public marketing and product-app domains
by changing env values. Do not create a separate marketing repo or a separate
marketing app unless the architecture changes explicitly.
twizrr.comis the public marketing/information site.app.twizrr.comis the product app.api.twizrr.compoints to the active backend API host.
The domain names are stable product boundaries; the infrastructure provider behind each domain can change.
Before promoting a shared environment:
- Confirm required env vars are present for backend and web.
- Run Prisma migrations with
migrate deploy. - Build with Turbo so workspace dependencies compile first.
- Confirm backend
/healthis reachable. - Confirm Redis uses
redis://orrediss://. - Confirm CORS origins match the web domains for that environment.
- Confirm no
.env.local, real secrets, private prompt values, or private invite links are committed.
Common local checks:
pnpm run lint
pnpm run build
git diff --checkFor backend-specific changes, also run:
cd apps/backend
pnpm run typecheck
pnpm exec prisma validate --schema=prisma/schema.prisma
pnpm exec prisma generate --schema=prisma/schema.prismaFor web-specific changes, also run:
cd apps/web
pnpm run typecheck
pnpm run build- Money is stored in kobo, never floating-point Naira values.
- Paystack webhooks must be verified before changing payment/order state.
- Delivery fees are not store revenue.
- Product and store uploads must follow the Cloudinary folder policy.
- WhatsApp is shopper-facing only; store management belongs in the web app.
- No real secrets,
.env.localvalues, private prompt values, or private WhatsApp invite links should be committed.