AstroBlog

astro-theme-hiro — Astro Blog Template

By nick-cjyx9

Hiro is a minimalist Astro-based blog template with built-in Decap CMS, Pagefind search, and a Cloudflare Workers + D1 backend for likes and comments.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-02View source

What stands out

A quick read of the recorded project description.

01

An Astro-based blog template with content stored as Markdown / MDX in src/content/blog

02

Built-in Decap CMS backend for editing blog posts in the browser

03

Integrated Pagefind for site search

04

Likes and comments implemented via Cloudflare Workers + D1, with email notifications for friend links and comments

05

Centralized configuration: src/consts.ts manages site information, homepage copy, and feature toggles

06

Provides pnpm build:static for pure static output, plus a D1 data sync command

Template Details

Hiro is an Astro template for personal blogs, with code released under the MIT license. The template centralizes site identity, homepage copy, and feature toggles in src/consts.ts, while content is stored in three directories: src/content/blog, src/content/project, and src/content/friend, supporting Markdown and MDX.

The template includes a Decap CMS backend for editing posts and integrates Pagefind for site search. Likes and comments rely on Cloudflare Workers and a D1 database; optional email notifications use Resend, anti-spam verification uses Cloudflare Turnstile, and Decap CMS GitHub login requires configuring an OAuth app. These external services require you to apply for accounts and keys yourself; the template does not provide these services.

Before use, you need Node.js 20+ and pnpm 10+, then copy .env.example and .dev.vars.example and start the development server. When deploying to Cloudflare Workers, you must create a D1 database, push the Drizzle schema, and configure runtime secrets such as JWT, Turnstile, Resend, and GitHub OAuth via wrangler secret. The repository currently has few stars, and the licenses for third-party assets such as demo images, fonts, and icons need to be verified separately.

AstroBlog

Is it right for your project?

Use Cases

  • Building a personal tech blog and wanting to write with Astro and Markdown / MDX
  • Needing a visual backend to edit posts without modifying repository files directly
  • Wanting interaction data such as likes and comments to be hosted on Cloudflare Workers + D1
  • Needing basic blog features such as site search, RSS, and sitemap
  • Wanting to showcase a project portfolio or maintain a friend links list

Suitable For

  • Developers familiar with Astro or willing to configure Cloudflare services according to the documentation
  • Users deploying personal sites on Cloudflare and accepting the D1 database dependency
  • Self-media authors who prefer a minimalist blog layout focused on text content
  • Developers who need Chinese documentation reference (the repository provides README.zh-CN.md)

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Local development requires Node.js 20+ and pnpm 10+; after installing dependencies, copy .env.example and .dev.vars.example, then run pnpm dev

  2. 2

    Before deploying to Cloudflare Workers, create a D1 database and sync database_name and database_id to wrangler.jsonc and .env

  3. 3

    Runtime secrets such as JWT_KEY, CF_CAPTCHA_SECRETKEY, RESEND_API_KEY, and GitHub OAuth credentials must be configured via wrangler secret, and are only needed when enabling the corresponding features

  4. 4

    pnpm build additionally runs the D1 content sync script; for pure static output, use pnpm build:static

  5. 5

    Licenses for third-party assets such as demo images, fonts, and icons need to be verified separately and cannot be determined solely by the code's MIT license

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version in the public repository under the MIT license; the free scope applies to that version's code and does not mean external services or third-party assets are free.

Must comply with when using

  • You may use, modify, commercialize, and distribute this version's code for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Likes and comments depend on Cloudflare Workers and a D1 database; you must register a Cloudflare account and create a D1 database yourself, as the template does not provide this backend service.
  • Email notifications depend on the third-party service Resend; you must apply for a Resend account and configure keys such as RESEND_API_KEY yourself, as the template does not provide email sending services.
  • Anti-spam verification uses Cloudflare Turnstile; you must apply for a site key in the Cloudflare dashboard and configure CF_CAPTCHA_SECRETKEY yourself.
  • Decap CMS backend login depends on a GitHub OAuth app; you must create an OAuth App on GitHub and configure GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET yourself.
  • Deployment and database synchronization require a Cloudflare API Token with D1 Edit permission, which you must create in your Cloudflare account yourself.
  • The deployment process requires logging into a Cloudflare account via the Wrangler CLI, which is an external service account dependency.
  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

