Skip to main content

Prerequisites

Before you begin, ensure you have the following installed on your system:

Node.js 18+

Download from nodejs.org

pnpm 9.0.0

Install with npm install -g [email protected]

MongoDB

Local instance or MongoDB Atlas

Git

For version control and cloning the repository

Installation

1

Clone the repository

Clone the Money monorepo from GitHub:
git clone https://github.com/AmarMuric04/money.git
cd money
2

Install dependencies

Install all dependencies for the entire monorepo using pnpm:
pnpm install
The monorepo uses pnpm workspaces. Make sure you’re using pnpm 9.0.0 as specified in package.json.
3

Set up environment variables

Create .env.local files for each application that requires environment configuration.

CashGap (.env.local in apps/cashgap/)

# Database
MONGODB_URI=mongodb://localhost:27017/cashgap

# Authentication
AUTH_SECRET=your-secret-key-here-min-32-chars
NEXTAUTH_URL=http://localhost:3000

# Google OAuth (optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

# Email (for verification)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASSWORD=your-app-password
SMTP_FROM=[email protected]

SecureVault (.env.local in apps/secure/src/)

# Database
MONGODB_URI=mongodb://localhost:27017/securevault

# Authentication
AUTH_SECRET=your-secret-key-here-min-32-chars
NEXTAUTH_URL=http://localhost:3000

# JWT Tokens
JWT_SECRET=your-jwt-secret-min-32-chars
JWT_REFRESH_SECRET=your-refresh-secret-min-32-chars
Never commit .env.local files to version control. These files contain sensitive credentials.
4

Start MongoDB

Make sure MongoDB is running on your local machine:
# macOS (using Homebrew)
brew services start mongodb-community

# Linux (systemd)
sudo systemctl start mongod

# Or use MongoDB Atlas (cloud)
# Update MONGODB_URI with your Atlas connection string
5

Run development servers

Start all applications in development mode:
pnpm dev
Or run individual applications:
pnpm dev --filter=cashgap
Access at http://localhost:3000
When running individual apps, they will all use port 3000 by default. Only run one at a time or modify the port in package.json.

Verify Installation

After starting the development servers, verify everything is working:
  1. Navigate to http://localhost:3000
  2. You should see the CashGap landing page
  3. Click “Get Started” to create an account
  4. Fill in the registration form and verify your email
  5. Log in and explore the dashboard
  1. Navigate to http://localhost:3000 (if running SecureVault)
  2. You should see the SecureVault landing page
  3. Register for a new account
  4. Log in and access the password vault
  5. Try adding a new password entry
Check that MongoDB is connected:
# Connect to MongoDB
mongosh

# List databases
show dbs

# You should see cashgap and/or securevault databases

Available Scripts

The monorepo includes several useful scripts:
ScriptDescription
pnpm devStart all apps in development mode
pnpm buildBuild all apps for production
pnpm lintRun ESLint on all packages
pnpm formatFormat code with Prettier
pnpm check-typesRun TypeScript type checking

Using Turbo Filters

Run commands for specific apps or packages:
# Run dev for a specific app
pnpm dev --filter=cashgap
pnpm dev --filter=secure
pnpm dev --filter=web

# Build a specific app
pnpm build --filter=cashgap

# Lint a specific package
pnpm lint --filter=@repo/ui

Building for Production

1

Build all applications

pnpm build
This will build all applications in the correct order, respecting dependencies.
2

Set production environment variables

Update your .env.local files with production values:
  • Use production MongoDB URI
  • Set strong AUTH_SECRET values
  • Configure production OAuth credentials
  • Set up production SMTP settings
3

Start production servers

# Start CashGap in production
cd apps/cashgap
pnpm start

# Start SecureVault in production
cd apps/secure
pnpm start

Working with Shared Packages

The monorepo includes shared packages that can be used across applications:

Using @repo/ui Components

import { Button, Card, Input } from "@repo/ui";

export default function MyComponent() {
  return (
    <Card>
      <Input placeholder="Enter text..." />
      <Button>Submit</Button>
    </Card>
  );
}

Using @repo/auth

import { LoginForm, RegisterForm, useAuth } from "@repo/auth";

export default function AuthPage() {
  const { user, login, logout } = useAuth();
  
  return (
    <div>
      {user ? (
        <button onClick={logout}>Logout</button>
      ) : (
        <LoginForm onSuccess={(user) => console.log("Logged in:", user)} />
      )}
    </div>
  );
}

Troubleshooting

If you see Error: Port 3000 is already in use:
  1. Kill the process using the port:
    # macOS/Linux
    lsof -ti:3000 | xargs kill -9
    
    # Windows
    netstat -ano | findstr :3000
    taskkill /PID <PID> /F
    
  2. Or change the port in package.json:
    {
      "scripts": {
        "dev": "next dev --port 3001"
      }
    }
    
If MongoDB connection fails:
  1. Verify MongoDB is running:
    # macOS
    brew services list
    
    # Linux
    sudo systemctl status mongod
    
  2. Check your MONGODB_URI in .env.local
  3. Ensure the database name doesn’t contain special characters
  4. For Atlas, verify your IP is whitelisted
If builds fail:
  1. Clear Turbo cache:
    rm -rf .turbo
    
  2. Clear node_modules and reinstall:
    rm -rf node_modules
    pnpm install
    
  3. Clear Next.js cache:
    rm -rf apps/*/. next
    
  4. Rebuild:
    pnpm build
    
If you encounter TypeScript errors:
  1. Run type checking:
    pnpm check-types
    
  2. Ensure all dependencies are installed:
    pnpm install
    
  3. Check that you’re using TypeScript 5.9.2 (specified in package.json)

Next Steps

Now that you have the Money monorepo running, explore the documentation:

Monorepo Structure

Understand the organization and architecture of the project

CashGap Guide

Learn about the personal finance management app

SecureVault Guide

Explore the password manager features

Development Setup

Set up your development environment in detail

Build docs developers (and LLMs) love