create-kitcms 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -2
  3. package/bin/create.js +5 -0
  4. package/dist/args.d.ts +15 -0
  5. package/dist/args.js +72 -0
  6. package/dist/index.d.ts +30 -0
  7. package/dist/index.js +150 -0
  8. package/dist/scaffold.d.ts +25 -0
  9. package/dist/scaffold.js +98 -0
  10. package/dist/wrangler.d.ts +2 -0
  11. package/dist/wrangler.js +7 -0
  12. package/package.json +34 -3
  13. package/templates/blank/.dev.vars.example +1 -0
  14. package/templates/blank/README.md +39 -0
  15. package/templates/blank/_gitignore +7 -0
  16. package/templates/blank/package.json +37 -0
  17. package/templates/blank/pnpm-workspace.yaml +3 -0
  18. package/templates/blank/src/app.d.ts +22 -0
  19. package/templates/blank/src/app.html +11 -0
  20. package/templates/blank/src/hooks.server.ts +4 -0
  21. package/templates/blank/src/kitcms.admin.ts +14 -0
  22. package/templates/blank/src/kitcms.config.ts +32 -0
  23. package/templates/blank/src/kitcms.rpc.ts +6 -0
  24. package/templates/blank/src/lib/index.ts +1 -0
  25. package/templates/blank/src/routes/(kitcms)/admin/[...path]/+page.server.ts +2 -0
  26. package/templates/blank/src/routes/(kitcms)/admin/[...path]/+page.svelte +9 -0
  27. package/templates/blank/src/routes/(kitcms)/api/[...path]/+server.ts +2 -0
  28. package/templates/blank/src/routes/+page.server.ts +7 -0
  29. package/templates/blank/src/routes/+page.svelte +19 -0
  30. package/templates/blank/tsconfig.json +11 -0
  31. package/templates/blank/vite.config.ts +8 -0
  32. package/templates/blank/wrangler.jsonc +28 -0
  33. package/templates/website/.dev.vars.example +1 -0
  34. package/templates/website/README.md +105 -0
  35. package/templates/website/_gitignore +7 -0
  36. package/templates/website/package.json +42 -0
  37. package/templates/website/pnpm-workspace.yaml +3 -0
  38. package/templates/website/src/app.css +23 -0
  39. package/templates/website/src/app.d.ts +22 -0
  40. package/templates/website/src/app.html +11 -0
  41. package/templates/website/src/hooks.server.ts +4 -0
  42. package/templates/website/src/kitcms.admin.ts +19 -0
  43. package/templates/website/src/kitcms.config.ts +269 -0
  44. package/templates/website/src/kitcms.rpc.ts +6 -0
  45. package/templates/website/src/kitcms.seed.ts +232 -0
  46. package/templates/website/src/lib/Img.svelte +62 -0
  47. package/templates/website/src/lib/Link.svelte +10 -0
  48. package/templates/website/src/lib/PageView.svelte +30 -0
  49. package/templates/website/src/lib/PostList.svelte +169 -0
  50. package/templates/website/src/lib/RichText.svelte +13 -0
  51. package/templates/website/src/lib/Seo.svelte +31 -0
  52. package/templates/website/src/lib/blocks/AdminPreview.svelte +59 -0
  53. package/templates/website/src/lib/blocks/Cta.svelte +86 -0
  54. package/templates/website/src/lib/blocks/Features.svelte +147 -0
  55. package/templates/website/src/lib/blocks/Gallery.svelte +122 -0
  56. package/templates/website/src/lib/blocks/Hero.svelte +151 -0
  57. package/templates/website/src/lib/blocks/LatestPosts.svelte +36 -0
  58. package/templates/website/src/lib/blocks/RenderBlocks.svelte +38 -0
  59. package/templates/website/src/lib/blocks/ResolveMedia.svelte +27 -0
  60. package/templates/website/src/lib/blocks/RichTextBlock.svelte +47 -0
  61. package/templates/website/src/lib/blocks/TeamGrid.svelte +159 -0
  62. package/templates/website/src/lib/blocks/types.ts +47 -0
  63. package/templates/website/src/lib/content.ts +31 -0
  64. package/templates/website/src/lib/designs.ts +79 -0
  65. package/templates/website/src/lib/format.ts +3 -0
  66. package/templates/website/src/lib/icons.ts +13 -0
  67. package/templates/website/src/lib/image.ts +29 -0
  68. package/templates/website/src/lib/index.ts +1 -0
  69. package/templates/website/src/lib/media.ts +32 -0
  70. package/templates/website/src/lib/shell/Footer.svelte +146 -0
  71. package/templates/website/src/lib/shell/Header.svelte +121 -0
  72. package/templates/website/src/lib/shell/MobileMenu.svelte +142 -0
  73. package/templates/website/src/lib/shell/shell.ts +52 -0
  74. package/templates/website/src/lib/site.css +329 -0
  75. package/templates/website/src/routes/(kitcms)/admin/[...path]/+page.server.ts +2 -0
  76. package/templates/website/src/routes/(kitcms)/admin/[...path]/+page.svelte +9 -0
  77. package/templates/website/src/routes/(kitcms)/api/[...path]/+server.ts +2 -0
  78. package/templates/website/src/routes/(site)/+error.svelte +23 -0
  79. package/templates/website/src/routes/(site)/+layout.server.ts +12 -0
  80. package/templates/website/src/routes/(site)/+layout.svelte +63 -0
  81. package/templates/website/src/routes/(site)/+page.server.ts +7 -0
  82. package/templates/website/src/routes/(site)/+page.svelte +33 -0
  83. package/templates/website/src/routes/(site)/[slug]/+page.server.ts +11 -0
  84. package/templates/website/src/routes/(site)/[slug]/+page.svelte +9 -0
  85. package/templates/website/src/routes/(site)/blog/+page.server.ts +20 -0
  86. package/templates/website/src/routes/(site)/blog/+page.svelte +66 -0
  87. package/templates/website/src/routes/(site)/blog/[slug]/+page.server.ts +11 -0
  88. package/templates/website/src/routes/(site)/blog/[slug]/+page.svelte +231 -0
  89. package/templates/website/src/routes/(site)/legal/[slug]/+page.server.ts +8 -0
  90. package/templates/website/src/routes/(site)/legal/[slug]/+page.svelte +23 -0
  91. package/templates/website/tsconfig.json +11 -0
  92. package/templates/website/vite.config.ts +8 -0
  93. package/templates/website/wrangler.jsonc +28 -0
