feat: Dahoam start page with accounts, cards and search
images / check (push) Successful in 27s
images / image (push) Successful in 32s

Replica of the reference start page: wallpaper, serif clock, search bar
and link cards, as a TanStack Start app.

- Better Auth: email/password and OIDC single sign-on
- Postgres with Drizzle for the auth tables, cards, links, settings and
  uploaded wallpapers; the server applies the migrations on start
- cards group links; links are dragged inside and between cards
- search with DuckDuckGo, SearXNG or Google, suggestions and / commands
- settings page: name, search engine, wallpaper, account
- UI from collabry-components, copied into src/vendor/collabry
- Dockerfile and a Gitea workflow that checks the code, builds the image
  for amd64 and arm64 and pushes it to the registry on main
This commit is contained in:
Niklas Haiden
2026-11-18 00:09:19 +01:00
parent 54914e8e03
commit 8df74a849c
80 changed files with 9642 additions and 1572 deletions
+100
View File
@@ -0,0 +1,100 @@
# 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.
## 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)
- 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)