建國中學班聯會憲章、法律、命令與公文之中央資料庫 — the central database for the constitution, laws, orders and official documents (公文) of the Chien Kuo High School student council.
Live site: law.cksc.tw
- Legislation (法律) — browse and full-text search the constitution, laws and orders, view each clause's amendment history, and draft and submit amendment requests for review.
- Documents (公文) — publish official documents with confidentiality levels and per-role access, email them to a mailing list, and follow judicial cases (訴訟查詢) document by document.
- Management (
/manage) — signed-in council officers edit legislation and documents, review amendments, and manage accounts, roles and the mailing list. - MCP server (
/mcp) — AI tools (Claude, ChatGPT, Cursor, …) can search and read the laws, their past versions, the public documents and judicial cases. Addhttps://law.cksc.tw/mcpas a remote MCP server; it is read-only and needs no sign-in.
- Quasar v2 + Vue 3 + TypeScript, server-side rendered
- Firebase: Firestore, Auth (Google sign-in), Cloud Functions, Hosting; SSR server on Cloud Run
- Algolia for legislation search
- Sentry for error reporting (optional — off when no DSN is set)
Requires Node.js 24 (.nvmrc names the version CI runs; nvm use or fnm use picks it up) and Yarn 1.x. The app, src-ssr/ and functions/ are three packages with a lockfile each; the first yarn install at the root does the app, and yarn build installs src-ssr/ itself.
yarn install # also runs `quasar prepare`, which generates .quasar/ and the real tsconfig
yarn dev # dev server with SSR and hot reloadRun yarn install before opening the project in an editor; TypeScript path aliases don't resolve until .quasar/ exists.
The dev server runs in SSR mode, so code that touches window or other browser globals must be guarded (see CLAUDE.md).
| Task | Command |
|---|---|
| Dev server (SSR) | yarn dev |
Production SSR build → dist/ssr/ |
yarn build |
SPA build → dist/spa/ |
yarn spa-build |
Lint (app, src-ssr/, tests) |
yarn lint |
| Unit + component tests | yarn test |
| Firestore rules tests (emulator) | yarn test:rules |
| Format | yarn format |
| Build / lint / test Cloud Functions | cd functions && yarn build && yarn lint && yarn test |
Tests are Vitest: yarn test for unit and component tests, yarn test:rules for firestore.rules against the Firestore emulator (needs a JDK 21+), and cd functions && yarn test for the Cloud Functions. yarn build also typechecks (vue-tsc, tests included) and lints as part of the build.
| Path | Contents |
|---|---|
src/ |
The app: pages, components, Pinia stores, router, boot files |
src/ts/models.ts, src/ts/models/ |
Data models and the "enum class" types — shared with Cloud Functions |
src/ts/model-converters.ts |
Firestore converters and data-access helpers |
src/ts/*-reads.ts, src/ts/document-*.ts |
Store reads (loaded on demand), the document list's query and permissions |
src-ssr/ |
SSR server and middleware (its own package.json) |
functions/ |
Firebase Cloud Functions (its own package.json, CommonJS) |
.github/, .nvmrc |
CI workflows, the shared setup action and the Node version they all use |
firestore.rules / firestore.indexes.json |
Access control and composite indexes |
firebase.json |
Hosting rewrites that split traffic between Cloud Run and the SPA |
scripts/ |
One-off tooling (e.g. the Kai webfont generator) |
test/ |
Unit, component and Firestore-rules tests (Functions tests: functions/test/) |
docs/ |
Reference notes (the legislation subsystem) |
One Firebase Hosting site (cksc-law, serving law.cksc.tw) fronts two builds:
- Public read pages (
/,/legislation/**,/document/**,/about,/sitemap.xml) are server-rendered by Cloud Run. /mcpgoes to themcpCloud Function. Deploy functions before merging a change that first routes to it, or the Hosting deploy points at a service that does not exist yet.- Everything else, including
/manage, falls back to the static SPA.
| What | How |
|---|---|
| Hosting + Cloud Run | Automatic on push to main (firebase-hosting-merge.yml; tests first, and a push that only touches docs or functions/ does not deploy it) |
| Cloud Functions | Manual: Actions → Deploy Cloud Functions (manual) → Run workflow |
| Firestore indexes | Manual: firebase deploy --only firestore:indexes — run it and wait for the indexes to finish building before merging a change that needs them |
The second Hosting site, cksc-legislation, is a legacy domain that 301-redirects everything to law.cksc.tw. Don't deploy to it.
- CLAUDE.md — architecture, conventions and gotchas (the most complete reference)
- docs/legislation-subsystem.md — the legislation subsystem in depth