Complete setup instructions for getting CredoPass running locally and in production.
CredoPass is an event attendance tracking system (not a ticketing system) designed for organizations that need detailed check-in/check-out data. Perfect for churches, clubs, recurring meetups, and events where attendance tracking matters more than ticket sales.
- Prerequisites
- Initial Setup
- Environment Configuration
- Database Setup
- Development Servers
- IDE Configuration
- Troubleshooting
-
Bun (>= 1.3.0)
# macOS/Linux curl -fsSL https://bun.sh/install | bash # Or with Homebrew (macOS) brew install oven-sh/bun/bun # Verify installation bun --version # Should show 1.3.0 or higher
-
Docker (for PostgreSQL)
- macOS: Docker Desktop
- Linux: Docker Engine
# Verify installation docker --version docker-compose --version -
Node.js (optional, for compatibility)
- Bun can handle most Node.js workflows
- Only needed if you encounter compatibility issues
-
Git
git --version
-
Google Cloud SDK (for Cloud Run deployment)
# macOS brew install google-cloud-sdk # Verify gcloud --version
-
Vercel CLI (for frontend deployment)
bun add -g vercel
git clone <repository-url>
cd credopass# Install all workspace dependencies
bun install
# This will:
# - Install root dependencies
# - Install dependencies for apps/web
# - Install dependencies for services/core
# - Install dependencies for packages/lib
# - Install dependencies for packages/ui# Check Nx is available
bunx nx --version
# List all projects
bunx nx show projects
# Should show:
# - web
# - coreservice
# - lib
# - uiCreate a .env file in the project root:
# Copy from example (if exists)
cp .env.example .env
# Or create manually
touch .envAdd the following to .env:
#############################
# Database Configuration
#############################
DATABASE_URL=postgresql://postgres:Ax!rtrysoph123@localhost:5432/credopass_db
#############################
# API Configuration
#############################
API_BASE_URL=http://localhost:3000
NODE_ENV=development
PORT=3000
#############################
# Frontend Configuration
#############################
VITE_API_BASE_URL=http://localhost:3000
#############################
# Optional Features
#############################
# Enable throttle middleware (adds 1s delay to API requests for testing)
THROTTLE=false
# Enable debug logging
DEBUG=trueNODE_ENV=development
DATABASE_URL=postgresql://postgres:Ax!rtrysoph123@localhost:5432/credopass_db
API_BASE_URL=http://localhost:3000NODE_ENV=production
DATABASE_URL=<production-postgresql-url>
API_BASE_URL=https://api.credopass.comThe project uses Docker Compose to run PostgreSQL locally.
# Start PostgreSQL in detached mode
bun run postgres:up
# This runs:
# docker-compose -f docker/docker-compose.yml up -dWhat this does:
- Starts PostgreSQL 16 container
- Maps port 5432 to localhost
- Creates
credopass_dbdatabase - Credentials:
postgres/Ax!rtrysoph123 - Data persisted in Docker volume
postgres_data
# Check container is running
docker ps
# Should see:
# CONTAINER ID IMAGE STATUS
# <id> postgres:16-alpine3.23 Up X secondsTest connection (optional):
# Using psql (if installed)
psql -h localhost -p 5432 -U postgres -d credopass_db
# Password: Ax!rtrysoph123# Apply all pending migrations
nx run coreservice:migrate
# This runs:
# cd services/core && bun drizzle-kit migrateWhat migrations do:
- Create
userstable - Create
eventstable - Create
attendancetable - Create
loyaltytable - Create indexes for performance
# Open Drizzle Studio (database UI)
nx run coreservice:studio
# Opens: http://localhost:4983
# Browse tables, view data, run queries# If seed script exists
nx run coreservice:seed
# Or manually insert test data via Drizzle Studio# Stop PostgreSQL
bun run postgres:down
# Restart PostgreSQL
bun run postgres:down && bun run postgres:up
# View logs
docker logs -f <container-id>
# Delete all data (destructive!)
bun run postgres:down --volumes# Option 1: Start both frontend and backend in separate terminals
# Terminal 1: Frontend (localhost:5173)
nx run web:serve
# Terminal 2: Backend (localhost:3000)
nx run coreservice:start# Option 2: Start both in parallel (if configured)
nx run-many --target=serve --projects=web,coreservice --parallel# Start web app
nx run web:serve
# Output:
# VITE v7.3.0 ready in 542 ms
#
# ➜ Local: http://localhost:5173/
# ➜ Network: use --host to expose
# ➜ press h + enter to show help
# Features:
# - Hot Module Replacement (HMR)
# - React Fast Refresh
# - API proxy to localhost:3000Available at: http://localhost:5173
Routes:
/- Home/Dashboard/members- Members management/events- Events calendar/analytics- Analytics dashboard/database- Database tables viewer
# Start API server
nx run coreservice:start
# Output:
# 🚀 Server running on http://localhost:3000
# Features:
# - Auto-restart on file changes (--watch)
# - CORS enabled for localhost:5173
# - Logger middleware
# - Hot reload with BunAvailable at: http://localhost:3000
Endpoints:
GET /api/health- Health checkGET /api/users- List usersGET /api/events- List eventsGET /api/attendance- List attendance recordsGET /api/loyalty- List loyalty points
# Test backend health check
curl http://localhost:3000/api/health
# Should return:
# {"status":"ok","timestamp":"2026-01-11T..."}
# Test frontend
open http://localhost:5173
# Should load CredoPass home pageInstall Extensions:
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"oven.bun-vscode",
"ms-azuretools.vscode-docker"
]
}Settings (.vscode/settings.json):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}Tasks (.vscode/tasks.json):
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Web",
"type": "shell",
"command": "nx run web:serve",
"problemMatcher": [],
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Start API",
"type": "shell",
"command": "nx run coreservice:start",
"problemMatcher": [],
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}-
Enable Bun Support:
- Settings → Languages & Frameworks → Node.js
- Set package manager to "Bun"
-
TypeScript Configuration:
- Use TypeScript from
node_modules/typescript
- Use TypeScript from
-
Run Configurations:
- Create "Bun" run config for
nx run web:serve - Create "Bun" run config for
nx run coreservice:start
- Create "Bun" run config for
Problem: Port 5173 or 3000 already taken
# Find process using port
lsof -i :5173
lsof -i :3000
# Kill process
kill -9 <PID>
# Or use different port
PORT=3001 nx run coreservice:startProblem: Error: connect ECONNREFUSED 127.0.0.1:5432
Solutions:
# Check PostgreSQL is running
docker ps | grep postgres
# If not running, start it
bun run postgres:up
# Check DATABASE_URL is correct
echo $DATABASE_URL
# Test connection
docker exec -it <container-id> psql -U postgres -d credopass_dbProblem: Error: relation "users" already exists
Solutions:
# Reset database (destructive!)
bun run postgres:down --volumes
bun run postgres:up
nx run coreservice:migrate
# Or use Drizzle Studio to manually fix
nx run coreservice:studioProblem: Cannot find module '@credopass/lib'
Solutions:
# Rebuild workspace
bun install
# Clear Nx cache
nx reset
# Rebuild packages
nx run lib:build
nx run ui:buildProblem: Backend not restarting on file changes
Solution:
# Use --watch flag explicitly
bun --watch --no-clear-screen services/core/src/index.tsProblem: Red squiggly lines, "Cannot find type definitions"
Solutions:
# Restart TypeScript server
# VS Code: Cmd+Shift+P → "TypeScript: Restart TS Server"
# Verify tsconfig.json paths
cat tsconfig.base.json | grep paths
# Ensure packages are built
nx run-many --target=build --projects=lib,uiProblem: Access-Control-Allow-Origin errors in browser console
Solutions:
# Verify Vite proxy is configured (apps/web/vite.config.ts)
# Verify backend CORS allows localhost:5173
# Check services/core/src/index.ts CORS middleware# Stop and remove all data
bun run postgres:down --volumes
# Start fresh
bun run postgres:up
# Run migrations
nx run coreservice:migrate# Using psql
docker exec -it <container-id> psql -U postgres -d credopass_db
# List tables
\dt
# Describe table
\d users
# Query data
SELECT * FROM users;# Clear Nx cache
nx reset
# Clear Bun cache
rm -rf node_modules/.cache
# Reinstall dependencies
rm -rf node_modules
bun install# Disable throttle middleware
echo "THROTTLE=false" >> .env
# Check Vite config for excessive plugins
cat apps/web/vite.config.tsAfter successful setup:
- Explore the codebase: Start with ARCHITECTURE.md
- Review database schema: See DATABASE.md
- Test API endpoints: Check API.md
- Deploy to production: Follow DEPLOYMENT.md
- Documentation: See
/docsdirectory - Nx Commands: Run
nx help - Project Structure: See README.md
- Architecture: See ARCHITECTURE.md