Skip to main content

Local Setup

Prerequisites

  • Node.js LTS
  • npm (or yarn/pnpm)
  • PostgreSQL (optional for local dev if using a local DB)

Environment Variables

Create environment files for frontend and backend.

Frontend .env.local (example):

NEXT_PUBLIC_API_URL=http://localhost:8080
# Firebase client config as needed (if applicable)

Backend .env (example):

NODE_ENV=development
PORT=8080
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=osten_ai_db
INSTANCE_CONNECTION_NAME=local
JWT_SECRET=local-dev-jwt

# Google OAuth/Ads
GOOGLE_OAUTH_CLIENT_ID=...
GOOGLE_OAUTH_CLIENT_SECRET=...
GOOGLE_OAUTH_REDIRECT_URI=http://localhost:8080/api/google-ads/auth/callback
GOOGLE_ADS_CLIENT_ID=...
GOOGLE_ADS_CLIENT_SECRET=...
GOOGLE_ADS_DEVELOPER_TOKEN=...

# GA4
GOOGLE_ANALYTICS_REDIRECT_URI=http://localhost:3000/dashboard/google-analytics/callback

# Vertex AI (optional)
VERTEX_AI_PROJECT_ID=...
VERTEX_AI_LOCATION=...
VERTEX_AI_MODEL_ID=...

Install & Run

  • Backend:
    • In backend/: npm install
    • Start dev: npm run dev
  • Frontend:
    • In frontend/: npm install
    • Start dev: npm run dev

Ensure the backend is reachable at NEXT_PUBLIC_API_URL (frontend will call this URL).

Auth & Org Headers

  • Frontend apiClient adds Authorization and x-organization-id automatically when using Firebase user and selected organization from localStorage.
  • Prefer apiClient over raw fetch to preserve headers.