Transform your GitHub Gists into a beautiful, fast blog powered by Cloudflare Workers.
This blog system displays only public gists. For best practices, use a GitHub token with minimal permissions and consider using a dedicated GitHub account for blog content.
- π GitHub Gists as Posts - Write in Gist, publish instantly
- π·οΈ Tag System - Organize posts with
#hashtagsin descriptions - π Dark Mode - Automatic theme switching based on system preference
- β‘ Lightning Fast - Powered by Cloudflare Workers edge network
- π SEO Optimized - Meta tags, sitemap.xml, RSS feed included
- π± Mobile Responsive - Beautiful on all devices
- ποΈ Smart Caching - KV storage for optimal performance
- π¦ Local Management - Powerful Go CLI tools for gist operations
- GitHub account with personal access token
- Cloudflare account (free tier works)
- Go 1.19+ (for CLI tools)
- Node.js 16+ (for deployment)
git clone https://github.com/yourusername/gist-blog.git
cd gist-blog
# Install dependencies
npm install
# Set environment variables
export GITHUB_USER="your-github-username"
export GITHUB_TOKEN="ghp_your_token_here"# Login to Cloudflare
wrangler login
# Set required secrets
wrangler secret put GITHUB_USER
# Enter: your-github-username
wrangler secret put GITHUB_TOKEN
# Enter: ghp_your_token_here
wrangler secret put SITE_URL
# Enter: https://your-domain.com
wrangler secret put SITE_NAME
# Enter: Your Blog Name
# Deploy to Cloudflare
wrangler deploy# Build and install the CLI
make build
make install-cli
# Write a post
echo "# My First Post\n\nHello from Gist Blog!" > post.md
# Publish to GitHub as a public gist
gist publish -p -d "My First Blog Post #introduction #hello" post.mdVisit your blog at https://your-domain.com π
Create posts as GitHub Gists with markdown files:
# Your Post Title
Write your content in **Markdown** with full support for:
- Lists
- Code blocks
- Images
- Links
- And more!# Publish a new post
gist publish -p -d "Post Title #tag1 #tag2" post.md
# List all posts
gist list
# Show a specific post
gist show <gist-id>
# Sync gists from GitHub
gist sync
# Interactive TUI
gist tuimake help # Show all commands
make dev # Local development
make deploy # Deploy to production
make build # Build gist CLI
make install-cli # Install gist command
make pull # Pull latest from GitHub
make status # Show staged changes
make list # List all posts
make search Q=term # Search postsβββ worker.js # Cloudflare Worker (edge deployment)
β βββ GistBlog class # Main application
β βββ GitHubService # GitHub API client
β βββ CacheService # KV caching layer
β βββ MarkdownParser # Built-in markdown rendering
β βββ ResponseFactory # HTTP response helpers
β
βββ cmd/gist/ # Go CLI entry point
β βββ main.go
β
βββ internal/ # Go packages
βββ cli/ # Command infrastructure
βββ commands/ # CLI commands (publish, list, sync, show, tui)
βββ domain/ # Business entities
βββ service/ # Business logic
βββ storage/ # Data layer (cache, config, GitHub client)
name = "your-blog"
main = "worker.js"
compatibility_date = "2024-01-01"
# Optional: KV namespace for caching
[[kv_namespaces]]
binding = "GIST_CACHE"
id = "your-kv-id"
# For custom domain
[[routes]]
pattern = "yourdomain.com/*"
zone_name = "yourdomain.com"Note: Secrets (GITHUB_USER, GITHUB_TOKEN, SITE_URL, SITE_NAME) are configured via wrangler secret commands, not in wrangler.toml.
| Variable | Description | Required |
|---|---|---|
GITHUB_USER |
Your GitHub username | β |
GITHUB_TOKEN |
Personal access token | β |
SITE_URL |
Your blog URL (e.g., https://blog.example.com) | β |
SITE_NAME |
Your blog name | β |
GIST_CACHE |
KV namespace binding | β (recommended) |
Add hashtags to gist descriptions for automatic categorization:
"My Docker Tutorial #docker #devops #tutorial"
Tags become clickable links: /tag/docker
Available at /rss.xml for feed readers. Includes:
- Latest 20 posts
- Full metadata
- Category tags
- Semantic HTML5 structure
- Meta descriptions from post excerpts
- Open Graph tags for social sharing
- Automatic sitemap generation
- Canonical URLs
- Edge deployment (< 50ms latency worldwide)
- KV caching reduces GitHub API calls
- Optimized asset delivery
- Minimal JavaScript (none by default)
- Add domain to Cloudflare
- Update
wrangler.toml:[[routes]] pattern = "blog.yourdomain.com/*" zone_name = "yourdomain.com"
- Deploy:
wrangler deploy
Use GitHub CLI to edit existing gists:
gh gist edit <gist-id> updated-content.mdThen clear the cache to see changes immediately:
wrangler kv key delete --binding GIST_CACHE "gist-<gist-id>"Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - see LICENSE file for details.
- Built with Cloudflare Workers
- Inspired by static site generators
- Powered by GitHub's Gist API
Transform your GitHub gists into a beautiful blog in minutes, not hours.