How imzodev/gemini-presupuesto-voz works
Project Overview
• This is a full-stack budget tracking application that uses React, TypeScript, and Vite for the frontend, and a Node.js–powered backend (written in TypeScript) that serves APIs and handles database operations.
• The application leverages an SQLite database (budget.db) for persistence and integrates with Google’s Gemini AI API for voice command and reporting capabilities.
Main Components
a. Frontend:
• Represented by the “src” directory, it includes:
• React components (e.g., CategoriesTable, Dashboard, DashboardCharts, etc.).
• API calls (in src/api/budgetApi.ts) that likely interact with the backend.
• Application pages (in src/pages) and context management (src/contexts).
• Styling and utility modules.
• Use Vite (as seen from vite.config.ts) as the build tool.
b. Backend:
• Represented by the “server” directory which includes:
• The main server file (server/index.ts) which likely sets up routes and middleware.
• A “db” subdirectory containing database connection and operations (database.ts and operations.ts).
• The backend serves as the API layer for the frontend and interacts with both the SQLite database and the external Gemini API.
c. Database:
• The “budget.db” file is an SQLite database used by the backend to store expense and income data.
d. External Services:
• Google Gemini AI is used for voice command processing. Indicate an external API component (along with the integration key set in the .env) that interacts with the Gemini API.
Relationships and Data Flow
• From the Frontend to the Backend: API calls for submitting transactions, managing categories, and requesting budget info.
• From the Backend to the Database: CRUD operations using functions in the “server/db” modules.
• From the Backend to Google Gemini API: Voice command processing calls, likely invoked by endpoints dedicated to handling voice commands.
• The voice command functionality ties the external service with a frontend action (clicking “Voice Report” or similar) and then feeds the result back to the user interface.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly divide the application into frontend (user interface), backend (API and business logic), and data persistence layers.
• Modular Design: The frontend is component-based (React) and the backend has separate modules for database operations.
• API-driven Communication: The frontend interacts with the backend via defined API endpoints, and the backend in turn communicates with external services.
• Environment-based configuration: The use of .env for storing sensitive API keys.
– API endpoints
– Database Operations (store in “server/db”)
– Integration with Gemini API.
• Directional data flows and use legends or annotations where necessary.