Skip to main content

Frontend Setup

This guide walks you through setting up the Maybern React frontend for local development.
All commands in this guide should be run from within the frontend/ directory unless otherwise specified.

Set Up Node.js with nvm

1

Install nvm

Install Node Version Manager via Homebrew:
brew install nvm
2

Add nvm to shell configuration

Add nvm to your .zshrc:
echo -e '\nexport NVM_DIR="$HOME/.nvm"\n[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"' >> ~/.zshrc
source ~/.zshrc
3

Install the project Node version

Install the Node.js version specified in .nvmrc:
nvm install
4

Activate the Node version

Use the project’s Node version:
nvm use

Set Up pnpm Package Manager

Install pnpm globally:
npm install --global pnpm@9.6.0
Then install project dependencies:
pnpm install

Set Up Environment Variables with direnv

1

Install direnv

brew install direnv
2

Add direnv hook to shell

echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
3

Reload shell configuration

Open a new shell or reload your configuration:
source ~/.zshrc
4

Allow direnv for the project

Allow direnv to load the .envrc file:
direnv allow

Generate API Clients

Generate the TypeScript API clients from the backend OpenAPI specification:
pnpm run gen
This uses Orval to generate type-safe API clients. The configuration is in orval.config.ts.
Run this command whenever the backend API changes to keep the frontend clients in sync.

Run the Frontend (Basic)

Start the development server:
pnpm start
The app will be available at http://localhost:3000. For full functionality including customer-specific subdomains, set up HTTPS locally.
1

Set up local DNS resolution

Install and configure dnsmasq to resolve .test domains locally:
brew install dnsmasq
echo 'address=/.test/::1' > $(brew --prefix)/etc/dnsmasq.conf
sudo brew services start dnsmasq

sudo mkdir -p /etc/resolver
sudo bash -c 'echo "nameserver ::1" > /etc/resolver/test'
2

Set up local certificate authority

Install mkcert and create a local CA for HTTPS:
brew install nss mkcert
mkcert -install
3

Start with subdomains

Start the development server with HTTPS and subdomain support:
pnpm start:subdomains
4

Open the app

Navigate to https://app.maybern.test:3000 in your browser.
You should see the Maybern login page. If you see a certificate warning, you may need to trust the mkcert CA in your browser.

Test a Production Build

To verify the production build works correctly:
pnpm run build:preview
pnpm run start:preview

IDE Setup (VS Code / Cursor)

Install the recommended extensions:
  • ESLint: JavaScript/TypeScript linting
  • Prettier: Code formatting
Add to your settings.json:
{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "json"
  ]
}

Next Steps