An expense tracker application built with a Node.js backend using Express and MongoDB, and a React frontend. This application allows users to add, view, update, and delete transactions, and it calculates the total balance, income, and expenses.
- Add new transaction
- View transaction history
- View recent transactions
- Update existing transactions
- Delete transactions
- Calculate total balance, income, and expenses
- Node.js
- Express
- MongoDB
- Mongoose
- dotenv
- cors
- Vite+React
- Tailwind CSS
- Axios
-
Clone the repository:
git clone https://github.com/rajverma/Expense-Tracker.git cd .\backend\
-
Install dependencies:
npm install
-
Create a
.env
file in thebackend
directory and add the following environment variables:PORT=5000 MONGODB_CONNECTION=your_mongodb_connection_string
-
Start the server:
npm run dev
-
Navigate to the frontend directory:
cd .\frontend\
-
Install dependencies:
npm install
-
Create a
requestMethods.js
file in thefrontend/src
directory and add the following code:import axios from 'axios'; const publicRequest = axios.create({ baseURL: 'http://localhost:5000/', }); export default publicRequest;
-
Start the React application:
npm run dev
- Use the form to add new transactions by providing a description, amount, transaction type (debit or credit), and date.
- View the total balance, income, and expenses.
- View recent transactions, update or delete them as needed.
POST /expenses
- Add a new expenseGET /expenses
- Get all expensesGET /expenses/recent
- Get the 5 most recent expensesPUT /expenses/:id
- Update an expense by IDDELETE /expenses/:id
- Delete an expense by ID
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License.