Skip to Content
Technical GuideDevelopment Guide

Development Guide

Everything you need to set up and run Portal locally.

For a guided first run (clone → env → launch → verify) start with Getting Started → First Launch. This page is the developer reference for commands, structure, and common tasks.

Prerequisites

RequirementVersion
Node.js24.x or 26.x
pnpm12.6 at the repository root
GitLatest

Getting Started

1. Clone the Repository

git clone <repo-url> cd portal-frontend

2. Install Dependencies

pnpm install

3. Set Up Environment

Each tenant ships a committed .env.<tenant>; the default build uses .env. To override locally, create .env.local in packages/portal-frontend/:

# Proxy backend — the frontend never calls the Repliers API directly. # Point at a running proxy (default in the committed env files is http://localhost:8080). NEXT_PUBLIC_API_URL=http://localhost:8080 # Maps NEXT_PUBLIC_MAPBOX_KEY=pk.xxx NEXT_PUBLIC_GMAPS_KEY=xxx # Tenant (must match a configs/<tenant> folder) NEXT_PUBLIC_APP_CONFIGURATION=<tenant>

4. Run Development Server

# Default configuration pnpm frontend:dev # Specific tenant pnpm frontend:dev:<tenant>

Open http://localhost:3000 

Commands

Development

CommandDescription
pnpm frontend:devStart dev server
pnpm frontend:dev:<tenant>Dev with tenant config
pnpm frontend:buildProduction build
pnpm frontend:startStart production server

Linting & Formatting

CommandDescription
pnpm frontend:eslintCheck ESLint
pnpm frontend:eslint:fixFix ESLint issues
pnpm frontend:prettierCheck Prettier
pnpm frontend:prettier:fixFix Prettier issues
pnpm frontend:type-checkTypeScript check

Testing

CommandDescription
pnpm frontend:testRun all tests
pnpm frontend:test:ciCI mode (JSON output)
pnpm frontend:test:last-commitTests for last commit

Single Test File

cd packages/portal-frontend pnpm exec jest path/to/file.test.ts

Environment Variables

Required

VariableDescription
NEXT_PUBLIC_API_URLProxy backend URL (forwards to Repliers; never call Repliers directly)
NEXT_PUBLIC_MAPBOX_KEYMapbox API key
NEXT_PUBLIC_APP_CONFIGURATIONTenant name

Optional

NEXT_PUBLIC_GMAPS_KEY enables Google Street View / satellite previews; it is not required for the rest of the portal.

VariableDescription
NEXT_PUBLIC_GTAG_KEYGoogle Analytics / gtag id
NEXT_PUBLIC_GROWTHBOOK_*Build-time feature-flag sync (INIT, API_HOST, CLIENT_KEY) — not read at runtime
NEXT_PUBLIC_APP_DOMAINApp domain URL
DISABLE_SSG, FORCE_HTTPLocal dev toggles

Tenant-Specific Env Files

Each tenant has its own env file:

packages/portal-frontend/ ├── .env ← Default build (tenant: defaults) ├── .env.<tenant> ← One committed file per tenant └── ...

Not every tenant’s env file is committed — some are provisioned separately, so their dev:* scripts need the file added first.

Project Structure Quick Reference

What You NeedWhere to Find It
Routes (pages)src/app/
Page componentssrc/components/pages/
Shared componentssrc/components/shared/
Layout (Header/Footer)src/components/templates/
Tenant configssrc/configs/[tenant]/
API servicessrc/services/API/
Providers (state)src/providers/
Hookssrc/hooks/
Utilssrc/utils/
Feature flagssrc/features/
Translationssrc/i18n/

Common Tasks

Add a New Page

  1. Create route in src/app/:
// src/app/new-page/page.tsx import { NewPageContent } from '@pages/new-page' export default function NewPage() { return <NewPageContent /> }
  1. Create page content in src/components/pages/:
// src/components/pages/new-page/NewPageContent.tsx export const NewPageContent = () => { return <div>New Page</div> }

Add a Tenant Override

  1. Create tenant folder:
mkdir -p src/components/pages/home/_newtenant
  1. Create override component:
// src/components/pages/home/_newtenant/HomePageContent.tsx export const HomePageContent = () => { return <div>Custom Home</div> }
  1. Export from index:
// src/components/pages/home/_newtenant/index.ts export { HomePageContent } from './HomePageContent'

Add a New Config

  1. Create config file:
// src/configs/defaults/newconfig.ts export default { setting1: 'value1', setting2: 'value2' }
  1. Import via alias:
import newconfig from '@configs/newconfig'

Add a New Provider

  1. Create provider folder:
src/providers/NewProvider/ ├── NewProvider.tsx ├── NewContext.ts ├── useNew.ts ├── types.ts └── index.ts
  1. Add to app providers in src/app/_providers.tsx

Debugging

TypeScript Errors

pnpm frontend:type-check

Build Issues

# Clean and rebuild pnpm frontend:clean pnpm frontend:build

Check Generated tsconfig

The tsconfig.json is generated at build time. Check it for path resolution issues:

cat packages/portal-frontend/tsconfig.json

IDE Setup

VS Code Extensions

  • ESLint
  • Prettier
  • TypeScript
  • ES7+ React/JS snippets
{ "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true } }

Git Workflow

  1. Create feature branch from master
  2. Make changes
  3. Run linting and tests
  4. Create PR
  5. Get review
  6. Merge to master
git checkout -b feature/my-feature # ... make changes ... pnpm frontend:eslint:fix pnpm frontend:type-check pnpm frontend:test git commit -m "feat: add my feature" git push origin feature/my-feature
Last updated on