An open API service indexing awesome lists of open source software.

https://github.com/vstorm-co/astro-blog

Astro 6 blog template with built-in browser admin panel. Write & publish MDX posts without touching a text editor. 100/100 Lighthouse. Zero JS on reading pages.
https://github.com/vstorm-co/astro-blog

admin-panel astro astro-blog blog blog-template dark-mode lighthouse markdown mdx react ssg static-site-generator tailwindcss typescript vercel vstorm

Last synced: about 2 months ago
JSON representation

Astro 6 blog template with built-in browser admin panel. Write & publish MDX posts without touching a text editor. 100/100 Lighthouse. Zero JS on reading pages.

Awesome Lists containing this project

README

          

astro-blog ๐Ÿ“


The blog template that ships with a browser-based admin panel โ€” write and publish MDX posts without touching a text editor.

Built on Astro 6 + Tailwind CSS 4, zero JS on reading pages, 100 Lighthouse across all four categories.


CI
Made with Astro
Node โ‰ฅ 20
Bun โ‰ฅ 1
License: MIT
Security Policy
X



Live Demo

Dark mode
Light mode


astro-blog โ€” admin panel

---

## ๐Ÿš€ Quick Start

```bash
bunx degit vstorm-co/astro-blog my-blog && cd my-blog && bun install && bun run dev
```

Open **http://localhost:4321/admin/** โ€” your blog editor is ready.

> **npm users:** `npx degit vstorm-co/astro-blog my-blog && cd my-blog && npm install && npm run dev`

---

## โœจ Features

- ๐Ÿ›  **Built-in admin panel** โ€” browser-based MDX editor with live preview, autosave, drag-and-drop images, and a component palette. Stripped from every production build.
- โšก **Zero JS on reading pages** โ€” no framework runtime, no hydration cost. Home page ships 0 KB of JavaScript.
- ๐Ÿ“ **MDX-first** with 22 ready-made blog components: `Callout`, `Figure`, `Stat`, `Timeline`, `Terminal`, `FileTree`, `Diff`, `Gallery`, `Tweet`, `Bookmark`, and more
- ๐ŸŽจ **Single-file config** โ€” title, author, nav, socials, accent colour, feature flags all in `src/site.config.ts`
- ๐ŸŒ— **Dark + light mode** with pre-paint init (zero FOUC) and `prefers-color-scheme` fallback
- โœ๏ธ **Scheduled posts** โ€” set a future `pubDate`, post goes live on the next build after that time
- ๐Ÿท๏ธ **Tag pages** auto-generated from frontmatter
- ๐Ÿ“ก **RSS feed, sitemap, robots.txt** built at compile time
- ๐Ÿš€ **One-click deploy** to Vercel, Netlify, or Cloudflare Pages
- ๐Ÿ”ท **TypeScript + Zod schemas** โ€” typed frontmatter, zero runtime surprises
- ๐Ÿ”’ **ESLint + Prettier + Husky** โ€” enforced code style from the first commit

---

## โœ… Lighthouse Score


astro-blog Lighthouse score โ€” 100 Performance, 100 Accessibility, 100 Best Practices, 100 SEO

---

## ๐Ÿ†š Why astro-blog?

| | **astro-blog** | AstroPaper | Fuwari | Raw Astro |
| ---------------------------- | :------------: | :--------: | :----: | :-------: |
| Admin panel (browser editor) | โœ… | โŒ | โŒ | โŒ |
| Zero JS on reading pages | โœ… | โŒ | โŒ | โœ… |
| 100 Lighthouse (all 4) | โœ… | โœ… | โ€” | โ€” |
| 22 MDX components | โœ… | โŒ | โŒ | โŒ |
| Drag-and-drop image upload | โœ… | โŒ | โŒ | โŒ |
| Scheduled posts | โœ… | โŒ | โŒ | โŒ |
| Single-file config | โœ… | โœ… | โœ… | โŒ |
| Dark + light mode | โœ… | โœ… | โœ… | โ€” |
| One-click deploy | โœ… | โœ… | โœ… | โ€” |

The admin panel is the differentiator โ€” no other Astro blog template ships one.

---

## ๐Ÿ›  First 10 Minutes

After cloning, open `src/site.config.ts` and work through this list:

