···23## Project Structure & Module Organization
45-- `src/routes` contains SvelteKit routes, including dynamic handle pages in `src/routes/[handle]/[[page]]`, edit flows in `src/routes/[handle]/[[page]]/edit` and `src/routes/edit`, and API endpoints under `src/routes/api`.
6-- `src/lib` holds reusable modules: card implementations in `src/lib/cards`, shared UI in `src/lib/components`, OAuth helpers in `src/lib/oauth`, and site data/loading in `src/lib/website`.
7- Root app setup lives in `src/app.html` and `src/app.css`.
8- `static` is for public assets served as-is.
9- `docs` includes contributor-facing docs like custom cards and self-hosting.
···23## Project Structure & Module Organization
45+- `src/routes` contains SvelteKit routes. User-facing pages are under `src/routes/[[actor=actor]]/(pages)/` with an optional actor param (double brackets). When omitted, the actor is resolved from custom domain KV or `PUBLIC_HANDLE`. API endpoints live under `src/routes/api` and `src/routes/[[actor=actor]]/api`.
6+- `src/lib` holds reusable modules: card implementations in `src/lib/cards`, shared UI in `src/lib/components`, ATProto/OAuth helpers in `src/lib/atproto`, and site data/loading in `src/lib/website`.
7- Root app setup lives in `src/app.html` and `src/app.css`.
8- `static` is for public assets served as-is.
9- `docs` includes contributor-facing docs like custom cards and self-hosting.
+13-7
CLAUDE.md
···61- See e.g. `src/lib/cards/EmbedCard/` and `src/lib/cards/LivestreamCard/` for examples of implementation.
62- Cards should be styled to work in light and dark mode (with `dark:` class modifier) as well as when cards are colorful (= bg-color-500 for the card background) (with `accent:` modifier).
6364-**ATProto Integration (`src/lib/oauth/`):**
6566- `auth.svelte.ts` - OAuth client state and login/logout flow using `@atcute/oauth-browser-client`
67- `atproto.ts` - ATProto API helpers: `resolveHandle`, `listRecords`, `getRecord`, `putRecord`, `deleteRecord`, `uploadImage`
68- Data is stored in user's PDS under collection `app.blento.card`
69- **Important**: ATProto does not allow floating point numbers in records. All numeric values must be integers.
07071**Caching (`src/lib/cache.ts`):**
72···8889### Routes
9091-- `/` - Landing page
92-- `/[handle]/[[page]]` - View a user's bento site (loads from their PDS)
93-- `/[handle]/[[page]]/edit` - Edit mode for a user's site page
94-- `/edit` - Self-hosted edit mode
95-- `/api/links` - Link preview API
00000096- `/api/geocoding` - Geocoding API for map cards
97-- `/api/reloadRecent`, `/api/update` - Additional data endpoints
9899### Item Type
100
···61- See e.g. `src/lib/cards/EmbedCard/` and `src/lib/cards/LivestreamCard/` for examples of implementation.
62- Cards should be styled to work in light and dark mode (with `dark:` class modifier) as well as when cards are colorful (= bg-color-500 for the card background) (with `accent:` modifier).
6364+**ATProto Integration (`src/lib/atproto/`):**
6566- `auth.svelte.ts` - OAuth client state and login/logout flow using `@atcute/oauth-browser-client`
67- `atproto.ts` - ATProto API helpers: `resolveHandle`, `listRecords`, `getRecord`, `putRecord`, `deleteRecord`, `uploadImage`
68- Data is stored in user's PDS under collection `app.blento.card`
69- **Important**: ATProto does not allow floating point numbers in records. All numeric values must be integers.
70+- Login redirect: before OAuth redirect, the current path is saved to `localStorage` (`login-redirect`) and restored after callback
7172**Caching (`src/lib/cache.ts`):**
73···8990### Routes
9192+All user-facing pages live under `src/routes/[[actor=actor]]/(pages)/` using an optional `[[actor=actor]]` param. When the actor param is omitted, the layout resolves the actor from a custom domain (via KV lookup) or the `PUBLIC_HANDLE` env var.
93+94+- `/` - Landing page (or a user's site when on a custom domain)
95+- `/[actor]` - View a user's bento site (loads from their PDS)
96+- `/[actor]/edit` - Edit mode for a user's main page
97+- `/[actor]/p/[page]` - View a named sub-page
98+- `/[actor]/p/[page]/edit` - Edit mode for a sub-page
99+- `/[actor]/p/[page]/copy` - Copy a page to your own site
100+- `/[actor]/og.png` - Dynamic OG image generation
101+- `/[actor]/api/refresh` - Cache refresh endpoint
102+- `/[actor]/.well-known/site.standard.publication` - Site publication metadata
103- `/api/geocoding` - Geocoding API for map cards
0104105### Item Type
106
+2
src/lib/atproto/auth.svelte.ts
···126 scope: metadata.scope
127 });
12800129 // let browser persist local storage
130 await new Promise((resolve) => setTimeout(resolve, 200));
131
···126 scope: metadata.scope
127 });
128129+ localStorage.setItem('login-redirect', location.pathname + location.search);
130+131 // let browser persist local storage
132 await new Promise((resolve) => setTimeout(resolve, 200));
133