Skip to main content

Quickstart Guide

Get your local ForgeX development environment running with Docker Compose. From zero to first bid in under 10 minutes.


Prerequisites

tip

Before you begin, ensure you have:

  • Node.js v18 or higher (Download)
  • Docker Desktop (Download)
  • Git for version control
  • Google Cloud Console access for OAuth credentials
tip

Already have these? Skip to Installation.


Installation

1
Clone the Repository

Clone the ForgeX repository to your local machine:

git clone https://github.com/Site-Companies/PSS-Bid-Manager.git
cd PSS-Bid-Manager
2
Configure Google OAuth (for SuperTokens)

ForgeX uses SuperTokens with Google OAuth for authentication. You'll need Google OAuth credentials:

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable the Google+ API
  4. Create OAuth 2.0 Client ID credentials:
    • Application type: Web application
    • Authorized redirect URIs:
      • http://localhost:3000/auth/callback
      • http://localhost:3001/auth/callback
  5. Copy the Client ID and Client Secret
warning

Keep your OAuth credentials secure. Never commit them to version control.

3
Set Up Environment Files

Copy the example environment files:

# Bids Service Backend
cp services/bids/backend/.env.example services/bids/backend/.env

# Bids Service Frontend
cp services/bids/frontend/.env.example services/bids/frontend/.env

Edit services/bids/backend/.env with your credentials:

# Google OAuth
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret

# SuperTokens Core Connection
SUPERTOKENS_CONNECTION_URI=http://supertokens:3567
API_DOMAIN=http://localhost:5001
WEBSITE_DOMAIN=http://localhost:3000

# Database
DATABASE_URL=postgresql://postgres:devpassword@bids-db:5432/bids_db

# Node Environment
NODE_ENV=development

# Resend Email API (optional for local dev)
RESEND_API_KEY=re_xxxxxxxxxxxxx
EMAIL_FROM="Precision Platform <noreply@precisionsiteservices.com>"
tip

SuperTokens Core is included in the Docker Compose setup and will start automatically on port 3567.

4
(Optional) Set Up GCP Service Account

For file uploads to Google Cloud Storage (production feature):

gcloud iam service-accounts keys create ./gcp-key.json \
--iam-account=YOUR_SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com \
--project=YOUR_PROJECT_ID
note

Local development works without GCS. Skip this step if you're just testing locally.

The gcp-key.json file is gitignored automatically.

5
Start Docker Compose

Start all 10 containers (3 databases + 7 services):

docker-compose up -d

What's starting:

  • Databases: bids-db, projects-db, field-db (PostgreSQL)
  • Frontends: portal, bids-frontend, projects-frontend, field-frontend
  • Backends: bids-backend, projects-backend, field-backend
note

First-time startup takes 2-5 minutes to pull images and build containers. Grab a coffee! ☕

6
Run Database Migrations

Initialize the database schema:

docker-compose exec bids-backend npx prisma migrate dev

Seed the database with sample data:

docker-compose exec bids-backend npx prisma db seed

Sample data includes:

  • 2 test users (your Google account will be added on first login)
  • 5 clients with bids
  • Pricing catalog (concrete, rebar, equipment, materials)
  • Global variables (tax rates, overhead, profit)
7
Access ForgeX

Open your browser and navigate to:

ServiceURLPurpose
Portalhttp://localhost:3000Authentication & app launcher
Bidshttp://localhost:3001Bid management (main app)
Bids APIhttp://localhost:5001/apiBackend API
Projectshttp://localhost:3002Project management (Phase 2)
Fieldhttp://localhost:3003Field operations (Phase 3)
tip

Sign in with your Google account at http://localhost:3000

warning

First login: Your Google account won't have permissions yet. You'll see an "Unauthorized" message. Check the next step to grant access.

8
Grant Admin Access (First Time Only)

After your first login attempt, manually grant yourself admin access:

# Open Prisma Studio
cd services/bids/backend && npx prisma studio
  1. Navigate to the User table
  2. Find your user record (by email)
  3. Change role to ADMIN
  4. Change status to ACTIVE
  5. Save

Refresh the browser and sign in again. You now have full access! 🎉


Your First Bid

Let's create a sample bid to test the workflow:

1
Access the Bids App
  1. Sign in at http://localhost:3000
  2. Click the Bids tile
  3. You'll see the dashboard with sample bids
2
Create a Client
  1. Click "Add Client" in the top-right
  2. Fill in:
    • Company name: "Test Construction Co."
    • Contact name: "John Doe"
    • Email: "john@testco.com"
    • Phone: "(555) 123-4567"
  3. Click Save