1. **Set your identity** โ€” `website`, `title`, `author`, `description`, `accent`
2. **Update socials** โ€” edit `src/socials.ts`, keep only the providers you use
3. **Rewrite the About page** โ€” `src/data/pages/about.mdx` or use the admin panel
4. **Delete example posts** โ€” remove everything in `src/data/blog/` and write your own
5. **Replace the favicon** โ€” drop your SVG at `public/favicon.svg`
6. **Set an OG image** โ€” 1200ร—630 PNG at `public/og-default.png` (or run `python3 scripts/generate-og.py`)
7. **Deploy** โ€” push to GitHub and click one of the deploy buttons below
8. **Protect `main`** โ€” on GitHub: require PR + CI green before merge
9. **Turn on Discussions** โ€” for open-ended questions from readers
10. **Fill `.github/FUNDING.yml`** โ€” if you accept sponsorship

---

## ๐Ÿ–Š๏ธ Writing Posts

### Option A โ€” Admin panel (recommended)

Start the dev server and open `localhost:4321/admin/`:

- **Split-pane MDX editor** with autosave (2 s debounce, `Cmd+S` forces save)
- **Component palette** โ€” click Insert, snippet + import land at your cursor
- **Image drag-and-drop** โ€” files written to `public/images/blog//`
- **Live preview** inside an iframe of the real post layout
- **Rename slug / delete post** from the sidebar

The admin panel is dev-only โ€” production builds 404 the route.

### Option B โ€” CLI

```bash
bun run new-post "My post title"
# โ†’ src/data/blog/my-post-title.mdx (draft: true by default)
```

### Frontmatter reference

```yaml
---
title: "My post title"
description: "One-line summary โ€” used in meta tags and post cards."
pubDate: 2026-05-01
updatedDate: 2026-05-15 # optional
author: "Jane Doe"
tags: ["astro", "mdx"]
draft: false # excluded from prod builds when true
featured: false # pinned to the home page featured strip
cover: "./cover.jpg" # optional, relative to the MDX file
ogImage: "/custom-og.png" # optional per-post OG override
canonicalURL: "https://โ€ฆ" # optional, for cross-posts
---
```

### Scheduling a post

Set `pubDate` to a future date. The post is invisible until the next build after that time. For automatic builds:

1. Add a `DEPLOY_HOOK_URL` repo secret (Vercel / Netlify / CF each provide one).
2. Set repo variable `SCHEDULED_REBUILD=1`.
3. `.github/workflows/scheduled-rebuild.yml` hits the hook hourly.

---

## ๐Ÿงฉ MDX Components

22 components grouped by purpose:

| Group | Components |
| ------------- | -------------------------------------------------------- |
| **Prose** | `Callout` `InfoCard` `PullQuote` `Aside` |
| **Data** | `Stat` `TwoColumn` `Comparison` `Timeline` |
| **Media** | `Figure` `Gallery` `VideoEmbed` `Tweet` `Bookmark` |
| **Technical** | `CodeGroup` `Terminal` `FileTree` `Diff` `Kbd` `Details` |
| **Structure** | `Steps` `Badge` `Divider` |

All components live in `src/components/blog/`. See them in action in `src/data/blog/mdx-component-reference.mdx`.

### Adding your own component

Drop an `.astro` file in `src/components/blog/` with three annotation comments:

```astro
{/* @mdx-label MyComponent */}
{/* @mdx-description One-line description shown in the palette. */}
{
/* @mdx-snippet

Body text

*/
}
```

The admin palette picks it up on the next refresh โ€” no other code changes needed.

---

## โš™๏ธ Configuration

| File | What you change |
| ----------------------- | --------------------------------------------------------- |
| `src/site.config.ts` | Title, author, nav, socials, accent colour, feature flags |
| `src/socials.ts` | Social links and share targets |
| `src/styles/global.css` | Design tokens โ€” colours, fonts, radii, shadows |
| `src/styles/prose.css` | Post body typography |
| `src/data/blog/` | Blog posts |
| `src/data/pages/` | About / Uses / Now / etc. |
| `public/favicon.svg` | Favicon |
| `public/og-default.png` | Default OG image (1200 ร— 630 px) |

### Feature flags

```ts
features: {
search: false, // Pagefind-powered /search/ page (requires build step)
archive: true, // /archive/ โ€” chronological post list
dynamicOg: false, // per-post OG via Satori
editPost: false, // "Edit on GitHub" link on each post
adminPanel: true, // dev-only admin UI
lightAndDarkMode: true, // theme toggle visible / hidden
}
```

---

## โšก Commands

| Command | Action |
| -------------------------- | ------------------------------------ |
| `bun run dev` | Start dev server at `localhost:4321` |
| `bun run build` | Type-check + build to `./dist/` |
| `bun run preview` | Preview the production build locally |
| `bun run new-post "Title"` | Scaffold a new draft post |
| `bun run optimize-images` | Resize + convert blog images to WebP |
| `bun run lint` | Run ESLint |
| `bun run format` | Format with Prettier |
| `bun run test` | Run Vitest unit tests |

