Skip to content

Self-hosting

import { Steps, Aside } from ‘@astrojs/starlight/components’;

Paisa is designed to self-host cheaply. The API runs on Cloudflare Workers (free tier handles personal use easily). The web app is a static Vite build — host it anywhere.

  • A Cloudflare account (free)
  • A PostgreSQL database — Neon free tier works well
  • Bun installed locally
  1. Clone the repo

    Terminal window
    git clone https://github.com/nimit9/paisa
    cd paisa
    bun install
  2. Configure the API

    Copy and fill in the environment variables:

    Terminal window
    cp apps/api/.env.example apps/api/.env

    Required variables:

    DATABASE_URL=postgresql://user:pass@host/db
    BETTER_AUTH_SECRET=your-random-32-char-secret
    WEB_URL=https://your-web-app-url.com
    GOOGLE_CLIENT_ID=...
    GOOGLE_CLIENT_SECRET=...
  3. Run migrations

    Terminal window
    bun run db:migrate
  4. Deploy the API to Cloudflare Workers

    Terminal window
    cd apps/api
    bunx wrangler deploy

    Set secrets in Cloudflare:

    Terminal window
    bunx wrangler secret put DATABASE_URL
    bunx wrangler secret put BETTER_AUTH_SECRET
    # ... etc
  5. Build and deploy the web app

    Terminal window
    cd apps/web
    VITE_API_URL=https://your-worker.workers.dev bun run build

    Deploy the dist/ folder to Cloudflare Pages, Vercel, or any static host.

  6. Whitelist your email

    Paisa uses Google OAuth with an email whitelist. Add your email in apps/api/src/auth.ts or configure the ALLOWED_EMAILS env var.

The API includes Cloudflare cron triggers:

ScheduleJob
0 1 * * *Zerodha portfolio sync
0 0 1 * *Monthly report generation

These run automatically once deployed to Cloudflare Workers.