This guide covers local development setup, database configuration, and production deployment to Vercel with an optional Azure Functions API proxy.
Local development
1. Clone and install
git clone https://github.com/your-org/urnammu.git
cd urnammu
npm install 2. Start PostgreSQL
On macOS with Homebrew:
brew install postgresql@16
brew services start postgresql@16
createdb urnammu 3. Configure environment
cp .env.example .env Set at minimum:
DATABASE_URL=postgresql://localhost:5432/urnammu
NEXTAUTH_SECRET=your-random-secret
NEXTAUTH_URL=http://localhost:3000
ENABLE_DEV_LOGIN=true 4. Set up the database
npx prisma migrate dev # Apply all migrations
npm run db:seed # Load demo data 5. Start the dev server
npm run dev
Open http://localhost:3000 and sign in with the dev login
using admin@example.com.
Production deployment (Vercel)
1. Connect your repo
Link your GitHub repository to Vercel. The default build settings work out of the box.
The ai-proxy/ directory is excluded from the Next.js build via tsconfig.json.
2. Set environment variables
In Vercel project settings, configure:
DATABASE_URL=postgresql://... # Vercel Postgres or external
NEXTAUTH_SECRET=your-production-secret
NEXTAUTH_URL=https://your-app.vercel.app
GOOGLE_CLIENT_ID=... # Google OAuth
GOOGLE_CLIENT_SECRET=...
ENABLE_DEV_LOGIN=false # Must be false in production 3. Deploy
vercel --prod --yes API proxy (Azure Functions)
The API proxy intercepts Claude and OpenAI API calls, logs usage data to PostgreSQL, and supports streaming (SSE) for long-running requests.
Setup
cd ai-proxy
npm install
cp .env.example .env # Configure DATABASE_URL and PROXY_SECRET Deploy to Azure
func azure functionapp publish your-function-app --build remote
The proxy has a 10-minute function timeout configured for long-running streaming requests.
A Vercel-based fallback proxy also exists at /api/proxy/.
Database management
# Create a new migration after schema changes
npx prisma migrate dev --name describe-your-change
# Regenerate the Prisma client
npx prisma generate
# Reset database (destructive!)
npm run db:reset