How rafaelrebeca/portfolio works
Portfolio Manager is a browser-based portfolio dashboard backed by a Cloudflare Pages API and D1. The user opens the SPA, authenticates or enters a local guest demo, and manages financial data; the frontend requests persisted data through the API, which applies access checks and reads or writes D1. The frontend also computes and presents dashboard metrics, history, growth, goals, and projections. README documents broad product capabilities, but the sampled source is partial, so some feature-level API wiring is not shown. PWA caching is a separate supporting path.
Main entry points: portfolio.js Application client · index.html SPA shell · [[path]].js API request handler · sw.js Service worker
Components 21
Portfolio interface
- SPA shell
index.html - Application client
js/portfolio.js
Portfolio features
- Dashboard analytics
js/portfolio.js - Holdings and assets
js/portfolio.js - Accounts and providers
js/portfolio.js - Loan simulator
js/portfolio.js - Financial goals
js/portfolio.js - Dividend tracking
js/portfolio.js - Growth calendar
js/portfolio.js - Snapshots and history
js/portfolio.js - Portfolio projections
js/portfolio.js
API and persistence
- Authentication and access
functions/api/[[path]].js - API request handler
functions/api/[[path]].js - Portfolio data API
functions/api/[[path]].js - Market data integration
functions/api/[[path]].js - D1 portfolio database
schema.sql
Offline app
- Service worker
sw.js - Browser cache
Other components
- Portfolio user
- Market data services
- Chart.js CDN
Connections 23
- Portfolio user → SPA shell: opens
- SPA shell → Application client: loads
- Application client → API request handler: requests data
- API request handler → Authentication and access: checks access
- API request handler → Portfolio data API: dispatches
- Authentication and access → D1 portfolio database: reads sessions
- Portfolio data API → D1 portfolio database: reads and writes
- Market data integration → D1 portfolio database: reads and updates
- Application client → Market data integration: requests prices
- Market data integration → Market data services: fetches prices
- Application client → Dashboard analytics: renders
- Application client → Holdings and assets: renders
- Application client → Accounts and providers: renders
- Application client → Loan simulator: calculates
- Application client → Financial goals: tracks
- Application client → Dividend tracking: tracks
- Application client → Growth calendar: renders
- Application client → Snapshots and history: replays
- Application client → Portfolio projections: projects
- Service worker → Browser cache: caches shell and GETs
- Service worker → SPA shell: serves cached shell
- SPA shell → Service worker: registers
- Application client → Chart.js CDN: uses charts