A modern blog application built with SvelteKit and Contentful CMS, deployed as a Cloudflare Worker with Assets.
# Install dependencies
npm install
# Set up environment variables
cp .dev.vars.example .dev.vars
# Edit .dev.vars with your Contentful credentials
# Start development server
npm run dev
# Build and deploy to Cloudflare Workers
npm run deploy
# Or deploy with dry-run to preview changes
npm run deploy:dry-run
See DEPLOYMENT.md for detailed deployment instructions.
npm run dev - Start development servernpm run build - Build for productionnpm run preview - Preview production build locallynpm run wrangler:dev - Test with Wrangler dev servernpm run deploy - Build and deploy to Cloudflare Workersnpm run deploy:dry-run - Preview deployment without publishingnpm run wrangler:tail - View real-time logs from productionnpm run contentful:publish-model - Publish content model to Contentfulnpm run contentful:list-types - List existing content typesnpm run test - Run tests with Vitestnpm run docs - Generate JSDoc documentation.
āāā src/
ā āāā routes/ # SvelteKit file-based routing
ā ā āāā +layout.svelte # Global layout with navigation
ā ā āāā +page.svelte # Homepage
ā ā āāā blog/ # Blog post pages
ā ā āāā category/ # Category landing pages
ā ā āāā [slug]/ # Dynamic page routes
ā āāā lib/
ā ā āāā components/ # Reusable Svelte components
ā ā āāā contentful/ # Contentful API client & queries
ā āāā app.html # HTML template
ā āāā app.css # Global styles (Tailwind)
āāā scripts/ # Contentful management scripts
āāā wrangler.jsonc # Cloudflare Workers configuration
āāā svelte.config.js # SvelteKit configuration
āāā tailwind.config.js # Tailwind configuration
CONTENTFUL_ACCESS_TOKEN=...
CONTENTFUL_PREVIEW_ACCESS_TOKEN=...
CONTENTFUL_MANAGEMENT_TOKEN=...
// wrangler.jsonc - Non-secrets
{
"vars": {
"CONTENTFUL_SPACE_ID": "your_space_id",
"CONTENTFUL_ENVIRONMENT": "master"
}
}
# Set production secrets
npx wrangler secret put CONTENTFUL_ACCESS_TOKEN
npx wrangler secret put CONTENTFUL_PREVIEW_ACCESS_TOKEN
npx wrangler secret put CONTENTFUL_MANAGEMENT_TOKEN
The blog uses the following Contentful content types:
?preview=true)See CLAUDE.md for development guidelines and code conventions.
Private project - All rights reserved