Local Setup
Clone and configure the project.
Clone Repository
git clone <repository-url> sdasis
cd sdasisBackend Setup
Install Go Dependencies
cd sis_backendgo
go mod downloadConfigure Environment
Copy or create the .env file in sis_backendgo/:
# Server
SERVER_PORT=8000
SERVER_HOST=0.0.0.0
ENVIRONMENT=development
# Database (PostgreSQL via lib/pq)
DB_HOST=127.0.0.1
DB_PORT=5433
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=sis
DB_SSLMODE=disable
DB_MAX_CONNS=25
# Valkey/Redis (required for sessions)
REDIS_URL=localhost:6379
REDIS_PASSWORD=
REDIS_DB=0
# Sessions
SESSION_TTL=4h
SESSION_SLIDING_EXPIRATION=true
# CORS
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
CORS_ALLOW_CREDENTIALS=true
# Cookies
COOKIE_DOMAIN=
COOKIE_PATH=/api
COOKIE_SECURE=false
# Photo Storage
PHOTO_STORAGE_PATH=./photos
PHOTO_MAX_SIZE_MB=2
# Email (Mailpit for development)
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_FROM=no-reply@puc.edu
SMTP_USE_TLS=falseDatabase Setup
- Restore a dump into a fresh
sis:
psql -h localhost -U postgres -c "CREATE DATABASE sis;"
pg_restore -h localhost -U postgres -d sis --no-owner --no-privileges db\sis_<timestamp>.dumpDo not replay database/migrations/*.sql from the start
Several files reference tables and columns that later migrations renamed away, some hardcode surrogate IDs from the database they were generated against, and several have unguarded bulk INSERTs. A loop over the directory will fail partway through and leave a half-built schema. A dump is the only way to stand up a new database.
- Bring the schema up to the repo, and record what the dump already had:
# If the dump predates the migration ledger, declare its vintage once.
.\scripts\db-migrate.ps1 -Baseline
# Then apply anything the repo has that this database does not.
.\scripts\db-migrate.ps1 -ApplyA dump carries core.schema_migrations with it, so a recent dump already knows what it has and step 2 will usually just report a couple of pending files. See Migrations.
Start Valkey/Redis
Valkey/Redis must be running for the session-based authentication to work:
# Docker (Valkey)
docker run -d -p 6379:6379 valkey/valkey:8
# Docker (Redis)
docker run -d -p 6379:6379 redis:alpineVerify Setup
cd sis_backendgo
go build ./...Run Backend
# With hot reload (recommended for development)
cd sis_backendgo
air
# Without hot reload
cd sis_backendgo
go run ./cmd/api/main.goThe API will be available at http://localhost:8000/api/v1/.
Frontend Setup
Install Dependencies
cd sis_frontend
npm installConfigure Environment
The frontend uses a Vite proxy to forward API requests to the backend, so cookies work correctly on the same origin. In most cases, no .env.local file is needed for development.
If you need to override the API URL:
# sis_frontend/.env.local (optional)
VITE_API_BASE_URL=http://localhost:8000/api/v1Verify Setup
npm run buildRun Frontend
npm run devThe frontend will be available at http://localhost:5173.
Quick Start Script
Use the provided PowerShell script:
# Start both servers
.\start-dev.ps1
# Backend only
.\start-dev.ps1 -BackendOnly
# Frontend only
.\start-dev.ps1 -FrontendOnly