System requirements
Before installing BillBuddy, ensure your system meets these requirements:- Node.js: v18.0.0 or higher (specified in
backend/package.json:6-8) - MongoDB: v4.4 or higher
- npm: v8 or higher (or yarn as an alternative)
- Memory: Minimum 2GB RAM recommended
- Disk Space: 500MB for dependencies and database
BillBuddy uses modern JavaScript features and requires Node.js v18+ as specified in the backend engine configuration.
Repository structure
BillBuddy follows a monorepo structure with separate backend and frontend directories:Backend installation
Install dependencies
Install all required npm packages:This installs the following key dependencies:
Configure environment variables
Create a
.env file in the backend directory:.env
Environment variable details
PORT
PORT
The port on which the Express server will run. Default is 5000.The server listens on this port as specified in
server.js:62:MONGODB_URI
MONGODB_URI
MongoDB connection string. Can be:
- Local:
mongodb://localhost:27017/billbuddy - MongoDB Atlas:
mongodb+srv://username:[email protected]/billbuddy
server.js:40-42 for database connection:JWT_SECRET
JWT_SECRET
Secret key for signing JWT tokens. Must be a strong, random string.Used in
models/User.js:48-50 for token generation:WEB3FORMS_ACCESS_KEY
WEB3FORMS_ACCESS_KEY
Access key for Web3Forms email service. Used for sending settlement summaries.Implemented in Get a free key at web3forms.com. Optional for development but recommended for production.
utils/email.js:31-39:Set up MongoDB
BillBuddy requires a running MongoDB instance. Choose one option:
- Local MongoDB
- MongoDB Atlas (Cloud)
- Docker
macOS (Homebrew):Ubuntu/Debian:Windows:
Download and install from mongodb.com/try/download/community
Frontend installation
Install dependencies
Install all required npm packages:This installs the following key dependencies:
Configure API endpoint
The frontend is configured to communicate with the backend at
http://localhost:5000.The CORS configuration in server.js:30-37 allows these origins:Start the development server
Run the Vite development server:Output:The frontend will be available at
http://localhost:5173.Verify installation
Test backend API
Verify the backend is running by testing the health endpoint:You should receive a 401 response (expected without authentication).
Test frontend
Open
http://localhost:5173 in your browser. You should see the BillBuddy home page with:- Navigation bar with Login/Register buttons
- Hero section with gradient background
- Feature cards
Test user registration
- Click “Sign Up” or navigate to
http://localhost:5173/register - Fill in the registration form (name, email, password)
- Submit the form
- You should be redirected to the groups page with a valid JWT token
Running both servers
For development convenience, you can run both servers simultaneously:Option 1: Using concurrently (from backend directory)
backend/package.json:13) uses concurrently to run both servers:
Option 2: Separate terminals
Terminal 1 (Backend):Common issues
Module not found errors
Module not found errors
If you encounter module not found errors:
- Delete
node_modulesfolders: - Clear npm cache:
- Reinstall dependencies:
MongoDB connection refused
MongoDB connection refused
If you see “ECONNREFUSED” or “MongoServerError”:
- Verify MongoDB is running:
- Check the MongoDB port (default 27017):
- Verify your
MONGODB_URIin.envis correct - Check MongoDB logs for errors:
CORS policy errors
CORS policy errors
If you see CORS errors in the browser console:
- Verify the backend is running on port 5000
- Verify the frontend is running on port 5173
- Check the CORS configuration in
backend/server.js:30-37 - Clear browser cache and hard reload (Cmd/Ctrl + Shift + R)
JWT authentication fails
JWT authentication fails
If authentication tokens are not working:
- Verify
JWT_SECRETis set in your.envfile - Check that the secret is at least 32 characters
- Clear browser localStorage:
- Register a new user to get a fresh token
Port already in use
Port already in use
If port 5000 or 5173 is already in use:Backend port conflict:Frontend port conflict:
Vite will automatically try the next available port (5174, 5175, etc.)
Next steps
API reference
Explore all available API endpoints and request/response formats.
Authentication guide
Learn how to authenticate users and protect routes.
Core features
Understand the MongoDB schema for Users, Groups, Expenses, and Settlements.
Configuration
Configure environment variables and database settings.