How akaruiyami/syfinance works
Project type and purpose
• This is a full-stack (single-page) personal finance dashboard built on Streamlit.
• Purpose: allow users to log in, track incomes, transactions, targets, wishlists, and view summaries.
File structure
• Entry point: main.py (launches Streamlit app).
• CLI helper: manage.py (database initialization command).
• Presentation layer:
• pages/ ─ Streamlit page modules (p_login, p_advisor, p_income, p_transaction, p_target, p_summary).
• components/ ─ reusable UI components (e.g., paginated tables).
• Business logic & domain:
• models/ ─ ORM-style entities and fields (base, types, income, transaction, wishlist).
• utils/ ─ cross-cutting services (auth, config loader, db connection).
• Configuration & environment:
• utils/config.py (app settings).
• .python-version, pyproject.toml, requirements.txt.
• Deployment & scripting:
• run.sh (shell wrapper).
• uv.lock (UV sync lock file).
README for additional insights
• Uses Streamlit for UI.
• DB must be initialized via manage.py init_db, prompting user creation.
• Supports remote network access.
• Dependencies: Streamlit, argon2-cffi for password hashing.
Main architectural components
a. Presentation Layer (Streamlit App)
• main.py ─ app bootstrapper.
• pages/* ─ route handlers (login, dashboard, etc.).
• components/* ─ custom UI widgets.
b. Service Layer (Business Logic)
• Authentication service (utils/auth.py).
• Configuration loader (utils/config.py).
• Database session manager (utils/db.py).
c. Data Layer
• Domain models (models/*.py).
• Base ORM (models/_base.py, models/base.py, models/_types.py).
• Entities: Income, Transaction, Wishlist.
d. CLI Utility
• manage.py ─ database initialization command.
e. External Services & Libraries
• Streamlit runtime.
• Argon2 Password Validator.
• SQLite/PostgreSQL (configurable in config.py).
Relationships and interactions
• User → Streamlit UI (HTTP/WebSocket).
• UI (pages) → Service layer (utils/*) to authenticate & fetch data.
• Service layer → Data layer (models/*) via utils/db.py session.
• Data layer ↔ Database.
• manage.py → Service layer → Data layer (initial schema creation & admin user).
Architectural patterns & design principles
• Layered architecture (Presentation → Service → Data).
• MVC-like separation (pages = views; utils = controller/services; models = model).
• Modularization (pages/components/models/utils each in own package).
• Dependency inversion: pages import interfaces (services/models) not raw DB drivers.