Day 1 Guide: Launch Your MERN Stack Expense Tracker with Vite + React Frontend

Table of contents
- ๐ Why MERN Stack?
- โ Goals for Day 1
- โ๏ธ Step 1: Setting Up the React App with Vite
- ๐งฑ Step 2: Folder Structure for Scalable Development
- ๐ ๏ธ Step 3: Routing with React Router
- ๐งโ๐ผ Step 4: Authentication Pages and Layout
- ๐ Planned Dashboard Pages
- ๐ Summary of Day 1
- ๐ฎ Whatโs Next (Day 2 Goals)
- ๐ Final Thoughts
Hey devs! ๐
Welcome to Day 1 of my journey building a fully functional Expense Tracker Website using the MERN stack โ MongoDB, Express.js, React.js, and Node.js.
The goal? Build a modern, responsive, and intelligent app that allows users to track their income and expenses, view visual breakdowns, and manage personal finances effortlessly.
Today, I focused on laying a solid frontend foundation. This is where everything begins, and getting the architecture right from the start is crucial for building a scalable and maintainable application.
๐ Why MERN Stack?
The MERN stack is a powerful and popular full-stack JavaScript solution used to build robust and modern web applications. Here's why it's the perfect choice for this project:
โ Unified Language โ JavaScript
Use JavaScript across the stack โ from frontend (React) to backend (Node.js) to database queries (MongoDB). This simplifies development and accelerates productivity.
โ๏ธ React.js โ Rich UI Components
React enables us to build dynamic, reusable, and performant user interfaces with powerful tools like Hooks and Context API.
๐ Express.js โ Lightweight Backend Framework
Express offers a minimal and flexible Node.js framework that handles routing, middleware, and server logic efficiently.
๐ MongoDB โ NoSQL Flexibility
MongoDB stores data in JSON-like documents, which makes it ideal for applications that handle varied and evolving data structures (like expenses, users, categories).
๐ Fast Prototyping
MERN enables rapid development and iteration, perfect for MVPs, hackathons, and scalable product builds.
๐ Scalable & Secure
Using tools like JWT, bcrypt, and Mongoose, MERN apps can scale easily with proper authentication, validation, and data modeling.
โ Goals for Day 1
Initialize the frontend using React + Vite
Organize the folder structure for clean code separation
Build basic routing with React Router
Create the Auth pages: Login & Signup
Add reusable components like Input and ProfilePic
Implement an AuthLayout for consistent UI
Plan Dashboard routes for Home, Income, and Expense pages
โ๏ธ Step 1: Setting Up the React App with Vite
Why Vite? It offers a faster development experience with optimized builds and lightning-fast HMR.
bashCopyEditnpm create vite@latest expense-tracker-frontend --template react
cd expense-tracker-frontend
npm install
npm run dev
Boom ๐ฅ โ We had a blazing fast React app running in seconds.
๐งฑ Step 2: Folder Structure for Scalable Development
To avoid future chaos and promote clean separation of concerns, I created the following directory structure:
bashCopyEditsrc/
โโโ assets/ # Images, SVGs, logos
โโโ components/ # Reusable UI components (Input, Button, Navbar, ProfilePic)
โโโ contexts/ # React Context (e.g., AuthContext, ExpenseContext)
โโโ hooks/ # Custom hooks (e.g., useAuth, useForm)
โโโ pages/
โ โโโ Auth/ # Login and Signup pages
โ โโโ Dashboard/ # Home, Income, Expense pages
โโโ utils/ # Utility functions (validators, formatters)
โโโ App.jsx # App routing setup
โโโ main.jsx # App entry point
This structure keeps things modular, maintainable, and future-ready.
๐ ๏ธ Step 3: Routing with React Router
I configured routing for the key pages using react-router-dom
. Here's the routing logic inside App.jsx
:
import React from "react";
import {
BrowserRouter as Router,
Routes,
Route,
Navigate,
} from "react-router-dom";
import Login from "./pages/Auth/Login";
import Signup from "./pages/Auth/Signup";
import Home from "./pages/Dashboard/Home";
import Income from "./pages/Dashboard/Income";
import Expense from "./pages/Dashboard/Expense";
const App = () => {
return (
<div>
<Router>
<Routes>
<Route path="/" element={<Root />} />
<Route path="/login" exact element={<Login />} />
<Route path="/signup" exact element={<Signup />} />
<Route path="/dashboard" exact element={<Home />} />
<Route path="/income" exact element={<Income />} />
<Route path="/expense" exact element={<Expense />} />
</Routes>
</Router>
</div>
);
};
This sets up the routing for both the authentication flow and the dashboard flow.
๐งโ๐ผ Step 4: Authentication Pages and Layout
I created an AuthLayout
component to wrap both Login and Signup forms with consistent styling and layout logic. This will help us:
Maintain consistent design
Avoid repetition
Improve UX structure
๐ Login & Signup Forms
Built simple, clean, and responsive forms with reusable Input
components.
๐ค ProfilePic Component
The ProfilePic
component allows users to upload or preview an avatar during signup โ this will be integrated later with backend storage. Adding this early on sets the tone for a personalized user experience.
๐ Planned Dashboard Pages
Weโve scaffolded the routing for the Dashboard section, which includes:
Home Page: Will show an overview of all transactions and a summary.
Income Page: For viewing and adding income transactions.
Expense Page: For tracking all expenses.
We havenโt built these pages yet โ theyโre placeholders for now โ but having their routes in place will streamline development later.
๐ Summary of Day 1
Task | Status |
React + Vite Setup | โ Done |
Folder Structure | โ Done |
React Router Configuration | โ Done |
Auth Pages (Login/Signup) | โ Done |
Reusable Components | โ Done |
AuthLayout Integration | โ Done |
Dashboard Routes Planned | โ Done |
๐ฎ Whatโs Next (Day 2 Goals)
On Day 2, the plan is to:
Set up the Node.js + Express backend
Initialize a MongoDB database
Create User and Expense models
Implement authentication APIs
Create Multiple routes such as Authentication, Dashboard, Expense and Income
Setup the folder structure for the backend - models, configs, controllers, middlewares , routes and uploads alongwith basic node configuration files
๐ Final Thoughts
First impressions matter โ even in code. By starting with a clean architecture, reusable components, and a structured layout, Iโve set the foundation for a robust and scalable app. Whether you're new to MERN or experienced, I hope you find this journey useful and inspiring.
Stay tuned for Day 2, where we bring this app to life with a powerful backend!
If youโd like to collaborate or want the GitHub repo link once itโs live, feel free to reach out! ๐ฌ
Hereโs my social links -
Email - abhimanyug987@gmail.com
LinkedIn - https://www.linkedin.com/in/vishal-gupta-16018719a/
GitHub - https://github.com/vishalgupta-02
Subscribe to my newsletter
Read articles from Vishal Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Vishal Gupta
Vishal Gupta
Hi, I'm Vishal Gupta, a passionate and self-driven Full-Stack Developer with a strong command of the MERN stack (MongoDB, Express.js, React.js, Node.js). I love turning complex problems into clean, scalable solutions through elegant code and user-friendly interfaces. With hands-on experience building real-world applications like MedEase, TripGenius, and now this Expense Tracker, I strive to build software thatโs not only functional but also impactful. Whether it's creating secure authentication systems, responsive UI components, or integrating AI-powered features, I aim to deliver value with every line of code. ๐ง Key Skills: Frontend: React.js, Vite, Tailwind CSS, ShadCN, Context API Backend: Node.js, Express.js, MongoDB, JWT, REST APIs Dev Tools: Git & GitHub, Postman, Firebase, Vercel Soft Skills: Problem-solving, communication, and a strong desire to learn & grow I believe in continuous learning and building meaningful products that solve real-life problems. Currently, Iโm open to opportunities where I can collaborate, innovate, and contribute to exciting web development projects.