A unified full-stack web application for students attending SI sessions (at CSUF) to log attendance.
- Clone repo and open in VS Code dev container.
- Set env vars in
src/.env(see Environment Setup). - Build frontend and auto-copy to
src/static/:cd src/frontend npm install npm run build - Run locally (serves frontend + API):
cd ../src export FLASK_APP=index.py python -m flask run
- Deploy to production (run from
src/):cd /workspaces/si-attendance/src vercel --prod
Monorepo structure:
/src: Flask backend API/frontend: Svelte frontend
The backend requires three environment variables. Create a .env file in /src:
CREDS_JSON="<entire Google Service Account key as a JSON string>"
secretKioskUsername="<kiosk login username>"
secretKioskPassword="<kiosk login password>"CREDS_JSON format: Download a Service Account key from Google Cloud Console (JSON format), then paste its full contents as a single-line string:
{"type":"service_account","project_id":"...","private_key":"...","client_email":"..."}cd src
export FLASK_APP=index.py
python -m flask runcd frontend
npm install
npm run devcd frontend && npm run build # Build frontend static files
cd ../src
export FLASK_APP=index.py
python -m flask run # Serves frontend at / and API at /signin, /getcourses, etc.-
Set environment variables in Vercel Project Settings:
CREDS_JSONsecretKioskUsernamesecretKioskPassword
-
Deploy:
vercel deploy # Preview
vercel --prod # ProductionThe monorepo vercel.json automatically:
- Builds the Svelte frontend (
npm run build) - Deploys the Flask backend
- Routes
/signin,/getcourses,/noncwidsigninto the backend - Serves the frontend for all other paths
- Frontend lives in
src/frontend/(Svelte + Rollup) - Deployed static assets live in
src/static/alongside the backend - Vercel deploys from
src/usingvercel.jsonand includes files listed underincludeFiles
- Build the Svelte app and auto-copy build output to
src/static/:
cd src/frontend
npm install # first time only
npm run build # builds and copies files to ../static/The build step copies:
public/index.html,public/global.css,public/favicon.png→src/static/public/build/*→src/static/build/
- Commit updated static files:
cd ../../src
git add static/
git commit -m "Update frontend build"- Deploy from local (recommended in this repo):
cd /workspaces/si-attendance/src
vercel --prod- Edit Python files under
src/ - Commit changes
- Deploy (same command):
cd /workspaces/si-attendance/src
vercel --prodcd src/frontend && npm run build # produce static assets
cd ../src
export FLASK_APP=index.py
python -m flask run # serves static files from src/static and APIs- If the frontend doesn't load on Vercel:
- Ensure
src/static/containsindex.htmlandbuild/bundle.js - Verify
src/vercel.jsonhasincludeFilesentries forstatic/** - Deploy from
src/(not repo root):cd src && vercel --prod
- Ensure
- If you change Svelte code, always run
npm run buildbefore deploying.
- GET
/signin: Sign in a student- Query params:
cwid,course
- Query params:
- GET
/getcourses: Get available courses for a CWID- Query params:
cwid
- Query params:
- GET
/noncwidsignin: Log a non-CWID student- Query params:
course,nonCWIDStatus,name
- Query params:
- Make changes to
/frontend(Svelte) or/src(Flask) - Test locally
vercel deploy# Previewvercel --prod# Production
