The backend of the Personal Finance Tracker is a simple and efficient Node.js application built using Express.js and MongoDB for data storage. This project was developed as part of a task for a MERN stack internship application. The backend manages user authentication, expense tracking, and data storage, and it is open for contributions or reuse by anyone interested.
-
Authentication:
- JWT (JSON Web Token) is used for secure authentication.
- Routes for user login and registration are provided.
-
Expense Management:
- Users can create, update, and delete their expense records.
- Each expense is associated with a specific user.
-
User Management:
- Registration and login features allow users to create accounts and authenticate.
- User details include email, first name, last name, income, and password.
-
Expense Model:
- title: The title of the expense.
- description: A brief description of the expense.
- mode: The mode of payment (e.g., cash, credit).
- date: The date the expense was made.
- amount: The amount spent.
- user: The user who made the expense (reference to the User model).
-
User Model:
- email: User's email address.
- firstname: User's first name.
- lastname: User's last name.
- income: User's total income.
- password: User's password (hashed).
- passwordConfirm: Field to confirm the user's password.
-
User Routes:
- /register: Register a new user.
- /login: Login and receive a JWT token for authentication.
-
Expense Routes:
- /expenses: Get all expenses for the authenticated user.
- /expenses/:id: Get, update, or delete a specific expense by ID.
- /expenses/create: Create a new expense record.
- Validator Library:
- Used for validating user input during registration and login.
- Backend:
- Node.js: JavaScript runtime for server-side execution.
- Express.js: Web framework for building RESTful APIs.
- MongoDB: NoSQL database for storing user and expense data.
- Mongoose: ODM (Object Data Modeling) library for MongoDB.
This project is open to contributions. Feel free to fork the repository, make your changes, and submit a pull request.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software as per the terms of the license.
- Node.js for providing the runtime environment.
- Express.js for the web framework.
- MongoDB and Mongoose for database management.
- JWT for secure authentication.
- Validator for input validation.