SvelteKit-powered personal site that renders pages from Contentful and deploys to Cloudflare Workers.
src/routes/+layout.server.ts loads the global navigation using NavigationService.src/routes/[...catchall]/+page.server.ts resolves the current slug (with home fallback in the Contentful query) and fetches page data.src/lib/services/cms/contentful.ts calls Contentful APIs, builds breadcrumbs recursively from parent pages, and converts Rich Text to HTML.src/routes/[...catchall]/+page.svelte renders page title, breadcrumbs, and body content ({@html ...} output from Contentful rich text rendering).+layout.svelte renders Header, Nav, page content, and footer.src/lib/services/**.src/lib/** with Storybook stories and docs.@sveltejs/adapter-cloudflare and Worker config is in wrangler.toml.npm install
cp .env.example .env
.env (or your shell/CI environment):CONTENTFUL_API_KEY=<your_contentful_delivery_or_preview_token>
# Optional, defaults to cdn.contentful.com:
CONTENTFUL_HOST=cdn.contentful.com
Notes:
- Preview environment uses
preview.contentful.comviawrangler.toml.- If
CONTENTFUL_API_KEYis missing, server-side page and nav fetches will fail.
npx playwright install
npm install
npm run dev
Start local dev server (Vite + SvelteKit).
npm run build
npm run preview
Build and serve the production artifact locally.
npm run check
Runs svelte-kit sync and svelte-check.
npm run lint
npm run format
lint runs Prettier check + ESLint.format applies Prettier formatting.npm run test:unit
Runs the dedicated unit Vitest project for src/**/*.{test,spec}.{js,ts} (no Storybook browser runner).
npm run test:integration
Runs Playwright tests in tests/ against a built+previewed app.
npm run storybook
npm run build-storybook
npm run test:storybook
storybook: local component explorer on port 6006.build-storybook: static Storybook build.test:storybook: Vitest Storybook project (browser mode).npm test
Runs integration tests, then the dedicated unit test project.
svelte.config.js.wrangler.toml..svelte-kit/cloudflare per wrangler assets config.