Monorepo with:
api/: Express + TypeScript + SQLite (better-sqlite3)app/: Angular 19 + Angular Material
- Node.js 20+
- npm 10+
npm run install:allUse two terminals:
Terminal 1 — API:
npm run apiTerminal 2 — Angular app:
npm run appDefault URLs:
- App:
http://localhost:4200 - API:
http://localhost:3000
npm run seedCreates the default admin account and category list. Safe to run on an existing DB — skips already-present rows.
npm run seed:demoWipes the database and fills it with realistic mock data — 4 editions, 15 competitions, 36 participants, ~400 registrations, and works for past years.
Demo credentials:
- Username:
admin - Password:
admin1234
npm run migrateImports legacy data from the SQL dump configured in api/src/config/migrate.ts.
If the imported data has no current-year registrations, the migration backfills them from the most recent available year.
Copy api/.env.example to api/.env and fill in the values:
PORT=3000
JWT_SECRET=change_me_in_production
JWT_EXPIRES_IN=8h
DB_PATH=./data/eistedglobal.db
CORS_ORIGIN=http://localhost:4200
PORT— defaults to3000if omitted.JWT_SECRET— must be a long random string in production.CORS_ORIGIN— must match the URL of the Angular app. Set tohttp://localhost:4200for local dev; update to your hosted frontend URL in production.
cd api && npm run build
cd ../app && npm run buildThe Angular production build output is at app/dist/app/browser/.
The included workflow (.github/workflows/deploy.yml) automatically builds and deploys the Angular frontend to GitHub Pages on every push to main.
Before deploying:
- Edit
app/src/environments/environment.prod.tsand replacehttps://YOUR_API_HOST/apiwith the URL of your hosted API. - Enable GitHub Pages in your repository: Settings → Pages → Source: GitHub Actions.
- Push to
main— the workflow runs automatically.
The deployed app URL will be https://<your-username>.github.io/<repo-name>/.
- Restart
ng serveafter changingapp/angular.json(styles and themes are not always hot-reloaded). - Keep
api/data/*.dbout of git — add it to.gitignore. Use the seed/migrate scripts to reproduce local data. - Use
seed:demofor UI demos and QA; usemigrateonly when validating legacy data import. - If Material styling looks inconsistent, verify the prebuilt theme is loaded first in
app/angular.json(understyles). - The API uses
better-sqlite3(synchronous). All queries are blocking — keep individual queries fast and avoid N+1 patterns in routes. - Angular standalone components — no
NgModuleneeded. Add new imports directly to the component'simportsarray. - JWT tokens are stored in
localStorageunder the keyeistedglobal_token. They expire based on theJWT_SECRETand signing options inapi/src/routes/auth.ts.