How velopert/velofolio works
Project Type & Purpose
• This is a full-stack monorepo consisting of:
– A React-based Web client (“webapp”)
– A Fastify + TypeORM server (“server”)
– A data sync bot for ingesting historical prices
– A MariaDB database (containerized via Docker)
Top-Level Components
A. Client (Webapp)
• Hosted on Vercel
• React, TypeScript, Recoil, React Query, Emotion, ECharts
• Communicates over HTTPS to backend API
B. API Server
• Fastify framework with plugin architecture (JWT, search, user, close)
• TypeORM entities map to MariaDB tables
• Chart generation module (Chart.js) produces backtest images
• AWS S3 (or similar) for asset logo uploads
• Google OAuth integration (via Fastify plugin + “getGoogleProfile”)
• Fuse.js–powered search engine
C. Data Store
• MariaDB (deployed via Docker Compose in dev, AWS RDS in prod)
D. Sync Bot
• Node script (Syncbot) downloads tickers & historical data
• Writes data into MariaDB & asset/logo storage
E. External Services
• FinancialModelingPrep API (historical prices, sector weightings, profiles)
• Google OAuth endpoints
• AWS S3 (for uploaded assets)
• Vercel (for hosting Webapp)
• AWS EC2 / ECS / Lambda (for hosting API)
Interactions & Data Flows
1. End user → Webapp
• User interacts via browser → HTTPS
2. Webapp ↔ API Server
• REST endpoints under /api/*
• Request schemas validated (JSON Schema files under src/schema)
• Authenticated calls carry JWT tokens (plugin on server + client stores token)
3. API Server → MariaDB
• CRUD via TypeORM entities (e.g., User, Asset, Backtest)
4. API Server → External Finance API
• Historical prices, stock profiles, sector weightings
5. API Server → AWS S3
• Asset/logo uploads via lib/aws/upload.ts
6. Sync Bot → API Server libraries & Database
• Runs yarn syncbot, ingests CSV tickers, stores data
7. OAuth Flow
• Frontend: Google Sign-in button → redirects to Google
• Backend: receives token, calls Google API library → issues local JWT
Key Architectural Patterns & Design Principles
• Monorepo via Yarn workspaces: shared tooling, single CI/CD
• Pluginbased API server (Fastify plugins) for modular features
• Schema‐first validation (JSON schemas in src/schema)
• Entity‐driven data model (TypeORM)
• Separation of concerns: Sync bot vs. API server vs. Web client
• Infrastructure as code: Docker Compose for local DB; deploy configs for AWS & Vercel
Final Checklist
[ ] All main components represented with clear labels
[ ] Call out key technologies (React, Fastify, TypeORM, MariaDB, Fuse.js)
[ ] Validate with developers that each component and interaction is covered