Cosmolo is a SvelteKit-native
content management package.

Add Markdown-based blogging to any SvelteKit project in minutes.

The Foundation

SvelteKit Native

An npm package, not a framework. Add content management to your existing SvelteKit project without owning your routes or components.

Type-Safe Content

Frontmatter is validated with Zod at build time. Malformed articles fail loudly during build, ensuring your site is always robust.

Config over Convention

Site identity and taxonomy are JSON files. No source code changes are needed to add categories — just edit config/categories.json.

Headless-Ready

Static JSON endpoints are generated at build time alongside your HTML pages. Consume your content from any frontend or external app — no server required.

CLI Generators

Scaffold routes interactively with bunx cosmolo init. Generate articles, pages, and categories from the command line — no manual file setup required.

SSG & SSR Support

All content is bundled at build time with no fs access at runtime. Works with adapter-static for SSG or any serverless adapter including Cloudflare Workers.

Why Cosmolo?

You've built your SvelteKit app. The router, the components, the deployment pipeline — it's all yours. Cosmolo lets you keep all of it while adding a full content management layer on top.

Run bunx cosmolo init, answer two questions, and your existing project gains article listings, category pages, tag pages, an RSS feed, a sitemap, and a headless JSON API — without touching a single existing route or component.

"Your SvelteKit app, unchanged. Your content, managed."

Comparison

FeatureCosmoloAstroNuxt Content
FrameworkSvelteKitAstroNuxt (Vue)
MarkdownMDSveX + markedBuilt-inBuilt-in
Type-safe frontmatterZodTS inferenceZod (opt)
Component in MarkdownYes (.svx)Yes (.mdx)Yes
Config-driven categoriesYesNoNo
Headless CMS (JSON API)YesManualManual
Learning curveSvelteKit onlyAstro conceptsVue + Nuxt

How It Works

Install Cosmolo into any existing SvelteKit project, register the Vite plugin, and run bunx cosmolo init to scaffold routes interactively. No framework switching, no new mental model — just Markdown and SvelteKit.

Zero-Friction Setup

Add Cosmolo to any existing SvelteKit project with a single install. Register the Vite plugin and define your config — all content is bundled at build time with no fs access at runtime, making it fully compatible with Cloudflare Workers and other serverless runtimes.

  • bunx cosmolo init scaffolds routes interactively
  • Compatible with any SvelteKit adapter
  • No runtime file-system access
vite.config.ts / cosmolo.config.ts
// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import { cosmoloPlugin } from 'cosmolo/plugin';
import config from './cosmolo.config';

export default {
  plugins: [sveltekit(), cosmoloPlugin(config)],
};

// cosmolo.config.ts
import { resolveConfig } from 'cosmolo/plugin';

export default resolveConfig({
  articlesDir: 'src/content/articles',
  pagesDir:    'src/content/pages',
});

Taxonomy & Organization

Manage your content's hierarchy through a simple JSON registry. Define categories with meaningful labels and descriptions that automatically generate dedicated listing pages. Articles with an unrecognized category fall back to /categories/other automatically.

  • Dynamic category routing
  • Automatic "Other" category fallback
  • Description-driven category headers
config/categories.json
// config/categories.json
{
  "tech": {
    "label": "Technology",
    "description": "Articles about software and tools."
  },
  "design": {
    "label": "Design",
    "description": "Articles about UI/UX design."
  }
}

Expressive Authorship

Write in standard Markdown or embed Svelte components with MDSveX. Frontmatter is validated with Zod at build time. Tags, series, draft mode, and git-based updated dates are all supported out of the box.

  • MDSveX (.svx) for interactive content
  • Type-safe Zod frontmatter validation
  • Tags, series, draft mode, and related articles
src/content/articles/my-post.svx
---
title: "My Article"
category: "tech"
excerpt: "A deep dive into cosmic web structures."
sort: 100
date: "2025-01-15"
tags: ["svelte", "tutorial"]
---

# Introduction

Cosmolo supports standard Markdown and
**Svelte components** via MDSveX (.svx).

<Callout type="tip">
  This is a Svelte component inside Markdown!
</Callout>