Kinetic
Kinetic turns a .kinetic schema into PostgreSQL SQL, a typed TypeScript client and an embedded SvelteKit admin. Your project keeps its own routes, editor overrides and hooks.
From schema to outputs
Section titled “From schema to outputs”kinetic/schema.kineticthe file you writekinetic/schema.generated.sqlPostgreSQL bootstrap SQLsrc/lib/server/generated/Prisma client for server codesrc/lib/kinetic/generated/Typed contract, content client and admin manifest/adminSvelteKit admin rendered by @kinetic/cms
bun run generate to update the generated outputs. Keep custom UI and hooks in project-owned files.One model, followed through
Section titled “One model, followed through”The Book model from the Bukinistika demo, and what each generated layer makes of it.
Schema. An excerpt of the model you write. Attributes in the @kinetic namespace drive the admin.
model Book { id Int @id @default(autoincrement()) title String @kinetic.label("Заглавие") @kinetic.public priceCents Int @kinetic.label("Цена (€)") @kinetic.currency("EUR") @kinetic.input("euro") @kinetic.public stockQuantity Int @map("quantity") @default(0) @kinetic.label("Наличност") @kinetic.public authors Author[] @relation("BookAuthors") @kinetic.reference @kinetic.label("Автори")
@@kinetic.collection(slug: "books", label: "Книги", area: "catalogue", group: ["Каталог"]) @@kinetic.list([title, priceCents, stockQuantity])}SQL. The table in schema.generated.sql. Relation tables and indexes follow it.
CREATE TABLE "Book" ( "id" SERIAL NOT NULL, "sourceId" TEXT, "title" TEXT NOT NULL, "priceCents" INTEGER NOT NULL, "quantity" INTEGER NOT NULL DEFAULT 0, "shelfLocation" TEXT, "description" TEXT, "isbn" TEXT, "coverFile" TEXT,
CONSTRAINT "Book_pkey" PRIMARY KEY ("id"));Typed client. The storefront calls the generated content client. The row type includes the ID and the fields marked @kinetic.public.
import { content } from '$lib/kinetic/generated/client';import { authEnabled } from '$lib/server/auth';import type { PageServerLoad } from './$types';
export const load = (async ({ fetch, url }) => ({ ...await content(fetch).list('books', { q: url.searchParams.get('q') ?? undefined, page: Number(url.searchParams.get('page') ?? 1) }), authEnabled})) satisfies PageServerLoad;Admin. The scaffolded SvelteKit route loads CMS data and the collections the admin can access.
import { cms } from '$lib/server/cms';import type { Actions, PageServerLoad } from './$types';
export const load = (async (event) => { const [data, navigation] = await Promise.all([cms.load(event), cms.navigation(event)]); return { ...data, navigation };}) satisfies PageServerLoad;export const actions = cms.actions satisfies Actions;
- Run the Bukinistika demo with disposable PostgreSQL. Quickstart
- Define models and work with the generated types. Schema guide
- Read the latest changes. Changelog