3
Create a Bid
  1. Click "Add Bid"
  2. Fill in:
    • Client: Select "Test Construction Co."
    • Job Name: "Memorial Park Foundation"
    • Location: "Houston, TX"
    • Bid Number: "B-2025-001"
  3. Click Create Bid
4
Add a Scope
  1. Open your new bid
  2. Click "Add Scope"
  3. Fill in:
    • Name: "Foundation Slab"
    • Shape: SLAB
  4. Click Save
5
Add a Concrete Item
  1. Navigate to the Concrete tab
  2. Click "Add Concrete Item"
  3. Fill in:
    • Name: "Main slab"
    • Shape: SLAB
    • Length: 50 ft
    • Width: 40 ft
    • Depth: 6 in
    • Rebar Size: #4
    • Rebar Spacing: 12"
    • Check "Auto-add to Materials"
  4. Click Save

Watch the magic: Square feet, cubic yards, and costs calculate automatically! 🪄

6
Review Costs
  1. Go back to the bid summary
  2. View the cost breakdown:
    • Concrete module cost
    • Scope total (with multiplier applied)
    • Bid total (with overhead + profit)

Congratulations! You just created your first ForgeX bid. 🎉


Development Workflow

Hot Reload

All frontend services support hot module replacement (HMR):

# Edit a file in services/bids/frontend/src/
# Save → Browser automatically refreshes
tip

VSCode users: Install the Prisma extension for schema syntax highlighting.

Making Backend Changes

After editing Prisma schema or backend code:

# Rebuild the backend container
docker-compose up -d --build bids-backend

# Create a new migration (if schema changed)
docker-compose exec bids-backend npx prisma migrate dev --name your-migration-name

# Regenerate Prisma client
docker-compose exec bids-backend npx prisma generate

Database Access

Option 1: Prisma Studio (Recommended)

cd services/bids/backend && npx prisma studio

Opens a browser-based GUI at http://localhost:5555

Option 2: psql (Terminal)

docker-compose exec bids-db psql -U postgres -d bids_db

Option 3: TablePlus / pgAdmin

Host: localhost
Port: 5432
Database: bids_db
User: postgres
Password: devpassword

Troubleshooting

Port Already in Use

Error: Bind for 0.0.0.0:3001 failed: port is already allocated

Solution:

  1. Check for conflicting processes:
lsof -i :3001
  1. Stop the conflicting service or change the port in docker-compose.yml
  2. Restart Docker Compose:
docker-compose down && docker-compose up -d
OAuth Fails

Error: "Invalid credentials" or redirect fails

Solutions:

  • Verify GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET in .env
  • Check authorized redirect URIs in Google Cloud Console:
    • http://localhost:3000/auth/callback
    • http://localhost:3001/auth/callback
  • Ensure you're using a web application OAuth client (not iOS/Android)
Database Migration Errors

Error: "Migration failed" or "Table already exists"

Solutions:

  • Reset the database (⚠️ deletes all data):
docker-compose down -v
docker-compose up -d
docker-compose exec bids-backend npx prisma migrate dev
docker-compose exec bids-backend npx prisma db seed
  • Check migration status:
docker-compose exec bids-backend npx prisma migrate status
Container Won't Start

Error: Container exits immediately or logs show errors

Solutions:

  • View logs:
docker logs bidmanager-bids-backend
  • Check environment variables:
docker-compose exec bids-backend env | grep GOOGLE
  • Rebuild containers:
docker-compose up -d --build
Hot Reload Not Working

Error: Frontend changes don't reflect in browser

Solutions:

  • Check volume mounts in docker-compose.yml:
volumes:
- ./services/bids/frontend:/app
- /app/node_modules
  • Restart the frontend container:
docker-compose restart bids-frontend
  • Clear browser cache (Ctrl+Shift+R or Cmd+Shift+R)

Quick Reference Commands

# Start all services
docker-compose up -d

# Stop all services
docker-compose down

# View logs (follow mode)
docker logs -f bidmanager-bids-backend

# Restart a single service
docker-compose restart bids-backend

# Rebuild after code changes
docker-compose up -d --build bids-backend

# Access database
docker-compose exec bids-db psql -U postgres -d bids_db

# Open Prisma Studio
cd services/bids/backend && npx prisma studio

# Run migrations
docker-compose exec bids-backend npx prisma migrate dev

# Seed database
docker-compose exec bids-backend npx prisma db seed

# Reset database (⚠️ deletes data)
docker-compose down -v && docker-compose up -d

What's Next?


note

Need help? Check the Troubleshooting section or review the full architecture.