---

## ๐Ÿ—‚ Project Structure

```
src/
โ”œโ”€ site.config.ts # โ† start here: identity, nav, features
โ”œโ”€ socials.ts
โ”œโ”€ content.config.ts # Zod schemas
โ”œโ”€ data/
โ”‚ โ”œโ”€ blog/ # MDX posts
โ”‚ โ””โ”€ pages/ # About, Uses, etc.
โ”œโ”€ layouts/ # Base / Post / Page
โ”œโ”€ components/
โ”‚ โ”œโ”€ blog/ # 22 MDX components
โ”‚ โ”œโ”€ layout/ # Header / Footer / SEO
โ”‚ โ”œโ”€ home/ # Hero / LatestPosts / FeaturedStrip
โ”‚ โ”œโ”€ post/ # PostCard / TOC / Pagination / ShareLinks
โ”‚ โ”œโ”€ islands/ # React islands (CopyCode, Search, TOC scrollspy)
โ”‚ โ””โ”€ admin/ # dev-only admin panel
โ”œโ”€ lib/
โ”‚ โ”œโ”€ posts.ts # content helpers
โ”‚ โ”œโ”€ schemas.ts # JSON-LD builders
โ”‚ โ””โ”€ slug.ts
โ”œโ”€ pages/ # file-based routes
โ””โ”€ styles/ # global.css, prose.css

public/
โ”œโ”€ favicon.svg
โ”œโ”€ og-default.png
โ”œโ”€ _headers / _redirects # Cloudflare Pages headers
โ””โ”€ images/blog// # per-post images (managed by admin)

scripts/
โ”œโ”€ new-post.ts # post scaffolder
โ”œโ”€ optimize-images.py # WebP optimiser
โ””โ”€ generate-og.py # OG image generator
```

---

## ๐Ÿšข Deploy

| Platform | One-click |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Vercel** | [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vstorm-co/astro-blog) |
| **Netlify** | [![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/vstorm-co/astro-blog) |
| **Cloudflare Pages** | [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/vstorm-co/astro-blog) |

Security headers and `/admin/*` blockers are pre-configured for all three in `vercel.json`, `netlify.toml`, and `public/_headers`.

---

## ๐Ÿ›  Tech Stack

| | |
| ------------------------ | ----------------------------------------------------------------------------------------------------- |
| **Framework** | [Astro 6](https://astro.build) |
| **Content** | [MDX](https://mdxjs.com) + Astro Content Collections |
| **Styling** | [Tailwind CSS 4](https://tailwindcss.com) + CSS custom properties |
| **Syntax highlighting** | [Shiki](https://shiki.style) via Expressive Code |
| **Editor (admin)** | [CodeMirror 6](https://codemirror.net) |
| **Type checking** | [TypeScript](https://www.typescriptlang.org) strict mode |
| **Testing** | [Vitest](https://vitest.dev) |
| **Linting / formatting** | [ESLint](https://eslint.org) + [Prettier](https://prettier.io) |
| **Git hooks** | [Husky](https://typicode.github.io/husky) + [lint-staged](https://github.com/lint-staged/lint-staged) |

---

## โ“ FAQ

**Why Astro, not Next.js?**
Content-first. Zero JS by default, typed frontmatter via content collections, no runtime framework lock-in.

**Can I use pure Markdown instead of MDX?**
Yes โ€” rename `.mdx` โ†’ `.md`. The content loader accepts both. MDX components only work in `.mdx` files.

**How do I add comments?**
We don't ship a comment system. [Giscus](https://giscus.app) takes ~10 lines at the bottom of `src/layouts/PostLayout.astro`.

**Is the admin panel safe to expose publicly?**
**No.** It has no authentication and writes to your filesystem. It binds to `127.0.0.1` in dev and production builds 404 the route.

**Will there be i18n?**
Not in this template. Use [Astro's i18n recipe](https://docs.astro.build/en/recipes/i18n/) directly.

---

## โญ Star History



Star History

---

## ๐Ÿค Contributing

See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for coding conventions, commit style, and how to run the test suite. Issues and PRs welcome.

Please read [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md) before participating. Report security vulnerabilities via [`SECURITY.md`](./SECURITY.md).

## ๐Ÿ“„ License

[MIT](./LICENSE) ยฉ [Vstorm](https://github.com/vstorm-co)

---

### Need a custom blog or content platform?

We're Vstorm โ€” an Applied Agentic AI Engineering Consultancy.

astro-blog is the template we use for our own writing. We build production-grade web apps too.


Talk to us



Built on Astro ยท Tailwind CSS ยท MDX ยท Shiki ยท CodeMirror