5.3 KiB
5.3 KiB
Massage Studio Website CMS — Agent Guidelines
Stack
- SvelteKit 2 (SSR, Svelte 5 runes mode) — all
.sveltefiles use$state,$derived,$props()etc. - PocketBase — REST API via the
pocketbaseSDK (v0.26). Auth, DB, and image storage. - Tailwind CSS v4 + DaisyUI 5 — utility-first CSS with DaisyUI components for admin; custom theme for the public site.
- Docker Compose — three services:
app(SvelteKit),pocketbase, andcaddy(reverse proxy).
Project Structure
app/ # SvelteKit application
├── src/
│ ├── lib/
│ │ ├── admin/ # Admin UI components (BlockList, editors)
│ │ ├── blocks/ # Public block renderers (one per BlockType)
│ │ ├── components/ # Header.svelte, Footer.svelte
│ │ ├── pb.ts # PocketBase client factory + helpers
│ │ └── types.ts # ContentBlock, PageRecord, HeaderGlobal, FooterGlobal
│ ├── routes/
│ │ ├── +layout.svelte # Root layout (admin vs public shell)
│ │ ├── +page.svelte # Home page (slug=home)
│ │ ├── [slug]/ # Dynamic CMS pages
│ │ ├── admin/ # Admin area (login, pages, globals)
│ │ └── preview/ # Draft preview via sessionStorage
│ └── app.css # Tailwind + DaisyUI + custom theme
├── static/ # Static assets
├── build/ # Production build output
├── svelte.config.js # Adapter-node, runes mode forced
├── vite.config.ts # Tailwind v4 + SvelteKit plugins
└── package.json
pocketbase/pb_data/ # PocketBase data (mounted volume-mounted)
docker-compose.yml # app + pocketbase services
Dockerfile # Multi-stage Node 22 build
Key Conventions
Svelte 5 Runes Mode
All components use Svelte 5 runes syntax — never export let, $:, or on:click. Use:
$props()for component props$state()for reactive local state$derived()for computed values$effect()/onMountfor side effects{@render children()}for slotsonclick={handler}(noton:click)
Block System
Pages are composed of ContentBlock[]. Each block has { id, type, data }. Block types are defined in $lib/types.ts:
text | image | image_text | timeline | testimonials | services | cta | spacer | horizontal_cards
- Public renderers:
$lib/blocks/<Type>Block.svelte— one per type, receivesdataprop. Currently active:TextBlock,ImageTextBlock,TimelineBlock,HeroBlock. - Admin editors:
$lib/admin/editors/BlockEditor.svelte— switches editor UI by type - Defaults:
$lib/admin/blockDefaults.ts—createBlock(type)generates a new block with sensible defaults - Block list:
$lib/admin/BlockList.svelte— draggable reorder, select, delete
To add a new block type: add to BlockType union in types.ts, create renderer in $lib/blocks/, add editor case in BlockEditor.svelte, add default in blockDefaults.ts, add import in BlockRenderer.svelte.
PocketBase Integration
- Client created in
hooks.server.ts(event.locals.pb) — injected per-request with auth cookie $lib/pb.tsexportscreatePocketBase(),getFileUrl(),uploadMedia()- Collections:
pages(slug, title, blocks[], published),globals(key, data),media(file, alt) - Server load functions use
locals.pb.collection('pages').getFirstListItem()
Styling
- Public site: Custom theme via
@themeinapp.css— colors:warm,charcoal,sage,sage-dark,terracotta. Fonts:DM Sans(body),Playfair Display(headings). - Admin area: DaisyUI utility classes (
btn,card,input,select,rounded-box, etc.) - Prose:
.prose-wellnessclass for rich text content styling
Routing
+layout.server.tsfetches header/footer globals for every public page+page.server.tsfor home fetchesslug = "home" && published = true[slug]/+page.server.tsfetches by dynamic slug- Admin routes protected in
hooks.server.ts— redirects to/admin/loginif unauthenticated
Build & Dev Commands
# Full stack (single entry point on port 8080) — the only supported way to run/develop
# Source changes require rebuilding; the container runs `node build`, not a dev server.
docker compose up --build
# App + PocketBase via Caddy: http://localhost:8080
# PocketBase admin: http://localhost:8080/_/
# Type checking (can run on the host with node_modules present, or inside the container)
cd app && npm run check
# Production build only (run by the Dockerfile)
cd app && npm run build
Environment
PUBLIC_POCKETBASE_URL— public-facing PocketBase URL, accessed through the Caddy reverse proxy (http://localhost:8080). Set directly indocker-compose.yml.POCKETBASE_INTERNAL_URL— internal Docker network URL (http://pocketbase:80). Set directly indocker-compose.yml.ORIGIN— SvelteKit origin for SSR (http://localhost:8080). Set directly indocker-compose.yml.- Stripe + PocketBase admin secrets are read from a root-level
.envnext todocker-compose.yml; see.env.example.