D1 + Workers-powered backend enabling likes and comments at zero cost.

Original README

Automatic email notifications for new friend-link requests and comments.

Original README

Optional: For Cloudflare Turnstile (Anti-spam) - Get it from https://dash.cloudflare.com/?to=/:account/turnstile

Original README

Optional: For Decap CMS GitHub OAuth - Get it from https://github.com/settings/developers (OAuth Apps)

Original README

APP_CF_API_TOKEN`: Cloudflare API Token with **D1 Edit** permissions.

Original README

Authenticate the Wrangler CLI locally:

Original README
https://github.com/nick-cjyx9/astro-theme-hiro/blob/master/LICENSEhttps://github.com/nick-cjyx9/astro-theme-hiro/blob/master/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-02. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 83 / 100
Technologies
Astro
Website type
Blog
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-04-02
Screenshot last checked
2026-10-02

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Astro as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Automatically checked against source and license rules; no manual editorial review.

Inspect the recorded source material

SHA-256: 1bdc9043cc910e4411398966e78e8398b5101e88c70bf4d6214a015d569b1514

2026-10-02T21:01:30.326Z

Source file / repository
[中文文档](./README.zh-CN.md)

# Astro Theme Hiro

<p align="center">
  <img alt="Astro" src="https://img.shields.io/badge/Astro-FF5D01?style=for-the-badge&logo=astro&logoColor=white">
  <img alt="Cloudflare" src="https://img.shields.io/badge/Cloudflare-F38020?style=for-the-badge&logo=Cloudflare&logoColor=white">
  <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white">
  <img alt="Tailwind CSS" src="https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white">
</p>

Hiro is a minimalist yet powerful Astro blog template.

## Preview

<table>
  <tr>
    <td align="center">
      <img src="./.github/readme/index-light.png" alt="Home light mode" /><br />
      Home (Light)
    </td>
    <td align="center">
      <img src="./.github/readme/index-dark.png" alt="Home dark mode" /><br />
      Home (Dark)
    </td>
  </tr>
  <tr>
    <td align="center">
      <img src="./.github/readme/post-content.png" alt="Post content page" /><br />
      Post Content
    </td>
    <td align="center">
      <img src="./.github/readme/decap-cms.png" alt="Decap CMS admin" /><br />
      Decap CMS
    </td>
  </tr>
</table>

## Key Features

- Automatic email notifications for new friend-link requests and comments.
- D1 + Workers-powered backend enabling likes and comments at zero cost.
- Built-in Decap CMS for easier blog post editing.
- Pagefind integration for fast on-site search.

## Project Structure (Template User Perspective)

### Configuration Files

- `src/consts.ts`: Core site identity, homepage copy, and feature flags (`ENABLE_*`).
- `astro.config.ts`: Astro integrations, output mode, and markdown/search/sitemap settings.
- `wrangler.jsonc`: Cloudflare Worker configuration and D1 database bindings.
- `.env`: Build-time variables and API credentials (site URL, repo info, D1 config).
- `.dev.vars`: Runtime secrets for local Worker preview.
- `src/content.config.ts`: Content collection schemas and loader rules.

### Content Directory

- `src/content/blog/`: Your blog posts (`.md` / `.mdx`).
- `src/content/project/`: Portfolio and project showcase entries.
- `src/content/friend/`: Friend links and blogroll entries.

## Local Development Guide

### Prerequisites

- Node.js 20+
- pnpm 10+

### Quick Start

```bash
# Install dependencies
pnpm install

# Prepare environment variable files
cp .env.example .env
cp .dev.vars.example .dev.vars

# Start the development server
pnpm dev
```

After startup, visit `http://localhost:4321` in your browser.

