This is a full-stack expense tracker application built with the MERN stack (MongoDB, Express, React, Node.js). This App allows the user to track their expenses by creating, reading, updating and deleting expense entries. This project contains two main structures: as a backend entry and a frontend.
- Add , track, update and delete expenses
- View a list of all expenses
server.js: Entry point of the backend server. routes/expenseRoutes.js: Defines the API routes for managing expenses. controllers/expenseController.js: Contains the logic for handling API requests.
-
Navigate to the
backend
folder:cd backend
-
Install dependencies:
npm install
-
Create a
.env
file and add your MongoDB URI:MONGO_URI=your_mongodb_connection_string
-
Run the server:
npm run dev
src/App.js: Main React component for the application. public: Contains static files and the HTML template.
-
Navigate to the
frontend
folder:cd frontend
-
Install dependencies:
npm install
-
Run the React app:
npm start
-
Ensure all the necessary directores and files are created.
-
Navigate to the root root directory and install concurrently:
npm install concurrently
-
Navigate to the root directory to start both servers using the following command:
npm start
This command will use concurrently to start both the frontend and backend servers. The frontend will be available at http://localhost:3000 and the backend will be running on http://localhost:5000.
This project is licensed under the MIT License - see the LICENSE file for details.
Get All Expenses URL: /api/expenses Method: GET Response: Array of expense objects Get Expense by ID URL: /api/expenses/:id Method: GET Response: Expense object Create Expense URL: /api/expenses Method: POST Body: JSON object containing description, amount, and date Response: Created expense object Update Expense URL: /api/expenses/:id Method: PUT Body: JSON object containing description, amount, and date Response: Updated expense object Delete Expense URL: /api/expenses/:id Method: DELETE Response: 204 No Content Project Structure server.js: Entry point of the backend server. routes/expenseRoutes.js: Defines the API routes for managing expenses. controllers/expenseController.js: Contains the logic for handling API requests.
Any bugs, or issues , or any contributions are welcome, please feel free to suggest any changes or troubleshooting.