Skip to main content

Development Guide

Prerequisites

Ensure you have the following installed:

  • Node.js (v18+)
  • PNPM (v9+)
  • Docker & Docker Compose
  • Supabase CLI
  • Python (v3.11+) & Poetry
  • Terraform (for infrastructure)
  • Make

First Time Setup

  1. Clone the repository:

    git clone <repo-url>
    cd faiht2-ro
  2. Install dependencies:

    pnpm install
  3. Install Pre-commit Hooks: This monorepo uses pre-commit to ensure code quality (formatting, linting) for Python, JS, and Terraform.

    make setup-hooks
  4. Environment Configuration:

    • Copy .env.example to .env in the root directory.
    • Fill in your secrets defined in the .env file.
    • Run the sync command to distribute configurations:
    make sync-envs

    Tip: You can use make env-sandbox or make env-prod to quickly overwrite the web config, but make sync-envs is the recommended way to manage everything centrally.

Running Locally

1. Start Supabase

Start the local Supabase instance/emulator.

cd services/supabase
npx supabase start

2. Start Services

Run the frontend and API gateway in development mode.

pnpm dev

This will start:

  • Web: http://localhost:3000
  • API: http://localhost:8787

3. Run Fetcher Worker

To run the python fetcher locally:

cd services/fetcher
poetry install
poetry run python src/main.py

Database Management

  • Migrations:

    cd services/supabase
    npx supabase migration new <migration_name>
    npx supabase db reset
  • Type Generation: Run the sync script to generate types for both TypeScript and Python.

    ./scripts/generate-types.sh