Skip to content

Local Setup ​

Clone and configure the project.

Clone Repository ​

bash
git clone <repository-url> sdasis
cd sdasis

Backend Setup ​

Install Go Dependencies ​

bash
cd sis_backendgo
go mod download

Configure Environment ​

Copy or create the .env file in sis_backendgo/:

bash
# 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=false

Database Setup ​

  1. Restore a dump into a fresh sis:
powershell
psql -h localhost -U postgres -c "CREATE DATABASE sis;"
pg_restore -h localhost -U postgres -d sis --no-owner --no-privileges db\sis_<timestamp>.dump

Do 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.

  1. Bring the schema up to the repo, and record what the dump already had:
powershell
# 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 -Apply

A 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:

bash
# Docker (Valkey)
docker run -d -p 6379:6379 valkey/valkey:8

# Docker (Redis)
docker run -d -p 6379:6379 redis:alpine

Verify Setup ​

bash
cd sis_backendgo
go build ./...

Run Backend ​

bash
# With hot reload (recommended for development)
cd sis_backendgo
air

# Without hot reload
cd sis_backendgo
go run ./cmd/api/main.go

The API will be available at http://localhost:8000/api/v1/.

Frontend Setup ​

Install Dependencies ​

bash
cd sis_frontend
npm install

Configure 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:

bash
# sis_frontend/.env.local (optional)
VITE_API_BASE_URL=http://localhost:8000/api/v1

Verify Setup ​

bash
npm run build

Run Frontend ​

bash
npm run dev

The frontend will be available at http://localhost:5173.

Quick Start Script ​

Use the provided PowerShell script:

powershell
# Start both servers
.\start-dev.ps1

# Backend only
.\start-dev.ps1 -BackendOnly

# Frontend only
.\start-dev.ps1 -FrontendOnly

Student Information System Documentation