Local Environment Setup

This page explains how to set up the local development environment

Prerequisites

Ensure the following tools are installed on your system:

  1. Node.js (version 20.11.0)

    • If you have nvm configured, the correct Node.js version will automatically be used when you navigate to the ui or api directories (based on .nvmrc files).

    • Otherwise, install Node.js 20.11.0 from Node.js downloads.

  2. Yarn Install Yarn globally:

    npm install -g yarn
  3. PostgreSQL

Setup Steps

  1. Install Dependencies

    • Navigate to the api directory and run:

      yarn install
    • Navigate to the ui directory and run:

      yarn install

  2. Set Environment Variables

    • For the api: Create a .env file and set:

      # Email
      EMAIL_SENDER=             # Sender email (AWS SES or SendGrid)
      EMAIL_SERVICE=            # Email service ('aws' or 'sendGrid')
      
      # OAuth
      FACEBOOK_APP_ID=          # Facebook App ID
      FACEBOOK_APP_SECRET=      # Facebook App Secret
      GOOGLE_CLIENT_ID=         # Google Client ID
      GOOGLE_CLIENT_SECRET=     # Google Client Secret
      
      # Password Reset
      RESTORE_PASSWORD_SECRET=  # Secret for password reset tokens
      
      # Stripe
      STRIPE_API_KEY=           # Stripe API Key
      STRIPE_WEBHOOK_SECRET=    # Stripe Webhook Secret
      
      # AWS S3 / MinIO
      AWS_S3_ACCESS_KEY=        # AWS S3 Access Key
      AWS_S3_SECRET_ACCESS_KEY= # AWS S3 Secret Key
      AWS_S3_REGION=            # AWS S3 Region
      AWS_S3_HOST=              # AWS S3 Custom Host (optional)
      
      # Two-Factor Authentication
      TWO_FACTOR_AUTH_APP_NAME= # App name for 2FA (e.g., Google Authenticator)
      
      # Environment
      NODE_ENVIRONMENT=         # Node environment ('development', 'production')
      
      # CAPTCHA
      CAPTCHA_SECRET_TOKEN=     # CAPTCHA Secret Token

    • For the ui: Create a .env.development file and set:

      # Base URLs
      REACT_APP_BASE_URL=http://localhost:3000         # Frontend base URL
      REACT_APP_API_BASE_URL=http://localhost:8000     # Backend API base URL
      
      # OAuth Config
      REACT_APP_GOOGLE_CLIENT_ID=                      # Google Client ID
      REACT_APP_FACEBOOK_CLIENT_ID=                    # Facebook Client ID
      
      # Stripe Config
      REACT_APP_STRIPE_PUBLIC_KEY=                     # Stripe public key
      
      # CAPTCHA
      REACT_APP_CAPTCHA_SECRET=                        # Google CAPTCHA secret

This is not the full list of environment variables. For the complete list of supported environment variables, please refer to the constants file where all available envs are defined.

You can find the constants files in:

  • UI: ui/src/common/constants/constants.js

  • API: api/src/constants.ts

  1. Run the Applications

    • Start the backend server:

      cd api
      yarn start:dev
    • Start the frontend server:

      cd ui
      yarn start

Last updated