How divyanshrampal/expense-tracker works
Main components of the system
• Frontend Client: The "client" folder holds all the React code including pages (e.g., HomePage, Login, Register), layout components (Header, Footer, Layout), and utility components (Spinner, Analytics). It also contains configuration files (like tailwind.config.js) and public assets.
• Backend Server: At the root, “server.js” provides the entry point to the Node.js/Express backend. The architecture follows the MVC pattern with distinct folders:
• controllers (business logic for transactions and users)
• models (Mongoose schemas for transactions and users)
• routes (defines API endpoints for transactions and users)
• config (database connection setup using MongoDB via Mongoose)
• Database: MongoDB, which is connected via Mongoose as inferred from configuration and model files.
• External Services: Dependencies include libraries like Express, Mongoose, Tailwind CSS, Ant Design, and React.
Relationships and interactions
• The Frontend (React) interacts with the Backend via RESTful API calls. For example, adding, updating, or deleting transactions will trigger API requests to corresponding routes (e.g., userRoute.js and transactionRoute.js).
• The Backend processes these requests with controllers and uses Mongoose models to perform CRUD operations on MongoDB.
• The connection between the Frontend and Backend is typically coordinated via a proxy or defined APIs endpoints, and the project setup (npm run dev) suggests concurrent running of both layers.
Important architectural patterns/design principles
• MVC Pattern: In the backend directory structure, models, views (not explicitly present since it is API-driven), and controllers separate data, business logic, and routing.
• Separation of concerns: Clearly separated client-side and server-side code.
• RESTful API Design: The routes, controllers, and models layer indicate a REST architecture.
Relevant technologies or frameworks
• Frontend: React, Tailwind CSS, Ant Design (for UI components)
• Backend: Node.js, Express.js, Mongoose (for managing MongoDB)
• Database: MongoDB