5-Minute Quickstart¶
Get CalcBridge running and execute your first compliance test in just 5 minutes. This guide covers the fastest path to a working environment.
Prerequisites
- Docker and Docker Compose installed
- Git installed
- 5 minutes of your time
Step 1: Clone and Start Services¶
Clone the repository and start the infrastructure with a single command:
# Clone the repository
git clone https://github.com/InsightCapital/calcbridge.git
cd calcbridge
# Start PostgreSQL and Valkey
docker compose up -d postgres valkey
# Wait for services to be healthy (about 10 seconds)
docker compose ps
Expected Output
Step 2: Set Up Python Environment¶
Create a virtual environment and install dependencies:
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[dev,test]"
# Copy environment file
cp .env.example .env
Step 3: Initialize the Database¶
Run the database migrations to set up the schema:
# Apply all migrations
for migration in db/migrations/V*.sql; do
PGPASSWORD=calcbridge_dev psql -h localhost -p 5433 -U calcbridge -d calcbridge -f "$migration"
done
Alternative: Single Command
Step 4: Start the API Server¶
Launch the FastAPI server with hot reload:
Server Running
You should see:
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process
Open http://localhost:8000/docs to see the API documentation.
Step 5: Create Your Account¶
Register a new user and organization:
import requests
response = requests.post(
"http://localhost:8000/api/v1/auth/register",
json={
"email": "analyst@example.com",
"password": "SecurePass123!",
"full_name": "Jane Analyst",
"organization_name": "Acme Capital"
}
)
tokens = response.json()
print(f"Access Token: {tokens['access_token'][:50]}...")
Response
Save your access token for the next steps:
Step 6: Upload Your First Workbook¶
Upload an Excel file with your portfolio data:
import requests
with open("sample_portfolio.xlsx", "rb") as f:
response = requests.post(
"http://localhost:8000/api/v1/workbooks/upload",
headers={"Authorization": f"Bearer {TOKEN}"},
files={"file": f}
)
workbook = response.json()
print(f"Workbook ID: {workbook['id']}")
print(f"Sheets: {workbook['sheet_count']}")
print(f"Rows: {workbook['row_count']}")
Response
Step 7: Run a Quick Compliance Test¶
Evaluate a formula to test your data:
curl -X POST http://localhost:8000/api/v1/calculations/evaluate \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"formula": "=SUM(1, 2, 3, 4, 5)",
"context": {}
}'
Step 8: View Your Data¶
List the sheets in your workbook and fetch data:
# Get workbook details
curl -H "Authorization: Bearer $TOKEN" \
http://localhost:8000/api/v1/workbooks/$WORKBOOK_ID
# List sheets
curl -H "Authorization: Bearer $TOKEN" \
http://localhost:8000/api/v1/workbooks/$WORKBOOK_ID/sheets
# Get sheet data (first 100 rows)
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:8000/api/v1/workbooks/$WORKBOOK_ID/sheets/Holdings/data?page=1&page_size=100"
What's Next?¶
Congratulations! You've successfully set up CalcBridge and uploaded your first workbook. Here's what to explore next:
-
Compliance Testing
Learn how to configure and run automated compliance test suites.
-
What-If Scenarios
Simulate trades and see compliance impact before execution.
-
Workbook Deep Dive
Learn about Excel parsing, formulas, and data management.
-
API Reference
Explore the complete REST API documentation.
Quick Reference¶
Default Ports¶
| Service | Port | URL |
|---|---|---|
| API Server | 8000 | http://localhost:8000 |
| API Docs | 8000 | http://localhost:8000/docs |
| PostgreSQL | 5433 | localhost:5433 |
| Valkey | 6380 | localhost:6380 |
| Frontend | 3002 | http://localhost:3002 |
Useful Commands¶
# Check service health
curl http://localhost:8000/health
# View API documentation
open http://localhost:8000/docs
# Stop all services
docker compose down
# View logs
docker compose logs -f api
Troubleshooting¶
Common Issues
Port already in use?
# Find process using port 8000
lsof -i :8000
# Kill it or use a different port
PYTHONPATH=. uvicorn src.api.main:app --reload --port 8001
Database connection failed?
# Check if PostgreSQL is running
docker compose ps postgres
# Restart if needed
docker compose restart postgres
Import errors?
For more detailed troubleshooting, see the Troubleshooting Guide.