This is an Expense Tracker application built with React for the frontend and Node.js/Express for the backend. The app allows users to add, update, and delete their expenses, as well as view a list of expenses with the ability to filter them by month and year.
- Features
- Installation
- Usage
- Error Handling and Loading States
- API Endpoints
- Technologies Used
- Contributing
- Add new expenses
- Edit existing expenses
- Delete expenses
- View a list of expenses
- Filter expenses by month and year
- User authentication
-
Clone the repository:
git clone https://github.com/sukantadeveloper/expense-tracker.git cd expense-tracker
-
Install backend dependencies:
cd backend npm install
-
Create a
.env
file in thebackend
directory and add the following environment variables:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret
-
Start the backend server:
npm start
-
Install frontend dependencies:
cd frontend npm install
-
Start the frontend development server:
npm start
- Open your browser and navigate to
http://localhost:3000
to view the application. - Use the form to add, edit, or delete expenses.
- Filter expenses by selecting the desired month and year.
The application includes comprehensive error handling and loading state management to enhance user experience:
-
Error Handling:
- Uses
react-toastify
for displaying error messages. - Catches and displays errors from API calls to inform the user of issues like failed deletions or updates.
- Uses
-
Loading States:
- Shows loading indicators while fetching data, adding new expenses, updating existing ones, or deleting expenses.
- Utilizes conditional rendering to display loaders during API requests.
POST /api/users/register
- Register a new user.POST /api/users/login
- Login a user.
GET /api/expenses/:month/:year
- Fetch expenses for a specific month and year.POST /api/expenses
- Add a new expense.PATCH /api/expenses/:id
- Update an existing expense.DELETE /api/expenses/:id
- Delete an expense.
- Frontend: React, Redux, TailwindCSS, react-toastify
- Backend: Node.js, Express, MongoDB, Mongoose
- Authentication: JWT
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.