How damisoda/career-piggybank works
1. Repository shape
- This is a monorepo with two shipping applications and one planned shared package:
- apps/mobile: the main product, an Expo / React Native / TypeScript app
- apps/api: a FastAPI / Python backend focused on the tax-envelope engine
- packages/shared: placeholder for common types/constants, not yet active
2. Product boundary
- The repo is centered on a personal finance platform for gig workers.
- The core product concept is not generic banking; it is a workflow that turns income events into structured “envelopes” for tax, expenses, savings, and spendable cash.
3. Mobile app as the primary UX
- apps/mobile is the user-facing application and likely the main entry point for the experience.
- The app is organized by screens rather than heavy backend orchestration, which suggests a feature-driven UI layer:
- onboarding / intro (Intro, Connect)
- finance views (Home, Tax, Ledger, Products, Retirement, NestEgg, Piggy)
- detailed views (TxDetail, ProductDetail, VerifiedDetail)
- account/settings and lock screens
4. Mobile app internal structure
- The mobile app separates concerns into:
- src/screens: route-level UI
- src/components: reusable UI pieces
- src/store.tsx: shared state management for app data
- src/lib: domain logic and integration helpers
- src/products.ts and src/jobs.ts: product/content or workflow data
- This indicates a thin UI over local state/domain logic, not a server-rendered app.
5. On-device tax-envelope engine
- The most important domain subsystem is the tax envelope calculator.
- In the mobile app, src/lib/taxEnvelope.ts implements the computation locally so the first demo can run without backend dependency.
- This is a key architectural boundary: the same deterministic financial logic exists both on-device and in the backend, so the app can function offline or in demo mode.
6. Backend engine service
- apps/api exposes the same tax-envelope domain logic as a FastAPI service.
- The backend is organized into:
- app/api/routes: HTTP endpoints
- app/services: business logic, especially tax_envelope.py
- app/schemas: request/response models
- app/core/config.py: environment/config handling
- app/main.py: app bootstrap and router wiring
- The service appears stateless and computation-focused, not a CRUD app with a database layer.
7. API surface and responsibilities
- The backend includes:
- a health check route for service availability
- a tax-envelope route group under /v1/tax-envelope/* for deterministic calculations
- The README explicitly says this engine:
- splits a gig-worker income deposit into tax / expenses / available cash / immediate usable cash
- estimates the May comprehensive income tax settlement reserve
- exposes assumptions such as expense rate, tax brackets, and buffer rate in the output
8. Data flow between mobile and API
- The primary flow is:
1. user enters or views an income event in the mobile app
2. the mobile app can compute envelope allocation locally
3. the backend can compute the same result via HTTP for validation or API-driven usage
- This creates a dual-implementation contract: the mobile and backend engines must stay behaviorally aligned.
9. Testing and correctness
- The backend has explicit tests in apps/api/tests/test_tax_envelope.py, which implies the tax logic is treated as a deterministic calculation engine with expected outputs.
- Because the calculator is mirrored in both mobile and API, correctness is important not just for one implementation but for cross-platform consistency.
10. Tooling and deployment shape
- Root Makefile provides simple orchestration for local development:
- make api
- make api-test
- make mobile
- CI is defined in .github/workflows/ci.yml, showing the repo is meant to be validated automatically across the two app surfaces.
11. Infrastructure and external boundaries
- The repo does not show a database, queue, or third-party service integration as a core runtime dependency.
- The README mentions future or external finance integrations such as MyData, Hometax, and OAuth keys, but those are treated as secrets/configuration boundaries rather than current architecture centerpieces.
12. Overall architecture summary
- The system is best understood as:
- a mobile-first financial experience
- backed by a deterministic finance rules engine
- with the same calculation logic available locally and via FastAPI
- and with a future shared package intended to reduce drift between platforms
- For an architecture diagram, the key boxes are: Mobile UI, Local domain logic, API calculation service, Config/Secrets, and CI/Tests.
Main entry points: screens Screens · lib Local domain · routes HTTP routes · main.py API bootstrap
Components 22
Mobile app
Expo/React Native client and on-device domain logic.
- Mobile UI · User-facing finance experience and navigation entrypoint.
apps/mobile/app/index.tsx - App layout · Top-level mobile route composition and screen wiring.
apps/mobile/app/_layout.tsx - Screens · Primary user flows such as onboarding, home, ledger, tax, products, and settings.
apps/mobile/src/screens - UI components · Shared visual building blocks used across mobile screens.
apps/mobile/src/components - App store · Shared client state and data coordination for the mobile app.
apps/mobile/src/store.tsx - Local domain · Client-side business helpers and integration utilities.
apps/mobile/src/lib - Envelope calc · On-device tax-envelope calculation so the demo can run without backend dependency.
apps/mobile/src/lib/taxEnvelope.ts - API client · Mobile-side service wrapper for backend calls.
apps/mobile/src/lib/api.ts - Products data · Product and workflow content used by the mobile experience.
apps/mobile/src/products.ts - Jobs data · Gig-worker job and income-event related data definitions.
apps/mobile/src/jobs.ts
API service
FastAPI backend for deterministic tax-envelope calculations.
- API bootstrap · Application startup and router wiring.
apps/api/app/main.py - HTTP routes · Endpoint group for health and tax-envelope operations.
apps/api/app/api/routes - Tax route · Versioned tax-envelope HTTP entrypoints.
apps/api/app/api/routes/tax_envelope.py - Health check · Service availability probe.
apps/api/app/api/routes/health.py - Services · Server-side computation layer.
apps/api/app/services - Tax service · Backend implementation of the gig-worker envelope split and settlement reserve logic.
apps/api/app/services/tax_envelope.py - Schemas · Request and response models for the API.
apps/api/app/schemas - Config · Backend settings and secret-bound configuration handling.
apps/api/app/core/config.py - Tax tests · Deterministic checks for the tax-envelope engine.
apps/api/tests/test_tax_envelope.py
Repo tooling
Root orchestration, CI, and shared package placeholder.
- Makefile · Local commands for running mobile and API development tasks.
Makefile - CI workflow · Repository validation workflow for the two app surfaces.
.github/workflows/ci.yml - Shared pkg · Placeholder for cross-platform shared types and constants.
packages/shared/README.md
Connections 23
- Mobile UI → App layout: uses · The app entry is composed by the routing shell.
- App layout → Screens: renders · Routes resolve into feature screens.
- Screens → UI components: composes · Screens reuse shared UI pieces.
- Screens → App store: reads/writes · Screens coordinate state through the shared store.
- App store → Local domain: calls · State layer depends on domain and integration helpers.
- Local domain → Envelope calc: includes · Local deterministic tax-envelope logic lives in the client domain layer.
- Local domain → API client: uses · Client domain can call backend services when needed.
- Screens → Products data: uses · Product and workflow screens use shared content data.
- Screens → Jobs data: uses · Income-event and gig workflow data feed the screens.
- API bootstrap → HTTP routes: mounts · Bootstrap wires HTTP routes into the application.
- HTTP routes → Health check: exposes · Availability probe endpoint.
- HTTP routes → Tax route: exposes · Versioned envelope calculation endpoints.
- Tax route → Services: delegates · Route handlers pass computation to the service layer.
- Services → Tax service: implements · Core backend tax-envelope logic.
- Tax service → Schemas: returns · Service inputs and outputs are modeled with schemas.
- API bootstrap → Config: loads · Startup depends on environment configuration.
- Tax tests → Tax service: verifies · Tests assert deterministic engine behavior.
- Makefile → Mobile UI: runs · Root dev tasks can start the mobile app.
- Makefile → API bootstrap: runs · Root dev tasks can start the API service.
- CI workflow → Tax tests: checks · CI validates backend behavior.
- CI workflow → Mobile UI: checks · CI validates the mobile application surface.
- Shared pkg → Local domain: intended for · Planned shared types/constants should reduce client-server drift.
- Shared pkg → Schemas: intended for · Shared contracts are a future fit for API models.