Files
dahoam/PLAN.md
T
niklas dacd374946
images / check (push) Successful in 32s
images / image (push) Successful in 15s
feat: every dashboard has its own wallpaper
The wallpaper and how much it is darkened move from the user to the dashboard.
Migration 0007 copies what each user had to all their dashboards.

Settings open for the dashboard you came from (/settings?d=<id>): its wallpaper
is shown, a switch reaches the others, and "Back to dashboard" returns to it.
2026-11-18 18:03:10 +01:00

114 lines
6.2 KiB
Markdown

# Dahoam — Plan
Replica of the reference start page (wallpaper, big serif clock, search bar,
app-icon row, "Everything else"), as a TanStack Start app with accounts.
Reference: https://pbs.twimg.com/media/HXSYNQ6XcAER0k9?format=jpg&name=4096x4096
## Stack
- TanStack Start (React 19, Vite 8), Tailwind 4
- UI: [collabry-components](https://git.nhaiden.io/niklas/collabry-components) copied into
`src/vendor/collabry` (replaced the scaffolded shadcn radix-nova set)
- Better Auth 1.7 — email/password + SSO (generic OIDC), Drizzle adapter
- Postgres 17 + Drizzle ORM (`postgres` driver), migrations via drizzle-kit
- Nitro (`nitro/vite`) for the production Node server
## Data model (`src/db/schema.ts`)
| Table | Columns |
|-------|---------|
| `user`, `session`, `account`, `verification` | Better Auth core tables |
| `link` | id, userId → user, name, url, icon (URL or dashboard-icons slug, optional), pinned, createdAt |
| `settings` | userId (PK) → user, title, searchEngine (`duckduckgo` \| `searxng` \| `google`), wallpaperUrl |
| `wallpaper` | userId (PK) → user, mime, data (bytea) |
Every row is scoped to its owner; all server functions check the session.
## Features
1. **Auth** — `/login` with sign in / sign up tabs and a "Continue with SSO" button
(only shown when OIDC env is set). `/` redirects to `/login` without a session.
`DISABLE_SIGNUP=true` closes registration.
2. **Dashboard** (`/`) — date, live clock, glass search bar, pinned links row,
"Everything else" section (unpinned links) below the fold, top bar with
title, add (+) and settings buttons, wallpaper credit + edit pencil.
3. **Home links** — add / edit / delete in a dialog (right-click or hover
pencil on a tile to edit). Icon fallback chain: custom icon →
dashboard-icons by name → site `/favicon.ico` → letter.
4. **Search**
- Engine per user: DuckDuckGo, SearXNG (when `SEARXNG_URL` is set), Google.
- Live suggestions proxied through the server (DuckDuckGo `/ac`, SearXNG `/autocompleter`).
- DuckDuckGo `!bangs` always route through DuckDuckGo.
- `/` focuses the bar; `/text` filters links and commands (add link, settings, sign out).
5. **Wallpaper** — paste an image URL or upload a file (stored in Postgres,
served from `/api/wallpaper`, ≤ 10 MB, jpeg/png/webp/avif). Reset to default.
Dither + vignette overlay like the reference.
## Files
```
docker-compose.yml Postgres for local dev
drizzle.config.ts
.env.example
src/db/{index,schema}.ts
src/lib/auth.ts Better Auth server config
src/lib/auth-client.ts
src/lib/auth.functions.ts getSession / ensureSession / authInfo
src/lib/dashboard.functions.ts links, settings, suggestions
src/lib/search.ts search URL builder (+ test)
src/routes/api/auth/$.ts
src/routes/api/wallpaper.ts
src/routes/login.tsx
src/routes/index.tsx
src/routes/settings.tsx
src/components/{clock,search-bar,link-tile,link-dialog,glass,wallpaper}.tsx
src/vendor/collabry/ copied Collabry components (do not edit)
scripts/sync-collabry.sh copies them from upstream at a pinned commit
```
## Steps
- [x] 1. Deps, docker-compose, env, Drizzle schema + first migration
- [x] 2. Better Auth (server, client, handler route, session helpers)
- [x] 3. Server functions: links, settings, suggestions; wallpaper route
- [x] 4. UI: login, dashboard, dialogs, search bar
- [x] 5. Verify: typecheck, lint, build, end-to-end against real Postgres, screenshot vs reference
- [x] 6. Independent review (subagent), fix findings, README
- [x] 7. Blurred card behind the top-row icons
- [x] 8. Collabry components: Button, Card, Field, Input, Checkbox, SegmentedControl, Dialog, Kbd,
ThemeProvider. Kept: wallpaper, serif clock, glass panels, Inter. Accent is near white.
- [x] 9. Settings page (`/settings`) replaces the settings dialog: General, Search, Wallpaper,
Account. Each setting saves on its own (`saveSettings` takes a patch).
- [x] 10. Cards: table `card`, `link.cardId` + `link.position` (replaces `pinned` and the
"Everything else" section; migration `0001_cards` moves existing links into cards).
Links are dragged inside and between cards with dnd-kit (`src/components/card-grid.tsx`,
layout logic and its test in `src/lib/layout.ts`).
- [x] 11. Image and CI: `Dockerfile` (multi-arch without emulation), `.gitea/workflows/images.yml`
(check, build, push to the Harbor registry on main, as in typst-workspace). The server applies
the migrations on start (`src/db/index.ts`).
- [x] 12. Renamed from "Home Dashboard" to Dahoam (slug `dahoam`): package, compose project, tab title,
default dashboard name, docs, CI examples.
- [x] 13. Dashboards: table `dashboard`, `card.dashboardId`, `settings.defaultDashboardId`
(migration `0006_dashboards_icons` puts the existing cards on a dashboard "Home"). `/?d=<id>`
opens one, `/` the default. Switcher in the header, managed in Settings → Dashboards.
- [x] 14. Icons: the link dialog searches dashboard-icons (`src/lib/icons.ts` and its test) and
uploads custom icons (table `icon`, `/api/icon`, ≤ 1 MB, SVG allowed because it is served
sandboxed). `src/lib/upload.ts` holds the upload checks that wallpaper and icons share.
- [x] 15. A wallpaper per dashboard: `wallpaperUrl` and `wallpaperDim` move from `settings` to
`dashboard`, the `wallpaper` table is keyed by dashboard (migration `0007_dashboard_wallpaper`
copies what each user had to all their dashboards). `/settings?d=<id>` is the dashboard whose
wallpaper is shown, and where "Back to dashboard" goes.
## Not doing (not asked)
- Unraid version/uptime chip and the Sonarr/Plex notification pills from the screenshot
- Inline SearXNG result rendering (search opens the engine's result page)
- Reordering the cards themselves (they stay in the order they were made), free placement with
gaps in the grid, per-user SearXNG URL (SSRF risk — it is a server env)
- Per dashboard clock or search engine (they stay per user), moving a card to another dashboard,
reordering dashboards, remembering the last opened dashboard (the default opens)
- A list of the icons a user uploaded, to use one again for another link
- Email verification / password reset mail (needs an SMTP setup)
- In CI: version tags and releases, a Helm chart, an image vulnerability scan (typst-workspace has all three)