This guide will walk you through every step needed to run the Glassbox application on your computer, even if you've never used development tools before.
To run Glassbox, you need to install these programs:
- Node.js - JavaScript runtime (required)
- pnpm - Package manager for installing dependencies (required)
- Python 3 - For portfolio calculations (required)
- PostgreSQL - Database for storing portfolios (required)
- Git - For downloading the project (optional, can download as ZIP instead)
Time Required: About 30-45 minutes for complete setup
Node.js allows you to run JavaScript on your computer (not just in a browser).
Option A: Using the Installer (Recommended)
- Visit https://nodejs.org/
- Click the "LTS" (Long Term Support) button to download - this is the stable version
- Open the downloaded
.pkgfile - Follow the installation wizard (click "Continue" and "Install")
- Enter your password when prompted
Option B: Using Homebrew (if you have it)
brew install node- Visit https://nodejs.org/
- Click the "LTS" button to download
- Open the downloaded
.msifile - Follow the installation wizard
- Important: Check the box "Automatically install the necessary tools" during installation
Open Terminal (macOS) or Command Prompt (Windows) and type:
node --versionYou should see something like v18.17.0 or higher.
Then check npm (comes with Node.js):
npm --versionYou should see something like 9.6.7 or higher.
✅ Success! Node.js is installed.
pnpm is a fast package manager that manages project dependencies efficiently.
In your Terminal/Command Prompt, run:
npm install -g pnpmWait for installation to complete (may take 1-2 minutes).
pnpm --versionYou should see something like 9.0.0 or higher.
✅ Success! pnpm is installed.
Python is needed for the portfolio optimization calculations.
Check if already installed:
python3 --versionIf you see Python 3.9.x or higher, you can skip to Step 4.
If not installed:
- Visit https://www.python.org/downloads/
- Click "Download Python 3.x.x" (get the latest version)
- Open the downloaded
.pkgfile - Follow the installation wizard
- Important: Check the box "Add Python to PATH" during installation
- Visit https://www.python.org/downloads/
- Click "Download Python 3.x.x"
- Open the downloaded
.exefile - IMPORTANT: Check the box "Add Python to PATH" at the bottom
- Click "Install Now"
- Follow the installation wizard
python3 --versionYou should see Python 3.9.x or higher.
Also verify pip (Python package installer):
pip3 --version✅ Success! Python is installed.
PostgreSQL is the database where your portfolios are stored.
Option A: Using Postgres.app (Easiest for beginners)
- Visit https://postgresapp.com/
- Click "Download"
- Open the downloaded file and drag Postgres.app to Applications
- Open Postgres.app from Applications
- Click "Initialize" to create a default database server
- The elephant icon will appear in your menu bar when running
Option B: Using Homebrew
brew install postgresql@15
brew services start postgresql@15- Visit https://www.postgresql.org/download/windows/
- Download the PostgreSQL installer
- Run the installer
- During installation:
- Remember your password (you'll need this!)
- Use default port 5432
- Click through the rest of the wizard
- Do NOT install Stack Builder when prompted at the end
psql --versionYou should see psql (PostgreSQL) 12.x or higher.
✅ Success! PostgreSQL is installed.
Install Git first (if not already installed):
- macOS:
brew install gitor download from https://git-scm.com/ - Windows: Download from https://git-scm.com/
Clone the repository:
# Navigate to where you want the project (e.g., Desktop)
cd ~/Desktop
# Clone the project
git clone <your-repository-url>
# Enter the project directory
cd glassbox- Go to your project's repository page
- Click the green "Code" button
- Click "Download ZIP"
- Extract the ZIP file to your desired location (e.g., Desktop)
- Open Terminal/Command Prompt and navigate to the folder:
cd ~/Desktop/glassbox✅ Success! Project downloaded.
Now we'll install all the JavaScript packages the project needs.
# Make sure you're in the glassbox directory
cd /path/to/glassbox
# Install all dependencies (this will take 3-5 minutes)
pnpm installYou'll see lots of text scrolling - this is normal! Wait for it to complete.
# Navigate to backend Python directory
cd apps/backend/python
# Install Python packages
pip3 install -r requirements.txtThis installs:
numpy- Math calculationspandas- Data processingyfinance- Stock market dataPyPortfolioOpt- Portfolio optimizationscipy- Scientific computingscikit-learn- Machine learning utilities
✅ Success! All dependencies installed.
For macOS (Postgres.app):
- Open Postgres.app (should be running with elephant icon in menu bar)
- Double-click on the default database to open psql
- In the psql terminal, run:
CREATE DATABASE glassbox;For macOS/Windows (command line):
# Create database
createdb glassbox
# Or use psql:
psql -U postgres
CREATE DATABASE glassbox;
\q# Go to backend directory
cd apps/backend
# Copy environment template
cp .env.example .env.local
# Open .env.local in a text editorEdit .env.local file with your database connection:
# Database
DATABASE_URL="postgresql://postgres:yourpassword@localhost:5432/glassbox"
# Change "yourpassword" to your actual PostgreSQL password
# If using Postgres.app on Mac, you might not need a password:
DATABASE_URL="postgresql://localhost:5432/glassbox"
# JWT Secret (can be any random string)
JWT_SECRET="your-super-secret-jwt-key-change-this"
# Google OAuth (optional - leave blank for now)
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GOOGLE_CALLBACK_URL="http://localhost:4000/auth/google/callback"# Still in apps/backend directory
# Generate Prisma client
pnpm prisma generate
# Create database tables
pnpm prisma migrate devYou should see messages about creating tables.
✅ Success! Database is set up.
Alternative to manual setup: If you prefer not to install Node.js, Python, and PostgreSQL separately, you can use Docker Compose to run everything in containers.
For macOS:
- Download Docker Desktop from https://www.docker.com/products/docker-desktop
- Open the
.dmgfile and drag Docker to Applications - Launch Docker from Applications
- You should see the Docker icon in the menu bar
For Windows:
- Download Docker Desktop from https://www.docker.com/products/docker-desktop
- Run the installer
- Docker will start automatically
From the root glassbox directory:
# Copy environment file
cp .env.example .env
# Build services with clear logs
./scripts/docker-build.sh
# Start all services (frontend, backend, PostgreSQL)
docker-compose up -d
# View live logs (optional)
docker-compose logs -f
# Access the application
# Frontend: http://localhost:3000
# Backend: http://localhost:4000
# API Docs: http://localhost:4000/api# Build all services
./scripts/docker-build.sh
# Build only frontend
./scripts/docker-build.sh frontend
# Build only backend
./scripts/docker-build.sh backenddocker-compose downNow everything is ready! Let's start the app.
From the root directory (glassbox/):
pnpm devThis starts both frontend and backend simultaneously using Turborepo.
Terminal 1 - Backend:
# From root directory
pnpm run be
# Backend will start on http://localhost:4000Terminal 2 - Frontend:
# From root directory (open a new terminal tab)
pnpm run fe
# Frontend will start on http://localhost:3000- Open your web browser
- Go to http://localhost:3000
- You should see the Glassbox landing page! 🎉
- Go to http://localhost:4000/api (Swagger API documentation)
- You should see the API documentation page
✅ Success! Glassbox is running!
- Click "Start Analysis" on the landing page
- Add stock tickers:
- Type "AAPL" (Apple) and enter a quantity (e.g., 10)
- Type "MSFT" (Microsoft) and enter a quantity (e.g., 20)
- Click "Add to Portfolio" for each
- Click "Analyze Portfolio"
- View your efficient frontier results and beta hedging recommendations!
- After viewing results, click "Save Portfolio"
- View saved portfolios in the "Portfolio Library" page
- Solution: Node.js not installed or not in PATH
- Reinstall Node.js and make sure to check "Add to PATH" option
- Solution: Run
npm install -g pnpmagain - May need to restart Terminal/Command Prompt
- macOS: Try
pythoninstead ofpython3 - Windows: Make sure "Add Python to PATH" was checked during installation
- Solution: PostgreSQL is not running
- macOS: Open Postgres.app and click "Start"
- Windows: Open Services, find PostgreSQL, and click "Start"
- Solution: Dependencies not fully installed
- Run
pnpm installagain from root directory - Run
pip3 install -r requirements.txtfromapps/backend/python
- Solution: Another app is using port 3000 or 4000
- Option 1: Stop the other application
- Option 2: Change port in code:
- Frontend: Edit
apps/web/package.json→ change port in dev script - Backend: Edit
apps/backend/src/main.ts→ change port number
- Frontend: Edit
- Solution: Python dependencies not installed
- Navigate to
apps/backend/pythonand run:pip3 install -r requirements.txt
- Solution: Run from
apps/backend:pnpm prisma generate
Press Ctrl + C in the terminal to stop all servers.
Press Ctrl + C in each terminal window running frontend/backend.
- Read the Documentation: Check
.claude/folder for product and design docs - Explore the API: Visit http://localhost:4000/api for Swagger docs
- Customize Settings: Edit environment variables in
apps/backend/.env.local - Build for Production: Run
pnpm buildwhen ready to deploy
# Start development
pnpm dev
# Start frontend only
pnpm run fe
# Start backend only
pnpm run be
# Install dependencies
pnpm install
# Build everything
pnpm build
# Docker - Build services
./scripts/docker-build.sh # All services
./scripts/docker-build.sh frontend # Frontend only
./scripts/docker-build.sh backend # Backend only
# Docker - Manage services
docker-compose up -d # Start services
docker-compose down # Stop services
docker-compose logs -f # View logs
# Database
cd apps/backend
pnpm prisma studio- Check individual README files in
apps/web,apps/backend, andapps/cli - Review documentation in
.claude/directory - Check that all prerequisites are installed correctly
- Make sure PostgreSQL is running before starting the backend
Congratulations! You've successfully set up and run Glassbox. Happy portfolio optimizing! 🎉📈