Dough Git

clove/system

README.md

back to tree

# Doughmination System

A real-time plural system tracker for the Doughmination System — current fronters,
system members, and switching patterns. Member data lives in this site's own API and
D1 database, so pages render fresh on every request.

## Tech stack

- [SvelteKit](https://svelte.dev/docs/kit) (Svelte 5)
- Plain CSS, shared with [doughmination.gay](https://doughmination.gay)
- Its own API (Hono, D1, R2) at `/api/plural`, with a small typed client in `src/lib/api.ts` and a live socket
- Deployed to **Cloudflare Workers** via `@sveltejs/adapter-cloudflare`

## Read API data as JPCL

Data GET endpoints under `/api/plural` return JPCL text by default. Add
`?format=json` for JSON or `?format=yml` for YAML. Use `&format=json` or
`&format=yml` when the URL already has query parameters.

The JPCL responses for `/members`, `/switches`, and `/users` wrap their arrays
under the corresponding `members`, `switches`, and `users` keys. Those routes
return bare arrays in JSON and YAML. In JavaScript, parse JPCL with `loads`
from `jpcl-lang/core`.

## Local development

```bash
bun install
bun run dev
```

Runs the Vite dev server at http://localhost:5173.

To preview in the real Workers runtime (closer to production):

```bash
bun run preview
```

## Deploy

```bash
bun run deploy
```

This runs `vite build` and then `wrangler deploy`. Worker config lives in
[`wrangler.jsonc`](./wrangler.jsonc). Member pages (`/[member_id]`) are
server-rendered on demand so Discord embeds and live data stay current with no
rebuild; signed-in pages (`/user`, `/admin`, `/owner`) render in the browser,
since the API token lives in `localStorage`.

## Scripts

| Script            | Description                                |
| ----------------- | ------------------------------------------ |
| `bun run dev`     | Vite dev server                            |
| `bun run build`   | Production build for Workers               |
| `bun run preview` | Build + serve in the local Workers runtime |
| `bun run deploy`  | Build + deploy to Cloudflare Workers       |
| `bun run check`   | svelte-check type checking                 |