Streakz now runs as a single Next.js application with App Router API routes, MongoDB via Mongoose, JWT auth, and Vercel-friendly serverless handlers.
Streakz/
frontend/ # unified Next.js app
backend/ # legacy Express source kept only as migration reference
- Install dependencies:
cd frontend
npm install- Create
frontend/.env.local:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
GROQ_API_KEY=your_groq_api_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
NEXT_PUBLIC_APP_URL=http://localhost:3000Optional:
GOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/google/callback
GROQ_MODEL=llama-3.1-8b-instant- Start the app:
npm run dev- Open
http://localhost:3000.
- Import the repo into Vercel.
- Set the project root to
frontend. - Add these environment variables in Vercel:
MONGO_URI
JWT_SECRET
GROQ_API_KEY
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
NEXT_PUBLIC_APP_URL- Set
NEXT_PUBLIC_APP_URLto your production URL, for examplehttps://your-app.vercel.app. - If your Google OAuth app requires an explicit callback URL env, also set:
GOOGLE_CALLBACK_URL=https://your-app.vercel.app/api/auth/google/callback- Deploy.
/api/auth/*/api/habits/api/completions/api/journal/api/goals/api/todos/api/ai