Expense Tracker is a user-friendly web application designed to help you efficiently manage your finances. With this application, users can easily register and log in, organize their expenses and incomes by categories, and perform a range of actions such as adding, updating, deleting, and viewing transactions. Additionally, it provides a comprehensive overview of your financial balance, allowing you to keep track of all your transactions in one place.
- User authentication (register and login / login with OTP)
- Manage expense categories
- Track expenses
- Track incomes
- View balance and all transactions
- View, update, and delete individual expenses and incomes
- View and update user details
POST /api/v1/auth/login
: Log in a user.POST /api/v1/auth/register
: Register a new user.POST /api/v1/auth/generateOTP
: Generate OTP for User Login.POST /api/v1/auth/confirmOTP
: Confirm OTP for User Login.
GET /api/v1/category/
: Get all categories.POST /api/v1/category/
: Add a new category.
POST /api/v1/expense/
: Add a new expense.GET /api/v1/expense/
: Get all expenses.GET /api/v1/expense/:id
: Get one expense with provided ID.DELETE /api/v1/expense/:id
: Delete one expense.PUT /api/v1/expense/:id
: Update an expense.
POST /api/v1/income/
: Add a new income.GET /api/v1/income/
: Get all incomes.GET /api/v1/income/:id
: Get one income with provided ID.DELETE /api/v1/income/:id
: Delete one expense with provided ID.PUT /api/v1/income/:id
: Update an expense with provided ID.
GET /api/v1/user/:id
: Get user details.PUT /api/v1/user/:id
: Update user password.
GET /api/v1/balance/
: Get user balance.(total income - total expense)GET /api/v1/balance/transactions
: Get all transactions of user.
- bcrypt: A library to help you hash passwords.
- dotenv: A zero-dependency module that loads environment variables from a
.env
file intoprocess.env
. - express: A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- jsonwebtoken: A library to sign and verify JSON Web Tokens (JWTs).
- mongoose: A MongoDB object modeling tool designed to work in an asynchronous environment.
- nodemailer: A Node.js module for sending emails using SMTP with support for various email services and authentication methods.
- otp-generator-random: A lightweight package for generating random one-time passwords (OTPs) with customizable options.
- crypto: A built-in Node.js module providing cryptographic functionality, including hashing, encryption, and generating secure random values. Used to create acess & refresh token.
- nodemon: A tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.
Make sure you have Node.js and npm installed on your machine.
-
Clone the repository:
git clone https://github.com/Syed-Sarkheel/Expense-Tracker-Backend cd Expense-Tracker-Backend
-
Install the dependencies:
npm install
-
Create a .env file in the root directory and add the following environment variables using the
.env.sample
file. -
Create an App Password from https://myaccount.google.com/security and paste it in
MAIL_PASS
at.env
and enter your mail id atMAIL_USER
. -
Create your own
ACCESS_TOKEN_SECRET
andREFRESH_TOKEN_SECRET
by runningsecrets.js
.
Start the server in development mode:
npm run dev
- Register a new user using the
/api/v1/auth/register
endpoint. - Log in with your registered credentials using the
/api/v1/auth/login
endpoint to obtain a token. - Use the token to authenticate subsequent requests to manage categories and expenses.
Syed Sarkheel Baseer