Skip to content

Astro Kitchen Sink

A self-contained Astro (SSR) app that exercises the full @timbl/client surface against a timbl CMS instance. Located at examples/astro-kitchen-sink/ in the repo.

Astro Kitchen Sink
Files 21
  • src 1
  • src/components 1
  • src/layouts 1
  • src/lib 1
  • src/pages 5
  • src/pages/api/auth 2
  • src/pages/assets 1
  • src/pages/case-studies 1
  • src/pages/posts 2
  • src/pages/projects 1
astro.config.mjs
javascript
import { defineConfig } from "astro/config";
import node from "@astrojs/node";

// `output: "server"` + the Node adapter means every page is rendered on
// demand. Nothing is prerendered, so `astro build` never calls the CMS and
// succeeds without a running instance. Start the CMS, then `bun run dev`.
export default defineConfig({
  output: "server",
  adapter: node({ mode: "standalone" }),
});

What it demonstrates

  • Typed reads: collection().findMany() with status / sort / limit / offset / q search / select projection.
  • Detail by slug: findBySlug() with include + depth relation expansion.
  • Relations: caseStudies -> project (single) and posts/projects -> tags (many), rendered from included records.
  • Globals: siteSettings (site name, description, socialLinks array) in the layout.
  • Markdown: renders the CMS-provided bodyHtml companion (already sanitized). No client-side markdown pipeline.
  • Assets: assets.findMany() gallery; featured images resolved via assets.findById().

Running it

Terminal window
cd examples/astro-kitchen-sink
bun install
bun run dev

The example expects a running timbl CMS at http://localhost:3000 (or whatever PUBLIC_TIMBL_BASE_URL is set to in .env). See the Quick Start for standing up the server.

File structure

src/
layouts/Base.astro # Global site shell, siteSettings globals
lib/cms.ts # Typed @timbl/client wrapper
pages/
index.astro # Public homepage (posts, case studies)
admin.astro # Admin dashboard (assets, drafts)
login.astro # Auth login
health.astro # /health check
api/auth/login.ts # Login endpoint
api/auth/logout.ts # Logout endpoint
assets/index.astro # Asset gallery