Skip to content

Repository files navigation

Expense Tracker

A full-stack MERN application for tracking income and expenses in real time

MongoDB Express React Node.js License: MIT


Overview

Expense Tracker is a full-stack web application built on the MERN stack that lets you log, categorize, and monitor your income and expenses. Transactions are persisted in MongoDB and the balance updates in real time as you add or remove entries.


Features

  • Transaction Logging — Add transactions with a description and amount
  • Income & Expense Split — Separate views for money in and money out
  • Real-time Balance — Total balance recalculates instantly on every change
  • Global State — Managed with React Context API and a custom reducer
  • Persistent Storage — All data stored and retrieved via MongoDB

Tech Stack

MongoDB Express React Node.js Axios CSS3


Layer Tools
Frontend React, React Hooks, Context API
Backend Node.js, Express.js
Database MongoDB
HTTP Client Axios

Project Structure

Expense-Tracker/
├── client/                         # React frontend
│   ├── public/
│   │   └── index.html
│   └── src/
│       ├── components/
│       │   ├── AddTransaction.js   # Form to add a new transaction
│       │   ├── Balance.js          # Displays current total balance
│       │   ├── Header.js           # App header
│       │   ├── IncomeExpenses.js   # Income vs expense summary
│       │   ├── Transaction.js      # Single transaction item
│       │   └── TransactionList.js  # Full list of transactions
│       ├── context/
│       │   ├── AppReducer.js       # State reducer logic
│       │   ├── GlobalContext.js    # Context definition
│       │   └── GlobalProvider.js   # Context provider wrapper
│       ├── utils/
│       │   └── format.js           # Currency formatting helpers
│       └── App.js
├── config/
│   ├── config.env                  # Environment variables
│   └── db.js                       # MongoDB connection
├── controllers/
│   └── transactions.js             # Route handler logic
├── models/
│   └── Transaction.js              # Mongoose transaction schema
├── routes/
│   └── transactions.js             # API route definitions
├── server.js                       # Express server entry point
└── package.json

Getting Started

Prerequisites

  • Node.js 14+
  • MongoDB instance (local or Atlas)
  • npm

Installation & Configuration

  1. Clone the repository

    git clone https://github.com/silentwraith03/Expense-Tracker-MERN.git
    cd Expense-Tracker
  2. Install backend dependencies

    npm install
  3. Install frontend dependencies

    cd client
    npm install
    cd ..
  4. Configure environment variables

    Create config/config.env and add the following:

    MONGO_URI=your_mongodb_connection_string
    PORT=5000

Usage

Command Description
npm run dev Run frontend and backend concurrently
npm run server Run backend only
npm run client Run frontend only
cd client && npm run build Build the frontend for production

Screenshots


License

Distributed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages