Technical guide
Choose a starting point. Check that the hosted API responds, run the sample household from a clean clone, or follow a record through FinBuddy’s browser, API, and storage.
Check the hosted API without an account
The health route lets you check the base URL before generating a token. Open it in a phone or desktop browser, or run the command below in a terminal.
curl --fail-with-body https://finbuddy-2025.web.app/api/v1/healthExpected HTTP 200 with {"status":"ok"}. This checks whether the API responds. To verify access to your own records, run the authenticated profile request below.
Run the demo from a clean clone
Install Git, Node.js 24 and Python 3.12. Check that node --version and python --version work before installing FinBuddy. Type these commands in a terminal, one line at a time.
- Open the local URL Vite prints. Choose Try the demo. Home shows Sample household data.
- From the demo’s footer, choose Help. The Help Center should open on the same local origin. Its direct route is /docs/index.html.
- Keep the Vite terminal open while testing. Press Ctrl+C to stop the dev server.
git clone https://github.com/theharithsa/finbuddy.git
cd finbuddy
npm ci
npm run devUse the Firebase emulators for signed-in testing. The public homepage and sample household work without an account.
Trace a record from the screen to storage
The React and TypeScript workspace runs in the browser. Firebase Authentication supplies the signed-in identity. Firestore rules and Storage rules govern browser access, and the REST API checks token scope and record ownership before serving account data.
| When you… | The code and data path |
|---|---|
| Enter an expense in the app | src/features/expenses/ → Firebase client → account records in Firestore. |
| Attach a receipt in the app | Expense editor → Cloud Storage for the file → expense metadata in Firestore. |
| Read an expense through the API | Firebase Hosting /api/v1 → Firebase Functions in api/ → Firestore. The API checks the personal token and account scope. |
| Try the public demo | src/features/workspace/DemoWorkspace.tsx → fictional data. No account is needed. |
Find the right Firebase environment
FinBuddy has one repository and one Firebase project: finbuddy-2025. The main branch releases production; preprod rehearses the same candidate on its own Hosting site. Firebase Auth is shared, so existing UIDs and Google profile photos stay the same.
- Open the matching site. Pre-production shows a synthetic-data banner and requires an approved test account; production keeps your existing sign-in.
- In Firebase, select finbuddy-2025. Hosting lists the two FinBuddy sites. Firestore stores each environment under its named root, followed by data/users/{uid}.
- Keep API tokens and test records in their own environment. A pre-production test account is denied production and FinVision data.
| Resource | Production | Pre-production |
|---|---|---|
| Branch | main | preprod |
| Hosting target | prod | preprod |
| Site | finbuddy-2025.web.app | finbuddy-2025-preprod.web.app |
| Firestore root | prod/data | preprod/data |
| Receipt prefix | prod/receipts/{uid}/ | preprod/receipts/{uid}/ |
| API entrypoint | finbuddyApi | finbuddyApiPreprod |
The shared project also hosts the existing FinVision site and its Users/SyncCodes collections. Those resources are preserved. Admin SDK IAM is project-wide; collection rules and fixed backend namespaces provide application boundaries.
Read your own account profile
Open Swagger in a browser. A saved token can be used from a terminal if you prefer. Start with Read only for this request.
- Sign in and open More → Settings → Developer Options. Enter a Token name, choose Read only under Access, and choose Generate token. Complete recent sign-in if requested.
- Choose Copy token. Open Swagger and choose Authorize. Paste the token value itself. Swagger adds the Bearer header.
- Find GET /profile, choose Try it out, then Execute. A successful response is HTTP 200 with uid, name, and email fields. Name or email can be null.
read -rs -p "FinBuddy read-only token: " FINBUDDY_TOKEN
printf "\n"
curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer $FINBUDDY_TOKEN" \
https://finbuddy-2025.web.app/api/v1/profile
unset FINBUDDY_TOKENThe terminal example uses Bash or Git Bash on Windows. The response identifies the token owner. Use synthetic credentials when sharing screenshots or output.
Read a private plan through the API
- Open Settings → Developer Options, choose Read only, select Include private FinVision goals and SIPs, and generate a token. Existing tokens need an explicit replacement for planner access.
- Open the Swagger reference. Authorize with your own token and run GET /finvision/summary for recorded progress, forecast balances and deposit maturity estimates. The response uses integer paise. An empty goals array means this account has no adopted goals.
- For a write, read GET /finvision first. Use its revision as the If-Match header. A 409 means another edit won. Reload the plan and review the change before retrying. Creating and adopting a plan requires a signed-in owner in the web app.
Handle money and retries correctly
| API operation | Rule to implement |
|---|---|
| Read expenses and budgets | Amounts are decimal INR with up to two fractional digits. |
| Read income, bills, holdings or monthly summary | Amounts use integer paise. ₹450 is 45000 paise. |
| Read the monthly API summary | The remaining amount is income minus recorded expenses. Home’s Left after bills also subtracts unpaid bills. |
| Read a list | Use limit and follow the opaque nextCursor until the response omits it. |
| Create a record | Send an Idempotency-Key and reuse it for retries of the same body. A conflicting body returns 409. Bill payments deduplicate by occurrence. |
Run web and API tests with synthetic accounts
Install Java 21 and Chromium for the web suite. Run the web commands below from the root on Node.js 24.
npx --no-install playwright install chromium
npx --yes firebase-tools@15.37.0 emulators:exec --only auth,firestore,storage --project demo-finbuddy "npm run test:browser"Both suites use demo-finbuddy. Run the web and API emulator suites separately so that the shared emulator ports are free.
Run the authenticated API integration suite
Switch to Node.js 22 for the API runtime and keep Java 21 available. Run these commands from the root in a fresh terminal after the web suite stops.
npm --prefix api ci
npm --prefix api test
npx --yes firebase-tools@15.37.0 emulators:exec --config firebase.api.json --only auth,firestore,functions,storage --project demo-finbuddy "npm --prefix api run test:emulator"The API suite creates synthetic accounts, makes scoped requests, and checks token expiry, owner boundaries and idempotent writes.
Troubleshoot setup and API access
| Symptom | Check |
|---|---|
| The dev server cannot build the Help Center | Run python --version from the same shell. Ensure Python is on PATH, then run npm run dev again. |
| The local Help URL opens sign-in | Use /docs/index.html on the Local URL Vite printed. |
| An emulator port is already in use | Stop the other emulator run, then start this suite again. |
| Health works but /profile returns 401 | Check the base URL, token revocation or expiry, and the Authorization: Bearer header. In Swagger, authorize again in the current tab. |
| A write returns 403 | Check for insufficient_access. A read-only token cannot write. |
| A record returns 404 | Check the record ID and confirm it is available to the token’s account. |
| A retried create returns 409 | Check whether the same Idempotency-Key was used with a different request body. |
Know what each deployment and signal proves
| Boundary | What a successful check proves |
|---|---|
| Firebase Hosting | The tested web and Help Center artifact is live. It does not deploy Firestore rules, Storage rules or the REST API function. |
| REST API | The finbuddyApi function is deployed separately. The Hosting smoke check verifies health, OpenAPI and authentication through the public route. |
| Browser monitoring | Opt-in Dynatrace RUM records supported browser operations. It does not stand in for a durable finance record. |
| API traces and workflow telemetry | API OpenTelemetry can report route, method and status when configured. GitHub Actions records CI results, and Thoth can export workflow timing to Dynatrace. |
Preview a handbook change
The Pages site and Firebase website share a single generator. Change the homepage in site/index.html, handbook and policy content in docs/public-guides.json, and shared navigation, old addresses and error views in scripts/public_site.py. Run python scripts/build_public_docs.py to check both builds and their internal links.
python scripts/build_public_docs.py --output dist/public-docs
python -m http.server 8080 --directory dist/public-docsPublic website and workspace entry points
The public homepage, Help Center and error documents are static HTML built from the site directory and docs/public-guides.json. GitHub Pages and Firebase use the same content, navigation and styles. Firebase keeps sign-in and demo links on the current environment.
The React workspace uses app.html at /signin, /app and /finvision. AccountApp restores the Firebase session. DemoWorkspace loads fictional household data independently. The workspace navigation hook keeps Home under /app and goals under /finvision. Old homepage demo, shortcut and email sign-in URLs are forwarded to their matching entry point.