How mailtonskiran/vibe-coding works
1. Overall shape
- This is a small, single-process Flask application for mutual fund portfolio management.
- The core runtime is Python, with a server-rendered web UI plus JSON API endpoints.
- Persistence is handled by a local SQLite database stored under instance/mutual_funds.db.
2. Primary application boundary
- app.py is the main entry point and likely contains the Flask app, route handlers, request validation, and orchestration of database and recommendation logic.
- The README’s listed endpoints indicate the app exposes both HTML pages and REST-style API routes from the same backend.
3. Data layer
- SQLite is the only persistent datastore in the repository.
- The instance/ folder is the Flask-standard location for app-local state, and the database file there suggests the app uses a file-backed, single-node deployment model.
- dbview.py appears to be an auxiliary utility for inspecting or querying the database during development.
4. Domain data and initialization
- populate_master_data.py and Python/data.csv indicate the project includes a data-loading path for seeding master mutual fund data.
- This likely supports lookup/reference data used by recommendation and portfolio functions rather than user-generated transactional data.
5. Recommendation subsystem
- RECOMMENDATION_LOGIC.md suggests the recommendation engine is a distinct documented concern, probably mapping investor risk profile to fund selections.
- The API endpoint GET /api/recommendations/<investor_id> is the main integration point for that logic.
- Architecturally, this is the key business rule layer between investor profile data and fund catalog data.
6. Portfolio and investor management
- The documented endpoints POST /api/investors and POST /api/portfolios/<investor_id> show two main domain entities: investors and portfolios.
- Investor registration/profile management is the user identity and risk-profile boundary.
- Portfolio creation/management is the investment container boundary that associates an investor to selected funds or holdings.
7. Frontend composition
- The UI is currently a Flask template-based frontend, not the React frontend mentioned as future work in the README.
- templates/index.html is the primary page template.
- static/css/style.css and static/js/main.js provide client-side presentation and interaction, likely for form submission, API calls, and dynamic updates.
8. Request/response flow
- A typical flow is: user interacts with the browser UI → browser loads the Flask-served HTML/JS/CSS → client submits investor or portfolio data to Flask API endpoints → Flask persists or reads from SQLite → responses are returned as JSON or rendered content.
- Recommendation requests likely combine investor profile data and master fund data from the database to produce ranked fund suggestions.
9. Supporting artifacts
- FUNCTIONAL_REQUIREMENTS.md and SESSION_SUMMARY.md are project documentation rather than runtime components.
- They probably capture intended behaviors, design decisions, and implementation status, and are useful for understanding system boundaries but not part of the deployed architecture.
10. Project constraints implied by the repo
- The app is local-first and file-backed, which means deployment and scaling are simple but stateful.
- There is no evidence of external services, authentication providers, or background workers in this repository.
- Historical analytics and real-time market integration are explicitly listed as future enhancements, so current architecture is likely focused on CRUD plus rule-based recommendations.
11. What to draw in an architecture diagram
- Draw three main layers: browser UI, Flask application/API, and SQLite database.
- Add a separate “data seed / master data import” path from CSV into the database.
- Show the recommendation logic as a backend service/module inside the Flask application that reads investor profile data and fund master data.
12. Important distinction
- Although the README mentions React, the checked-in structure does not show a React frontend; the implemented UI is template/static-file based.
- For an accurate diagram, treat React as planned future architecture, not current architecture.
Main entry points: app.py Flask app · mutual_funds.db SQLite DB · index.html Index page · populate_master_data.py Seed loader
Components 15
Presentation
Server-rendered UI and client-side assets
- Browser UI · User-facing entry point served by Flask
- Index page · Primary HTML template for the app
templates/index.html - Client JS · Browser-side interaction and API calls
static/js/main.js - Stylesheet · UI styling for the template
static/css/style.css
Backend
Flask application and domain logic
- Flask app · Main application entry point
app.py - Pages · Server-rendered page handlers
- API · JSON endpoints for investors, portfolios, and recommendations
- Recommendations · Investor-to-fund recommendation rules
- Investors · Investor profile and risk boundary
- Portfolios · Portfolio creation and management
Data
Persistent store and seed inputs
- SQLite DB · Local application database
instance/mutual_funds.db - Seed loader · Loads master fund data into the database
populate_master_data.py - Master data · Reference fund data used for seeding
Python/data.csv
Tooling
Development and inspection utilities
- DB view · Utility for inspecting the database
dbview.py - Logic notes · Reference documentation for recommendation behavior
RECOMMENDATION_LOGIC.md
Connections 17
- Browser UI → Index page: loads · Browser receives the rendered page shell
- Index page → Client JS: uses · Template includes client-side behavior
- Index page → Stylesheet: styles · Template uses shared styling
- Browser UI → Flask app: requests · User actions reach the Flask backend
- Flask app → Pages: serves · Renders pages for the UI
- Flask app → API: exposes · Provides JSON endpoints
- API → Investors: manages · Creates and reads investor profiles
- API → Portfolios: manages · Creates and reads portfolios
- API → Recommendations: calls · Recommendation endpoint delegates to business logic
- Recommendations → SQLite DB: reads · Uses stored investor and fund data
- Recommendations → Master data: depends on · Relies on seeded master fund catalog
- Flask app → SQLite DB: persists · Reads and writes application state
- Seed loader → Master data: imports · Consumes CSV seed data
- Seed loader → SQLite DB: loads · Populates the local database
- DB view → SQLite DB: inspects · Developer utility for querying the DB
- Logic notes → Recommendations: describes · Documents recommendation behavior
- Client JS → API: calls · Front end submits API requests