## Deployment Tutorial (Cloudflare Worker + D1)

### 1) Prepare Your Cloudflare Account

1. Sign up or log in to your [Cloudflare Dashboard](https://dash.cloudflare.com/).
2. Authenticate the Wrangler CLI locally:

```bash
pnpm wrangler login
```

### 2) Configure Environment Variables

```bash
cp .env.example .env
cp .dev.vars.example .dev.vars
```

Update `.env` with your specific details before deploying:

- `SITE_URL`: Your final production URL.
- `GITHUB_REPO` / `REPO_BRANCH`: Your GitHub repository format (`username/repo`) and branch name.
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare Account ID (found on the right sidebar of the Cloudflare dashboard).
- `APP_CF_ACCOUNT_ID`: Same as above.
- `APP_CF_API_TOKEN`: Cloudflare API Token with **D1 Edit** permissions. [Create one here](https://dash.cloudflare.com/profile/api-tokens).
- `NODE_ENV=production`: Required for pushing schema to the remote D1 database.

### 3) Create and Bind the D1 Database

Create a new D1 database:

```bash
pnpm wrangler d1 create astro-blog-template
```

Update your `wrangler.jsonc` with the output provided by the command:

- Update `d1_databases[0].database_name` and `database_id`.
- Update `name` if you want a different Worker name.

**Important:** Also set `APP_CF_D1_DATABASE_ID` in your `.env` file to the same database ID.

### 4) Initialize the Database Schema

Push the Drizzle schema to your remote D1 database:

```bash
pnpm db:push
```

### 5) Configure Production Secrets

Depending on the features enabled in `src/consts.ts`, securely store your runtime secrets in Cloudflare using Wrangler:

```bash
# Optional: For JWT Authentication (Generate using `openssl rand -hex 32` or any random strong string)
pnpm wrangler secret put JWT_KEY

# Optional: For Cloudflare Turnstile (Anti-spam) - Get it from https://dash.cloudflare.com/?to=/:account/turnstile
pnpm wrangler secret put CF_CAPTCHA_SECRETKEY

# Optional: For Email Notifications via Resend - Get it from https://resend.com/api-keys
pnpm wrangler secret put RESEND_API_KEY
pnpm wrangler secret put RESEND_EMAIL_FROM
pnpm wrangler secret put RESEND_EMAIL_TO

# Optional: For Decap CMS GitHub OAuth - Get it from https://github.com/settings/developers (OAuth Apps)
pnpm wrangler secret put GITHUB_CLIENT_ID
pnpm wrangler secret put GITHUB_CLIENT_SECRET
```

### 6) Build and Deploy

```bash
# Generate the Astro production build
pnpm build

# Deploy to Cloudflare Workers
pnpm wrangler deploy
```

> **Note**: `pnpm build` not only generates Astro output, but also runs a D1 content sync script.

### 7) Post-Deployment Verification

1. Visit your deployed Worker URL to ensure the homepage and articles load correctly.
2. Verify system routes: `/rss.xml`, `/sitemap-index.xml`, and `/search`.
3. If enabled, test the comment system, friend link submissions, email notifications, and the CMS admin panel (`/admin`).

## Common Commands

```bash
pnpm dev          # Start local development server
pnpm build        # Generate production build (with wrangler types)
pnpm build:static # Generate static-only output
pnpm preview      # Local Cloudflare-style preview
pnpm code:check   # Run Astro check + Biome lint/format
pnpm db:push      # Push database schema changes via Drizzle
pnpm sync         # Sync remote D1 data to local SQLite database
```

## Documentation & Policies

- Contribution Guide: [`CONTRIBUTION.md`](./CONTRIBUTION.md)
- Contribution Guide (Chinese): [`CONTRIBUTION.zh-CN.md`](./CONTRIBUTION.zh-CN.md)
- Security Policy: [`SECURITY.md`](./SECURITY.md)

## License

This project is licensed under the terms described in the `LICENSE` file.
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.