| name | markdown-site |
| description | Comprehensive reference for markdown-site development with Convex, React, and Vite. Use when working on content sync, frontmatter configuration, Convex queries/mutations, or full-stack features. |
Markdown Site Development
Complete guide for developing the markdown-site project - a React + Vite + Convex blog platform with instant content sync.
Quick Reference
Project Architecture
content/blog/*.md ──┐
├──▶ npm run sync ──▶ Convex DB ──▶ React Site
content/pages/*.md ──┘
Tech Stack:
- Frontend: React 18 + TypeScript + Vite
- Backend: Convex (real-time serverless)
- Styling: CSS variables (no preprocessor)
- Hosting: Netlify with edge functions
- Content: Markdown with gray-matter frontmatter
Common Commands
npm run sync
npm run sync:prod
npm run sync:all
npm run import https://example.com/article
npm run dev
npm run build
Content Structure
Blog Posts
Location: content/blog/*.md
Required frontmatter:
---
title: "Post Title"
description: "SEO description"
date: "2025-01-15"
slug: "post-slug"
published: true
tags: ["tag1", "tag2"]
---
Pages
Location: content/pages/*.md
Required frontmatter:
---
title: "Page Title"
slug: "page-slug"
published: true
---
Convex Patterns
Always Use Indexes
const post = await ctx.db
.query("posts")
.withIndex("by_slug", (q) => q.eq("slug", args.slug))
.first();
const post = await ctx.db
.query("posts")
.filter((q) => q.eq(q.field("slug"), args.slug))
.first();
Function Structure
export const myQuery = query({
args: { slug: v.string() },
returns: v.union(v.object({...}), v.null()),
handler: async (ctx, args) => {
},
});
Idempotent Mutations
export const update = mutation({
args: { id: v.id("posts"), content: v.string() },
returns: v.null(),
handler: async (ctx, args) => {
await ctx.db.patch(args.id, { content: args.content });
return null;
},
});
Key Indexes
posts
.index("by_slug", ["slug"])
.index("by_published", ["published"])
.index("by_featured", ["featured"])
.searchIndex("search_title", { searchField: "title" })
pages
.index("by_slug", ["slug"])
.index("by_published", ["published"])
File Locations
| File | Purpose |
|---|
convex/schema.ts | Database schema |
convex/posts.ts | Post queries/mutations |
convex/pages.ts | Page queries/mutations |
convex/stats.ts | Analytics |
scripts/sync-posts.ts | Content sync script |
src/config/siteConfig.ts | Site configuration |
Workflow
- Create/edit markdown in
content/blog/ or content/pages/
- Run
npm run sync to sync to Convex
- Changes appear instantly on the site
- No rebuild needed for content changes
Detailed Documentation
See reference files for complete documentation on each topic.