feat: add collaborative shopping lists with items and invitations
Some checks failed
CI / Verify (push) Has been cancelled

API: lists, items and invitations modules (list, create, get, update,
set-primary, items create/list, invitation create/accept/list-pending),
BetterAuth session helper, list membership, mailer and Prisma schema plus
migrations.

Web: lists overview, list detail (items) and list management (settings)
views, item and invitation forms/hooks, sign-up and invitation accept pages.

Shared: shopping list DTOs.

Tooling: ignore the generated TanStack Router cache (apps/web/.tanstack).
This commit is contained in:
Jose Selesan
2026-10-16 10:12:11 -03:00
parent 964a3c7217
commit 6aa86a3b68
81 changed files with 3476 additions and 269 deletions

View File

@@ -5,8 +5,8 @@
Scaffold is in place and verified: Turborepo monorepo with `apps/api`, `apps/web` and `packages/shared`,
CI on GitHub Actions, Biome as the only JS/TS tool and the text Bun lockfile committed.
Not done yet: no database migrations (`prisma/migrations` does not exist — no Postgres has been run against
the schema) and no product features. The only backend module is `health`, used as the reference example.
Not done yet: product features are just starting (sign-up, shopping lists, list items and invitations exist;
there is no Google login and no email verification). The `health` module is the reference example.
## Stack (source of truth: `STACK.md`)
@@ -82,6 +82,12 @@ Run from the repo root. Verification order is `build`, then `lint` → `typechec
- **TypeScript 6 specifics:** `baseUrl` no longer exists (aliases are declared with `paths` only), and
`apps/web/tsconfig.app.json` enables `erasableSyntaxOnly` — no enums, namespaces or constructor parameter
properties in the web app. Both apps use `@/*` → `src/*` and `verbatimModuleSyntax` (use `import type`).
- **Database naming (Prisma):** tables are **plural snake_case** (`shopping_lists`, `users`),
columns are **snake_case** (`owner_id`, `created_at`) and enum types are **snake_case** (`list_role`) — all
declared with `@@map` / `@map` in `schema.prisma`. The Prisma *model* and *field* names stay
PascalCase/camelCase, because BetterAuth and the generated client address models by those names, so a column
rename never changes the TypeScript API. Default constraint/index names follow the mapped names, so do not
set `map:` unless you have a reason to.
- CI (`.github/workflows/ci.yml`) runs on PRs and pushes to `main`: `bun install --frozen-lockfile` →
`db:generate` → `lint:ci` → `typecheck` → `test` → `build`, with Bun 1.4.0 and Node 22 for the Prisma CLI.
- Generated files are gitignored and must never be edited by hand: `apps/web/src/routeTree.gen.ts`,
@@ -191,8 +197,9 @@ export class CreateAlert {
the generated migration under `apps/api/prisma/migrations` — never edit migration files by hand. The
datasource has no `url` in the schema: it comes from `prisma.config.ts` (`env('DATABASE_URL')`). For
production, `apps/api` also has `db:deploy` (`prisma migrate deploy`), which is not wired to a turbo task yet.
- The BetterAuth models (`User`, `Session`, `Account`, `Verification`) are already in the schema with lowercase
`@@map`ed table names; regenerate them with the BetterAuth CLI rather than by hand if the auth config changes.
- The BetterAuth models (`User`, `Session`, `Account`, `Verification`) are already in the schema and follow the
naming convention above (`users`, `sessions`, `accounts`, `verifications` with snake_case columns); regenerate
them with the BetterAuth CLI rather than by hand if the auth config changes, then re-apply the mapping.
## Shared package (`@superlist/shared`)
@@ -227,6 +234,11 @@ apps/web/src/
prefetch), renders `QueryClientProvider` + `RouterProvider`, and registers the router type. `__root.tsx`
wraps everything in `ThemeProvider` + `TooltipProvider`, mounts the Sonner `Toaster` and lazy-loads the router
and query devtools in development only.
- **Theme**: hand-rolled in `src/components/theme-provider.tsx` — `useTheme()` exposes `theme`, `resolvedTheme`
and `setTheme`, and the provider toggles the `.dark` class and `color-scheme` on `<html>`. The pre-paint script
in `apps/web/index.html` applies the stored theme before React mounts; both share the `superlist-theme`
storage key, so keep them in sync. Do not swap this for `next-themes`: it renders a `<script>` from React, and
React 19 never executes (and warns about) scripts rendered on the client.
- **Server state: TanStack Query only.** Never call `fetch` from a component; add a hook under `src/hooks` that
exports `queryOptions` (`<entity>QueryOptions()`) plus a `use<Entity>()` wrapper, and use `apiFetch` from
`src/lib/api-client.ts` as the `queryFn`. Exporting the options lets route loaders prefetch with