Back to blog
2025-02-183 tags

Welcome to your multi-source blog

An example MDX post shipped in the repo. Swap or extend with Notion, Sanity, or a DB-backed editor.

MDX
Starter
Cloudflare

Welcome πŸ‘‹

This starter is wired for three blog sources out of the box:

  • MDX in repo (this file) for content that ships with code and can be versioned.
  • Notion API for fast edits and rich layouts without deployments.
  • Sanity for a full CMS studio workflow; swap in your project ID/dataset.
  • Database for self-hosted posts (Drizzle + D1/libSQL); plug in an editor like Tiptap.

How to customize quickly:

  1. Edit or add files under content/blog/*.mdx with frontmatter fields: title, date, summary, tags.
  2. Configure Notion credentials in .env to surface remote posts.
  3. Point Sanity vars (SANITY_PROJECT_ID, SANITY_DATASET, SANITY_READ_TOKEN) to your project.
  4. For DB posts, seed posts in src/server/db/schema.ts and render them as needed.

Check /blog to see everything merged and sorted by date. Happy shipping!

What rich content looks like

Tip: MDX lets you mix Markdown + JSX. The blog page already renders Markdown; if you add custom components, export them from _app or pass via mdxComponents in the renderer.

Code blocks

// drizzle query example
import { eq } from "drizzle-orm";
import { posts } from "~/server/db/schema";
import { getDb } from "~/server/db";

const db = getDb();
const latest = await db.query.posts.findFirst({
  where: eq(posts.slug, "welcome"),
});

API payloads

{
  "title": "Welcome to your multi-source blog",
  "tags": ["MDX", "Starter", "Cloudflare"],
  "source": "mdx"
}

Tables

SourceBest forDeploy cost
MDXVersioned docs & guidesFree
NotionFast edits, rich blocksLow
SanityEditorial workflows, studioLow
DatabaseFully owned, structuredLow

Quick β€œchart” (ASCII)

Traffic β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“
MDX     β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“
Notion  β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“
DB      β–“β–“β–“β–“β–“β–“β–“β–“

Inline JSX (MDX)

MDX can render React inside posts. Use this for callouts, embeds, or charts (e.g., Recharts/Charts.js) by registering components in the MDX renderer.

Mermaid

PlantUML (pre-rendered)

PlantUML (pre-rendered)
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Token
@enduml

Graphviz (pre-rendered)

Graphviz (pre-rendered)
digraph G {
rankdir=LR;
MDX -> Renderer;
Renderer -> HTML;
HTML -> Browser;
}

Chart.js (bar)