@@ -0,0 +1,14 @@
1
+ // Client-side admin options (shipped to the browser, so keep server-only code out of here).
2
+ // Live preview components are registered here and loaded lazily. Example:
3
+ //
4
+ // previews: {
5
+ // collections: { pages: () => import('#lib/previews/Page.svelte') }, // { doc }
6
+ // globals: { site: () => import('#lib/previews/Site.svelte') }, // { doc }
7
+ // blocks: { hero: () => import('#lib/blocks/Hero.svelte') }, // { block, doc }
8
+ // },
9
+ //
10
+ // `doc` and `block` are the live form values: read-only, never write to them. Resolve
11
+ // upload/relationship ids with `useRelation(collection, () => id)` from '@kitcms/ui'.
12
+ import { defineAdmin } from '@kitcms/ui';
13
+
14
+ export default defineAdmin({});
@@ -0,0 +1,32 @@
1
+ import { collection, defineConfig, fields as f } from '@kitcms/core';
2
+
3
+ export default defineConfig({
4
+ admin: { title: '__APP_NAME__' },
5
+ collections: [
6
+ collection({
7
+ slug: 'media',
8
+ upload: { mimeTypes: ['image/*', 'application/pdf'] },
9
+ access: { read: () => true },
10
+ fields: { alt: f.text() },
11
+ }),
12
+ collection({
13
+ slug: 'pages',
14
+ admin: { useAsTitle: 'title', defaultColumns: ['title', 'slug', 'status', 'updatedAt'] },
15
+ access: {
16
+ // Published pages are public; signed-in users also see drafts.
17
+ read: ({ req }) => (req.user ? true : { status: { equals: 'published' } }),
18
+ },
19
+ fields: {
20
+ title: f.text({ required: true }),
21
+ slug: f.slug({ from: 'title', unique: true, admin: { position: 'sidebar' } }),
22
+ status: f.select({
23
+ options: ['draft', 'published'],
24
+ defaultValue: 'draft',
25
+ required: true,
26
+ admin: { position: 'sidebar' },
27
+ }),
28
+ body: f.textarea(),
29
+ },
30
+ }),
31
+ ],
32
+ });
@@ -0,0 +1,6 @@
1
+ // GENERATED by kitcms. The Service Binding entrypoint other Workers bind to (entrypoint "KitcmsRPC").
2
+ // Must stay a class declaration: wrangler/workerd detect entrypoints by exported classes.
3
+ import { createKitcmsRPC } from '@kitcms/core/rpc';
4
+ import config from './kitcms.config';
5
+
6
+ export class KitcmsRPC extends createKitcmsRPC(config) {}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ // GENERATED by kitcms. Do not edit: the admin lives in @kitcms/core and @kitcms/ui.
2
+ export { load, actions } from '@kitcms/core/sveltekit/admin';
@@ -0,0 +1,9 @@
1
+ <!-- GENERATED by kitcms. Do not edit: the admin lives in @kitcms/ui. Register previews in src/kitcms.admin.ts. -->
2
+ <script lang="ts">
3
+ import { Admin } from '@kitcms/ui';
4
+ import adminConfig from '../../../../kitcms.admin';
5
+
6
+ let { data, form } = $props();
7
+ </script>
8
+
9
+ <Admin {data} {form} admin={adminConfig} />
@@ -0,0 +1,2 @@
1
+ // GENERATED by kitcms. Do not edit: the API lives in @kitcms/core.
2
+ export { GET, POST, PATCH, DELETE } from '@kitcms/core/sveltekit/api';
@@ -0,0 +1,7 @@
1
+ import type { PageServerLoad } from './$types';
2
+
3
+ // Reads through the Local API as the visitor: only published pages come back for anonymous users.
4
+ export const load: PageServerLoad = async ({ locals }) => {
5
+ const { docs } = await locals.cms.find('pages', { sort: '-updatedAt', limit: 20 });
6
+ return { pages: docs };
7
+ };
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import { resolve } from '$app/paths';
3
+
4
+ let { data } = $props();
5
+ </script>
6
+
7
+ <h1>__APP_NAME__</h1>
8
+ <p><a href={resolve('/(kitcms)/admin/[...path]', { path: '' })}>Admin</a></p>
9
+ <h2>Published pages</h2>
10
+ <ul>
11
+ {#each data.pages as page (page.id)}
12
+ <li>
13
+ <strong>{page.title}</strong> <code>/{page.slug}</code>
14
+ {#if page.body}<p>{page.body}</p>{/if}
15
+ </li>
16
+ {:else}
17
+ <li>No published pages yet.</li>
18
+ {/each}
19
+ </ul>
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "$app/tsconfig",
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "verbatimModuleSyntax": true,
6
+ "noUncheckedIndexedAccess": true,
7
+ "types": ["@cloudflare/workers-types", "$app/types"]
8
+ },
9
+ "include": ["src", "*"],
10
+ "exclude": ["src/service-worker"]
11
+ }
@@ -0,0 +1,8 @@
1
+ import { sveltekit } from '@sveltejs/kit/vite';
2
+ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
3
+ import { kitcms, kitcmsAdapter } from '@kitcms/core/vite';
4
+ import { defineConfig } from 'vite';
5
+
6
+ export default defineConfig({
7
+ plugins: [sveltekit({ preprocess: vitePreprocess(), adapter: kitcmsAdapter() }), kitcms()],
8
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "node_modules/wrangler/config-schema.json",
3
+ "name": "__APP_NAME__",
4
+ "compatibility_date": "2026-11-01",
5
+ "compatibility_flags": ["nodejs_als"],
6
+ // Smart Placement runs the Worker near its D1 primary when that beats running near the visitor
7
+ // (kitcms makes several D1 round trips per request). Combine with D1 read replication.
8
+ "placement": { "mode": "smart" },
9
+ "main": ".svelte-kit/cloudflare/_worker.js",
10
+ "assets": {
11
+ "binding": "ASSETS",
12
+ "directory": ".svelte-kit/cloudflare",
13
+ },
14
+ "d1_databases": [
15
+ {
16
+ "binding": "DB",
17
+ "database_name": "__DB_NAME__",
18
+ "database_id": "__DB_ID__",
19
+ "migrations_dir": "migrations",
20
+ },
21
+ ],
22
+ "r2_buckets": [
23
+ {
24
+ "binding": "BUCKET",
25
+ "bucket_name": "__BUCKET_NAME__",
26
+ },
27
+ ],
28
+ }
@@ -0,0 +1 @@
1
+ BETTER_AUTH_SECRET=
@@ -0,0 +1,105 @@
1
+ # __APP_NAME__
2
+
3
+ A [kitcms](https://kitcms.dev) website: SvelteKit + Cloudflare Workers + D1 + R2. A generic small business / studio site with pages built from blocks, a blog, a team page, legal pages and site settings.
4
+
5
+ > **Requires the Workers Paid plan to deploy.** Password hashing exceeds the Free plan's CPU limit.
6
+
7
+ ## What is inside
8
+
9
+ | Content | Where | Notes |
10
+ |---|---|---|
11
+ | Pages | `pages` collection | Drafts + autosave. Sections are blocks. `home` is served at `/`, any other slug at `/<slug>`. SEO tab (title, description, social image). |
12
+ | Blog | `posts` + `tags` | Drafts, cover image, rich text body, tags. `/blog` (paginated) and `/blog/<slug>`. |
13
+ | Team | `team` | Drag to reorder in the admin list. Rendered by the `teamGrid` block. |
14
+ | Legal | `legal` | Locked: editors edit the text but cannot create or delete documents. `/legal/<slug>`, linked in the footer. |
15
+ | Site settings | `site` global | General tab: name, tagline, logo, navigation (a page, or a path like `/blog`), footer text and social links. Design tab: a design per page type and the colours (see Designs). |
16
+ | Media | `media` | Images and PDFs in R2. |
17
+
18
+ The blocks are `hero`, `richText`, `features`, `gallery`, `cta`, `teamGrid` and `latestPosts`.
19
+
20
+ ## Setup
21
+
22
+ ```sh
23
+ pnpm install
24
+ cp .dev.vars.example .dev.vars # then set BETTER_AUTH_SECRET (the scaffolder already did this)
25
+ pnpm db:generate init # generate the first migration from src/kitcms.config.ts
26
+ pnpm db:migrate # apply it to the local D1
27
+ pnpm db:seed # example pages, posts, tags, team, legal pages and site settings
28
+ pnpm dev
29
+ ```
30
+
31
+ Open <http://localhost:5173> for the site and <http://localhost:5173/admin> for the admin. The first visit to the admin asks you to create the first admin user.
32
+
33
+ `pnpm db:seed` (`kitcms seed`) is idempotent: it only creates what is missing and never overwrites edits. It seeds no images; upload some in the admin and attach them (hero image, post covers, team photos, logo).
34
+
35
+ ## Commands
36
+
37
+ | Command | |
38
+ |---|---|
39
+ | `pnpm dev` | Dev server with local D1/R2. |
40
+ | `pnpm preview` | Build and run under `wrangler dev` (workerd, like production). |
41
+ | `pnpm db:generate <name>` | Generate a migration after you change `src/kitcms.config.ts`. |
42
+ | `pnpm db:migrate` / `pnpm db:migrate:remote` | Apply migrations to the local / production D1. |
43
+ | `pnpm db:seed` / `pnpm db:seed:remote` | Run `src/kitcms.seed.ts` against the local / production D1. |
44
+ | `pnpm types` | Regenerate the typed config declarations. |
45
+ | `pnpm check` | `svelte-check`. |
46
+ | `pnpm run deploy` | `wrangler deploy`. |
47
+
48
+ ## Where things live
49
+
50
+ - `src/kitcms.config.ts`: the schema (collections, globals, blocks). The only place it exists.
51
+ - `src/lib/blocks/`: one Svelte component per block, plus `RenderBlocks.svelte` (maps `blockType` to its component).
52
+ - `src/kitcms.admin.ts`: registers the **live preview** of every block (loaded lazily in the admin). Previews use the same components as the public site through `src/lib/blocks/AdminPreview.svelte`, so what editors see is what visitors get. `teamGrid` and `latestPosts` show a placeholder in the preview because they render other collections.
53
+ - `src/routes/(site)/`: the public routes. They read content with `locals.cms` (the Local API acting as the visitor: only published documents). `src/lib/content.ts` loads a page and the data its blocks need.
54
+ - `src/lib/site.css`: design tokens (light/dark follows the system setting), base styles, buttons and generic form styles, shared by the site and the preview.
55
+ - `src/lib/designs.ts`: the design registry and `resolveDesign` (see Designs).
56
+ - `src/lib/shell/`: the header (with the accessible mobile menu), the footer and `buildShell`.
57
+ - `src/kitcms.seed.ts`: example content.
58
+ - `src/routes/(kitcms)/`: generated admin and API routes. Do not edit them.
59
+
60
+ To add a block: define it with `block()` in the config, add `src/lib/blocks/<Name>.svelte`, add a branch in `RenderBlocks.svelte` and `AdminPreview.svelte`, and register it in `src/kitcms.admin.ts`.
61
+
62
+ The slugs `blog`, `legal`, `admin` and `api` are taken by routes, so a page with one of those slugs would be shadowed.
63
+
64
+ ## Designs and colours
65
+
66
+ Every page type comes in three designs, **A**, **B** and **C**. They are different compositions, not colour swaps, and all three share one set of tokens, so any mix stays coherent.
67
+
68
+ | Page type | A | B | C |
69
+ |---|---|---|---|
70
+ | Header | Bar | Centred | Band |
71
+ | Footer | Simple | Columns | Statement |
72
+ | Home / Page (every block) | Editorial | Immersive | Structured |
73
+ | Blog list (also the `latestPosts` block) | Journal | Cards | Index |
74
+ | Blog post | Essay | Feature | Article |
75
+
76
+ - **Choose** in the admin: Site settings > Design has one select per page type. A page or post can override it in its sidebar (**Design**); the home page (slug `home`) uses the `home` setting, any other page the `page` setting. An unset page override means "use the site setting".
77
+ - **How it resolves:** `resolveDesign(type, site.design, page.design)` in `src/lib/designs.ts` returns `'a' | 'b' | 'c'`. The route passes it to `PageView` / `RenderBlocks`, and every block takes a `design` prop and renders all three. Unknown ids fall back to the first design. In dev, `?header=b` and `?footer=c` preview a header or footer without saving.
78
+ - **Add a design** to a page type: add `d: 'Name'` to its entry in `PAGE_TYPES` (`src/lib/designs.ts`); the admin selects are built from that list. Then handle `'d'` in the components that switch on `design`. **Add a page type**: add it to `PAGE_TYPES`, a `siteDesign('<type>')` line in the config's Design tab and a route that calls `resolveDesign`.
79
+ - **Colours:** Site settings > Design > Colours sets the accent, background and text colour (hex). They become the CSS variables `--accent`, `--bg` and `--ink` on the page; the surface, muted text and lines are derived from them, and the text on the accent is picked for contrast. The values are validated in the config and again when rendered (anything that is not a hex colour is dropped). Set all three together, and check contrast: the defaults follow the system light/dark setting, overrides do not.
80
+ - **Fonts:** one self-hosted family (`@fontsource-variable/hanken-grotesk`, imported in `src/app.css`) plus a system serif for the editorial design. Change them in `site.css` (`--font-sans`, `--font-serif`).
81
+ - **Layout rules:** mobile first (320 px up), no horizontal scroll, 44 px tap targets, visible focus, `prefers-reduced-motion`, a skip link and landmarks. Forms: the base CSS styles plain `input`, `select`, `textarea`, `label` and `button`.
82
+
83
+ ## Custom domain: edge cache and image transformations
84
+
85
+ Two features need your own domain on Cloudflare and do nothing on `*.workers.dev`:
86
+
87
+ - **Edge cache.** `cache: { ttl: 60 }` in the config caches anonymous published reads (the public site) with the Workers Cache API. A write clears the cache in the editor's region at once; other regions serve a cached read for up to `ttl` seconds. Without a custom domain it is a no-op, which is harmless.
88
+ - **Image transformations.** `src/lib/image.ts` builds `/cdn-cgi/image/width=...,format=auto/<url>` URLs, so visitors get resized AVIF/WebP images. Enable *Transformations* for the zone in the Cloudflare dashboard (Images). The template turns them off in dev and on `*.workers.dev` and serves the original file instead.
89
+
90
+ ## Deploy
91
+
92
+ 1. Create the resources if you have not (`wrangler d1 create __DB_NAME__`, `wrangler r2 bucket create __BUCKET_NAME__`) and put the D1 `database_id` into `wrangler.jsonc`.
93
+ 2. `pnpm db:migrate:remote`
94
+ 3. `pnpm exec wrangler secret put BETTER_AUTH_SECRET`
95
+ 4. For `pnpm db:seed:remote`, add `"remote": true` to the `d1_databases` entry in `wrangler.jsonc` temporarily (so the seed reaches the real database), then remove it.
96
+ 5. `pnpm run deploy`
97
+
98
+ `wrangler.jsonc` enables Smart Placement (the Worker runs near the D1 primary when that is faster; kitcms makes a few D1 round trips per request).
99
+
100
+ D1 read replication is optional and needs no code changes: turn it on in the Cloudflare dashboard (D1 → your database → Settings → Read replication). Visitors then read from the nearest replica, and signed-in editors still see their own saves. See the `@kitcms/core` README.
101
+
102
+ ## Headless / RPC
103
+
104
+ `src/kitcms.rpc.ts` exports the `KitcmsRPC` entrypoint. Other Workers can bind to it with a Service Binding
105
+ (`"services": [{ "binding": "CMS", "service": "__APP_NAME__", "entrypoint": "KitcmsRPC" }]`) and read content over RPC.
@@ -0,0 +1,7 @@
1
+ node_modules/
2
+ .svelte-kit/
3
+ .wrangler/
4
+ dist/
5
+ .env
6
+ .dev.vars
7
+ .DS_Store
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "__APP_NAME__",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "prepare": "svelte-kit sync",
8
+ "dev": "vite dev",
9
+ "build": "vite build",
10
+ "preview": "pnpm build && wrangler dev",
11
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12
+ "deploy": "wrangler deploy",
13
+ "db:generate": "kitcms migrate:create",
14
+ "db:migrate": "kitcms migrate",
15
+ "db:migrate:remote": "kitcms migrate --remote",
16
+ "types": "kitcms generate:types",
17
+ "db:seed": "kitcms seed",
18
+ "db:seed:remote": "kitcms seed --remote"
19
+ },
20
+ "dependencies": {
21
+ "@fontsource-variable/hanken-grotesk": "^5.2.0",
22
+ "@kitcms/core": "^0.1.0",
23
+ "@kitcms/ui": "^0.1.0"
24
+ },
25
+ "devDependencies": {
26
+ "@cloudflare/workers-types": "^5.20261116.1",
27
+ "@sveltejs/adapter-cloudflare": "^8.0.2",
28
+ "@sveltejs/kit": "^3.2.0",
29
+ "@sveltejs/vite-plugin-svelte": "^7.3.1",
30
+ "@types/node": "^26.6.6",
31
+ "svelte": "^5.57.3",
32
+ "svelte-check": "^4.7.8",
33
+ "typescript": "^6.0.3",
34
+ "vite": "^8.3.8",
35
+ "wrangler": "^4.162.0"
36
+ },
37
+ "imports": {
38
+ "#lib": "./src/lib/index.ts",
39
+ "#lib/*": "./src/lib/*"
40
+ },
41
+ "description": "A kitcms website: pages with blocks, a blog, team, legal pages and site settings."
42
+ }
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ esbuild: true
3
+ workerd: true
@@ -0,0 +1,23 @@
1
+ /* Page-level resets. The tokens and shared classes live in `lib/site.css`. */
2
+ @import '@fontsource-variable/hanken-grotesk';
3
+ @import './lib/site.css';
4
+
5
+ *,
6
+ *::before,
7
+ *::after {
8
+ box-sizing: border-box;
9
+ }
10
+ html {
11
+ -webkit-text-size-adjust: 100%;
12
+ color-scheme: light dark;
13
+ scroll-padding-top: 5rem;
14
+ }
15
+ body {
16
+ margin: 0;
17
+ overflow-wrap: break-word;
18
+ }
19
+ img {
20
+ max-width: 100%;
21
+ height: auto;
22
+ display: block;
23
+ }
@@ -0,0 +1,22 @@
1
+ // See https://svelte.dev/docs/kit/types#app.d.ts
2
+ // Bindings come from `import { env } from 'cloudflare:workers'`, typed via Cloudflare.Env.
3
+ import type config from './kitcms.config';
4
+
5
+ declare module '@kitcms/core' {
6
+ interface Register {
7
+ config: typeof config;
8
+ }
9
+ }
10
+
11
+ declare global {
12
+ namespace Cloudflare {
13
+ interface Env {
14
+ DB: D1Database;
15
+ BUCKET: R2Bucket;
16
+ /** Better Auth signing secret: `.dev.vars` locally, `wrangler secret put` when deployed. */
17
+ BETTER_AUTH_SECRET: string;
18
+ }
19
+ }
20
+ }
21
+
22
+ export {};
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ %sveltekit.head%
7
+ </head>
8
+ <body data-sveltekit-preload-data="hover">
9
+ <div style="display: contents">%sveltekit.body%</div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,4 @@
1
+ import { kitcms } from '@kitcms/core/sveltekit';
2
+ import config from './kitcms.config';
3
+
4
+ export const handle = kitcms({ config }).handle;
@@ -0,0 +1,19 @@
1
+ // Client-side admin options (shipped to the browser, so no server code here).
2
+ // Live preview: every block renders through the same Svelte components as the public site.
3
+ import { defineAdmin } from '@kitcms/ui';
4
+
5
+ const preview = () => import('#lib/blocks/AdminPreview.svelte');
6
+
7
+ export default defineAdmin({
8
+ previews: {
9
+ blocks: {
10
+ hero: preview,
11
+ richText: preview,
12
+ features: preview,
13
+ gallery: preview,
14
+ cta: preview,
15
+ teamGrid: preview,
16
+ latestPosts: preview,
17
+ },
18
+ },
19
+ });