This is a MEAN stack project which is used for tracking huge expenses and visualizing those expenses, some of its highlighting features includes Categorization of expense data, Visualization of expense data in form of bar graph & pie chart using Chart.js and if you want to keep track of a huge amount of data then it can be easily done through the .csv file import option.
This is a MEAN stack expense tracking application with the following structure:
- Frontend: Angular application with Material UI components
- Backend: Node.js/Express.js REST API
- Database: MongoDB
- Features: Expense CRUD operations, data visualization with Chart.js, CSV import, user authentication
Before setting up the project locally, ensure you have the following installed:
- Node.js (v14 or higher)
- npm or yarn package manager
- MongoDB (local installation or MongoDB Atlas account)
- Git
cd backendnpm installCreate a .env file in the backend directory with the following variables:
MONGO_URI=mongodb://localhost:27017/expense_tracker
# OR for MongoDB Atlas:
# MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/expense_tracker
PORT=3000
JWT_SECRET=your_jwt_secret_key_here# Development mode
node server.js
# OR with nodemon for auto-restart
npm install -g nodemon
nodemon server.jsThe backend server will run on http://localhost:3000
POST /v1/api/USER/signup- User registrationPOST /v1/api/USER/login- User loginGET /v1/api/GET_ALL_EXPENSE/:userId- Get all expenses for userPOST /v1/api/CREATE_EXPENSE- Create new expenseDELETE /v1/api/DELETE_EXPENSE/:id- Delete expenseGET /v1/api/GET_SINGLE_EXPENSE/:id- Get single expensePATCH /v1/api/EDIT_EXPENSE/:id- Update expense
cd .. # Go back to project rootnpm installCreate src/environments/environment.ts and src/environments/environment.prod.ts:
// src/environments/environment.ts
export const environment = {
production: false,
apiUrl: 'http://localhost:3000/v1/api/'
};
// src/environments/environment.prod.ts
export const environment = {
production: true,
apiUrl: 'https://your-backend-url.com/v1/api/'
};# Start Angular development server
ng serve
# OR with specific port
ng serve --port 4200The frontend application will run on http://localhost:4200
# Build for production
ng build --configuration=production
# The build artifacts will be stored in the `dist/` directory-
Terminal 1 - Backend:
cd backend node server.js -
Terminal 2 - Frontend:
ng serve
- WelcomeComponent: Landing page with login/signup
- AddExpenseComponent: Form for creating/editing expenses
- ViewExpensesComponent: Display and manage expenses
- HeaderComponent: Navigation and user actions
- UserModel: User authentication and profile data
- ExpenseModel: Expense data structure with fields:
- name, amount, expense_date, expense_category, payment, comment
Happy coding! 🚀
