How pooriat/stockup works
Project type and purpose
• StockUP is a full-stack web application:
• Frontend built with SvelteKit/Vite (TypeScript, components under frontend/src)
• Backend built with FastAPI (Python, modules under backend/app)
• No on-premise database schema appears—business logic modules call external AI and market-data services.
• Its goal is to present AI-driven stock analysis (via Google Gemini) and interactive charts (via Plotly) in a web dashboard.
File structure
• Top-level:
• .github/ – issue/pr templates and CI workflows (linting)
• backend/ – Python FastAPI service
• frontend/ – SvelteKit UI
• test/ – unit & integration tests
• backend/app/ layers:
• main.py – FastAPI entrypoint with CORS and router mounting
• routers/ – API endpoints (e.g. /stock_info)
• services/ – domain logic: fetching symbols, wrapping Gemini AI calls, historical data
• models/ – Pydantic request/response schemas
• setup/environment.py – configuration loader (.env)
• frontend/src/:
• routes/ – page Svelte components for Home, About, AI Chat, Stock Info, etc.
• lib/components – reusable UI (e.g. StockCharts.svelte)
• lib/config.ts – client-side API base URL
Extract architecture insights from README
• Uses Docker for containerization (backend/Dockerfile)
• Poetry manages Python dependencies; NPM/Yarn for frontend
• CI via GitHub Actions (.github/workflows/lint.yaml), pre-commit hooks
• Testing via pytest and front-end test suite (not shown, but configured)
a. Components
• Client (Browser) / User Interface
• Frontend (SvelteKit app served by Vite or StaticFiles)
• Backend (FastAPI REST API)
• External AI Service (Google Gemini API)
• External Market-Data API (e.g. stock price provider)
• CI/CD (GitHub Actions + pre-commit)
• Container (Docker image)
b. Relationships & data flow
1. User interacts with the SvelteKit UI in the browser.
2. UI sends HTTP requests to FastAPI endpoints (/api/stock_info, /api/ai_chat, etc.).
3. FastAPI routers receive requests, validate via Pydantic models, and delegate to service modules.
4. Service modules fetch raw market data from an external market-data API.
5. Service modules call Google Gemini via its SDK or HTTP API for analysis/predictions.
6. Services assemble responses and return JSON to the frontend.
7. Frontend receives data and renders charts (Plotly via StockCharts.svelte) and UI elements.
8. Entire application is built/tested via CI pipelines and packaged into a Docker image for deployment.
c. Architectural patterns & principles
• Layered architecture: Presentation (Frontend) → API Layer (Routers) → Business Logic (Services) → External Integrations
• Modularization: each service in backend/app/services encapsulates one domain task
• Separation of concerns: Pydantic models for validation, routers for HTTP, services for logic
• Containerization: single Dockerfile orchestrates frontend build + FastAPI serving
d. Key technologies
• FastAPI, Uvicorn, Pydantic
• SvelteKit, Vite, TypeScript
• Google Gemini AI SDK
• Plotly (frontend charts)
• Poetry, pytest, pre-commit, ESLint, Prettier
Detail
• If the SvelteKit app is prerendered/static, show the build step in the Dockerfile stage.
• Tests runner in CI: “pytest”, “ESLint/Prettier”, “pre-commit hooks.”