CollabTable is a collaborative list/table system: a Go server holding lists with custom-typed, ordered columns (fields) and rows (items), a SvelteKit web dashboard for browsing that data, and a native Android app (Jetpack Compose, offline-first with Room) that syncs against the server's HTTP API. It's built for things like shopping lists with price tracking, product catalogs, or any structured data collection that several people and devices need to keep in sync.
---
## Tech Stack
| Layer | Technology |
|-------|------------|
| Database | PostgreSQL |
| Backend | Go (`net/http`) |
| Web dashboard | SvelteKit (static SPA, embedded in the Go binary) |
shared/ Design system and backend helpers shared with sibling projects
```
---
## Configuration
CollabTable's browser dashboard authenticates through AuthGuard, a centralized identity service shared across projects (`AUTHGUARD_URL`): create a username, email, and password on first launch, then sign in with the username or email. AuthGuard hashes passwords and issues the `auth_session` cookie the browser holds; CollabTable itself stores no account credentials, only a small local flag recording that its one-time setup screen has run. Unlike the single-admin-tool projects in this workspace, CollabTable is a genuinely multi-user app that already supported full admin user management (list/create/edit/delete accounts, assign roles) before this integration — that maps directly onto AuthGuard's own `/api/admin/users` endpoints, which CollabTable proxies to rather than re-implementing the same authorization rules locally.
-`AUTHGUARD_URL` unset, `AUTH_DISABLED` unset/false (the default) — "pending": auth stays fully enabled/gated, waiting for ProjectConfigurator to push a live URL (see below), and fails closed on auth calls until one arrives.
-`AUTH_DISABLED=true` — browser-session gates are off. List access still requires membership; the placeholder identity used in this mode has no memberships, so dashboard data is empty and sync tokens minted for it are rejected. Use this only to develop the auth shell, not for a working data deployment.
Because AuthGuard doesn't know "this is CollabTable's initial account" and can't answer "have any accounts been registered yet" (it's a shared identity store other projects and other CollabTable instances may already use), the one-time setup screen is instead gated by a small local flag in Postgres, independent of AuthGuard's own state.
`AUTHGUARD_URL` and `CARRIERNODE_URL` are also only the bootstrap fallback: once CollabTable is registered in ProjectConfigurator's Projects workspace, ProjectConfigurator pushes both values here automatically (`PUT /api/core-services/internal`, `X-Internal-Auth`-gated with `SECRET`) and keeps them current with no restart — see `Core/ProjectConfigurator/README.md`'s "Pushing core service info to other projects". This means `AUTHGUARD_URL` no longer needs to be set at all for a registered deployment: it stays "pending" until the first push. A push never overrides `AUTH_DISABLED=true`; it only ever retargets an already-enabled AuthGuard connection. CarrierNode isn't used by any feature here yet, but the client is wired and ready.
The device-sync API token (generated from the dashboard's Settings page, used by the Android app's `Authorization: Bearer` header for `/api/lists`, `/api/fields`, `/api/items`, `/api/sync`, and notification polling) is unrelated to AuthGuard and unaffected by whether it's configured: it's a long-lived per-account credential for a user's own devices, not a browser session, and stays entirely local to CollabTable's own Postgres.
| Variable | Required | Default | Description |
|----------|----------|---------|--------------|
| `DATABASE_URL` | Yes | — | PostgreSQL connection string (bring your own instance) |
| `AUTHGUARD_URL` | No | unset (pending) | Optional bootstrap/override base URL of the AuthGuard identity service. Leaving it unset does not disable authentication — it leaves the service "pending" until ProjectConfigurator pushes a URL, failing closed on auth calls until then. Use `AUTH_DISABLED` to actually turn auth off. |
| `AUTH_DISABLED` | No | `false` | Set `true` to disable browser-session gates. List access remains membership-scoped; the placeholder identity has no memberships and its sync tokens are rejected. Use only for auth-shell development, not for a working data deployment. |
| `SECRET` | Yes, unless `AUTH_DISABLED=true` | unset | Shared secret, the same value CarrierNode/ProjectConfigurator were configured with, checked against `X-Internal-Auth` on `PUT /api/core-services/internal` and `PUT /api/auth/access/internal`. Without it, `GET /api/auth/status` reports `SECRET environment variable is not set.` and every auth-gated route returns 500, and the internal endpoints refuse every caller. |
| `ALLOWED_ORIGINS` | No | unset | Comma-separated browser origins that may call the API cross-origin with credentials. Leave unset: the dashboard is same-origin and needs no CORS. |
| `COOKIE_SECURE` | No | `false` | Set `true` once served over HTTPS. It marks only the cookies CollabTable clears on logout as `Secure`; the session cookie's `Secure`, `SameSite` and `Domain` attributes are set by AuthGuard. |
| `TRUSTED_PROXIES` | No | unset | Comma-separated IPs or CIDR ranges of reverse proxies. `X-Forwarded-For` (client IP for rate limits) and `X-Forwarded-Proto` are read only from these peers. |
| `PRODUCTION` | No | `false` | Set `true` to refuse plain HTTP: requests must arrive over TLS or through a `TRUSTED_PROXIES` proxy sending `X-Forwarded-Proto: https`. Requires `TRUSTED_PROXIES`. With `false`, the server logs a warning that TLS is off. |
| `OMNILOGGER_URL` | No | unset | Optional initial base URL of the OmniLogger log sink. Server log lines are also sent there when it and `OMNILOGGER_INGEST_TOKEN` are both set; console output is unchanged. ProjectConfigurator's push can supply or replace it at runtime. The `remap-users` command is not shipped. |
| `OMNILOGGER_INGEST_TOKEN` | No | unset | Optional initial ingest token for this service (`collabtable`). ProjectConfigurator normally supplies the token at runtime through its core-services push, which also starts shipping. Shipping stays off until both a URL and a token are known. |
Open **http://\<host\>:8080**, complete setup (this registers the first account against AuthGuard), then generate a device-sync API token from the dashboard's Settings page for the Android app.
The shared `@gabriel20xx/web-ui` package must be built once before the dashboard can resolve it (it's a `file:` dependency resolved from its built `dist/` output, which is intentionally not committed — see `shared/README.md`):
```bash
cd shared
npm install
cd ../frontend
npm install
npm run dev # Vite dev server on :5173
```
Other frontend scripts: `npm run build`, `npm run format`.
Open `CollabTableAndroid` in Android Studio, let Gradle sync, and run on an emulator or device. In the app's Settings, point it at the backend (`http://10.0.2.2:8080/api/` for an emulator) with the API token generated from the dashboard.
Android: `./gradlew build`, `./gradlew ktlintCheck`, `./gradlew detekt` from `CollabTableAndroid`.
---
## CI/CD
Every push runs three GitHub Actions workflows against the backend and frontend (the Android app has no CI in this repo):
- **`docker.yml`** — builds a multi-arch image (`linux/amd64` + `linux/arm64` on `main`, `linux/amd64` otherwise) from `docker/Dockerfile` and pushes `${DOCKERHUB_USERNAME}/collabtableserver` to Docker Hub on pushes to `main`, tagged by branch name, `sha-<short-sha>`, and `latest`.
- **`lint.yml`** — runs `npm run lint` (ESLint) against `frontend`.
- **`tests.yml`** — runs `go test ./...` against `backend` (with a PostgreSQL service container, so the database-backed tests run) and `npm test` and `npm run check` against `frontend`.