Production-ready full-stack Next.js app (App Router, JavaScript) with:
- Auth0 authentication
- MongoDB persistence
- Gemini intake extraction + Gemini financial analysis
- Optional Backboard-powered chatbot memory
- Dashboard health scoring + schedule-aware projection graph pipeline
- Next.js (App Router)
- JavaScript only
- Tailwind CSS
- Auth0 (
@auth0/nextjs-auth0) - MongoDB (
mongodb) - Gemini (
@google/generative-ai) - Backboard (
backboard-sdk) for optional persistent chat context memory - QuickChart Graph API (external chart rendering)
/is public marketing.- After login:
- Existing finance document ->
/dashboard - No finance document ->
/onboarding
- Existing finance document ->
- Onboarding is first-time collection only.
/updatesupports manual CRUD + Gemini intake with Review & Confirm.- Finance writes trigger Gemini re-analysis automatically.
- Dashboard includes a finance advice chatbot grounded in a fresh MongoDB read per request, with optional Backboard memory.
- Endpoint:
POST /api/gemini/intake - Parses free text into structured expenses, debts, and income.
- Parses user payoff intent into
paymentScheduleMonthsper debt. - Parses debt payment cadence into
paymentFrequencyper debt (weekly,biweekly,monthly,quarterly,annually,custom). - Requires
customPaymentFrequencyDescriptionwhen cadence is custom. - Supports multiple debts in one message.
- Returns warnings for ambiguous fields.
- Never auto-saves data.
- Endpoint:
POST /api/gemini/analyze - Analyzes full current finance dataset (all debts included).
- Returns:
- Insights
- Risk flags
- Projection parameters
- Dynamic financial-health factor weights
- Score explanation + suggestions
- User selects strategy (
Aggressive,Balanced,Conservative,Custom) - Backend runs Gemini analysis against latest MongoDB finance data
- Gemini returns dynamic strategy profiles + default recommendation (data-driven)
- Backend derives deterministic projection dataset from recommended parameters
while applying each debt's
paymentScheduleMonthsandpaymentFrequency - Backend calls QuickChart API (
https://quickchart.io/chart/create) - Frontend renders returned graph image URL + interactive chart
UI requirement implemented:
- No graph shown before analysis+graph API complete.
- While waiting, typewriter text shows exactly:
Generating your graph, just a moment
Pages:
//onboarding/dashboard/prediction/update
API:
GET /api/financePOST /api/financePUT /api/financeDELETE /api/finance/debt?id=...POST /api/chatPOST /api/gemini/intakePOST /api/gemini/analyzePOST /api/prediction/graph
Auth0 SDK routes (mounted by middleware):
/auth/login/auth/logout/auth/callback/auth/profile/auth/access-token
auth0Sub(unique)emailcreatedAtupdatedAt
auth0Sub(unique)expensesrentMortgagegasotherExpenses[](id,name,amount)
debts[]id,type,lenderName,balance,interestRate,minPayment,paymentScheduleMonths(required),paymentFrequency(required),customPaymentFrequencyDescription(required whenpaymentFrequency=custom),paymentDueDate,notes,createdAt,updatedAt
incomemonthlyIncome
metadataonboardingCompletedcreatedAtupdatedAt
auth0Sub(unique)insightsriskFlags[]recommendedParametersstrategyProfiles(dynamic, per user)defaultStrategyhealthScore(score, factor weights, contributors, explanation, suggestions)financeUpdatedAtupdatedAt
npm installcp .env.example .env.localFill:
MONGODB_URIMONGODB_DBAPP_BASE_URLAUTH0_DOMAINAUTH0_CLIENT_IDAUTH0_CLIENT_SECRETAUTH0_SECRETGEMINI_API_KEYBACKBOARD_API_KEY(optional; enables persistent chatbot context memory)BACKBOARD_LLM_PROVIDERandBACKBOARD_MODEL_NAME(optional overrides; must be supported by your Backboard account)QUICKCHART_API_KEY(optional; only if required by your QuickChart plan)
- Local URI:
mongodb://localhost:27017 - Database:
finance_app
Use a Regular Web Application with local origin http://localhost:3000.
Required Auth0 settings:
- Allowed Callback URLs:
http://localhost:3000/auth/callback - Allowed Logout URLs:
http://localhost:3000/ - Allowed Web Origins:
http://localhost:3000 - Token Endpoint Auth Method:
client_secret_post
Given tenant/client setup:
AUTH0_DOMAIN=dev-jqz7dk5ci1n1f4ei.us.auth0.comAUTH0_CLIENT_ID=cUsZplyKLJmlvrOYoBviY9Lw4vgJxeMz
Generate secret:
openssl rand -hex 32npm run devOpen http://localhost:3000.
- Sign up/login from
/. - First-time user goes to
/onboarding. - Use Gemini intake, review extracted data, confirm save.
- Redirect to
/dashboardwith stats + health score + Gemini explanation. - Go to
/updateand test:- Manual edits
- Gemini intake with multiple debts in one message
- Include planned payoff durations (e.g. 18 months, 2 years)
- Include payment cadence details (e.g. monthly, biweekly, custom)
- Review & Confirm -> Save
- Return to
/dashboardand confirm updated insights/score. - Go to
/prediction, pick strategy, generate graph and insights.
- Gemini calls use defensive JSON parsing + retries.
- Gemini analyze/intake log sanitized input metadata.
- Finance and analysis routes are auth-protected and scoped by
auth0Sub. - Analysis refresh runs on create/update/delete and stale dashboard reads.
- If
BACKBOARD_API_KEYis set, chatbot context is persisted in Backboard per user (auth0Sub-> assistant/thread mapping in MongoDB). - If Backboard is unavailable or not configured, chatbot generation falls back to direct Gemini responses.