A modern, responsive expense tracking application built with Next.js 14 frontend and Express.js backend. Track your expenses efficiently with a beautiful green-themed UI and comprehensive features.
- User Registration β Create new accounts with email and password (passwords securely hashed with bcrypt)
- User Login β Secure login with JWT token storage
- Forgot Password β Password reset with email and new password
- Session Management β Automatic logout and token handling
- Add Expenses/Incomes β Create new entries with title, amount, date, category, and notes
- Edit & Delete β Update or remove entries with confirmation
- User-Specific Categories β Each user has their own set of income and expense categories
- Category Management β Create, view, and manage categories filtered by logged-in user
- Summary Cards β View spending and income totals for week, month, and last 3 months
- Filtering β Filter by time periods and custom date ranges
- Category Organization β Color-coded categories per user
- Modern Design β Clean, intuitive interface with green primary theme
- Dark Mode Support β Toggle between light and dark themes
- Responsive Layout β Works perfectly on desktop, tablet, and mobile
- Toast Notifications β User-friendly success and error messages
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Modern UI component library
- Lucide React - Beautiful icons
- Express.js β Node.js web framework
- Sequelize ORM β Database ORM
- JWT Authentication β Secure token-based auth
- bcryptjs β Password hashing
- MySQL β Database
- Node.js 18+ installed
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/kronos-optimize/Expense_Tracker.git cd expense-tracker -
Configure environment variables
-
Backend:
Create a.envfile inside thebackendfolder with your database credentials:DB_HOST=localhost DB_USER=root DB_PASS=your_mysql_password DB_NAME=expense_tracker PORT=4000 JWT_SECRET=your_jwt_secret -
Frontend:
Create a.env.localfile in the root of your frontend (Next.js) project:NEXT_PUBLIC_API_URL=http://localhost:4000/api
-
-
Run the backend server
cd backend npm install npm run dev -
Run the frontend server
cd ../ npm install npm run dev # or yarn dev
-
Open your browser Navigate to http://localhost:3000
Expense_Tracker/
βββ backend/ # Express.js backend
β βββ controllers/ # Route controllers (user, expense, income, etc.)
β βββ db/ # Database config and seeders
β βββ models/ # Sequelize models
β βββ routes/ # API route definitions
β βββ server.js # Express app entry point
β βββ ... # Other backend files
βββ frontend/ # Next.js 14 frontend
β βββ app/ # App Router pages
β βββ components/ # Reusable React components
β βββ lib/ # Utility functions
β βββ public/ # Static assets
β βββ styles/ # Global styles (if any)
β βββ ... # Other frontend files
βββ README.md # Project documentation
POST /api/users/register # Register new user
POST /api/users/login # Login, returns { token, user }
POST /api/users/forgot-password # Request password reset
GET /api/expenses # Get all expenses for logged-in user
POST /api/expenses # Add new expense
GET /api/expenses/:id # Get expense by ID
PUT /api/expenses/:id # Update expense by ID
DELETE /api/expenses/:id # Delete expense by ID
GET /api/expense/summary/stats # get summary data for display at dashboard
GET /api/incomes # Get all incomes for logged-in user
POST /api/incomes # Add new income
GET /api/incomes/:id # Get income by ID
PUT /api/incomes/:id # Update income by ID
DELETE /api/incomes/:id # Delete income by ID
GET /api/income-categories # Get income categories for logged-in user
POST /api/income-categories # Create income category for logged-in user
GET /api/income-categories/:id # Get income category by ID
PUT /api/income-categories/:id # Update income category by ID
DELETE /api/income-categories/:id # Delete income category by ID
GET /api/categories # Get expense categories for logged-in user
POST /api/categories # Create expense category for logged-in user
GET /api/categories/:id # Get expense category by ID
PUT /api/categories/:id # Update expense category by ID
DELETE /api/categories/:id # Delete expense category by ID
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE income_categories (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
description VARCHAR(255),
userId INT NOT NULL,
FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE expense_categories (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
description VARCHAR(255),
userId INT NOT NULL,
FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
);CREATE TABLE expenses (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
amount DECIMAL(10,2) NOT NULL,
date DATE NOT NULL,
notes TEXT,
userId INT NOT NULL,
categoryId INT NOT NULL,
FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (categoryId) REFERENCES expense_categories(id) ON DELETE CASCADE
);
CREATE TABLE incomes (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
amount DECIMAL(10,2) NOT NULL,
date DATE NOT NULL,
notes TEXT,
userId INT NOT NULL,
categoryId INT NOT NULL,
FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (categoryId) REFERENCES income_categories(id) ON DELETE CASCADE
);- Seed runs only once: On first run, if no users exist, initial users and categories are created.
- User-specific categories: Each user gets their own set of income and expense categories.
- Passwords are hashed before saving users.
- β Backend and frontend are fully integrated
- β All features are functional with real API and persistent data
- β User-specific categories and data filtering
- β Authentication and session management implemented
- β Responsive, modern UI
Happy expense tracking! π