Posts

A self-hosted blog CMS built in Go.
- Single Go binary with embedded assets
- Password authentication with session cookies
- Create, edit, publish, and delete blog posts with markdown
- Static pages with custom navigation links
- File uploads with admin management
- Custom CSS support from the admin panel
- RSS feed at
/feed.xml - JSON API for reading and creating posts
- Dark themed UI with Commit Mono font
- SQLite for persistent storage
Configure
Environment Variables
| Variable | Description | Default |
|---|---|---|
POSTS_PASSWORD | Password for admin login | changeme |
POSTS_API_KEY | API key for POST /api/posts and POST /api/files | (unset) |
POSTS_DB_PATH | SQLite database file path | posts.sqlite |
UPLOADS_DIR | Directory for uploaded files (used when R2 unset) | uploads |
SITE_URL | Public URL for RSS feed and links | http://localhost:3000 |
HOST | Server bind address | 127.0.0.1 |
PORT | Server port | 3000 |
COOKIE_SECURE | Enable HTTPS-only cookies | false |
R2_BUCKET | Cloudflare R2 bucket name (enables R2 storage) | (unset) |
R2_ACCOUNT_ID | Cloudflare account ID | (unset) |
R2_ACCESS_KEY_ID | R2 access key ID | (unset) |
R2_SECRET_ACCESS_KEY | R2 secret access key | (unset) |
R2_PUBLIC_URL | Public URL prefix for uploaded files | (unset) |
Upload storage falls back to local filesystem (UPLOADS_DIR) when R2_BUCKET is empty. Set all five R2_* variables to switch uploads to Cloudflare R2.
If POSTS_API_KEY is not set, POST /api/posts and POST /api/files return 403. The read-only GET endpoints are always public.
Deploy
Railway
The easiest way to deploy Posts is with the one-click Railway template. See the Deploying with Railway guide for a walkthrough of the process. Posts requires POSTS_PASSWORD and SITE_URL to be set during the configure step.
Docker
cd apps/posts
cp .env.example .env
# Edit .env with your password
docker compose up -dThis will start Posts on port 3000 with a persistent volume for the SQLite database and uploads.
Binary
Install with Homebrew:
brew install stevedylandev/tap/postsOr grab a prebuilt binary from the releases page.
You can also build from source:
cd apps/posts && go build .The resulting binary is self-contained with all assets embedded. Copy it to your server with a configured .env file and run it directly.
Use
Log in at /login with your configured password to access the admin panel. From there you can manage blog posts, static pages, file uploads, and site settings including custom CSS. Your blog's RSS feed is available at /feed.xml.
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/posts?limit=30 | List published posts |
GET | /api/posts/{slug} | Get a published post by slug |
POST | /api/posts | Create a post |
POST | /api/files | Upload a file |
POST /api/posts requires an x-api-key header matching POSTS_API_KEY. The JSON body accepts:
| Field | Description | Default |
|---|---|---|
content | Markdown content (required) | — |
title | Post title | (none) |
slug | URL slug | Derived from title, or a random ID |
status | draft or published | draft |
published_date | Publish date (RFC3339 or YYYY-MM-DD) | Now |
lang | Language code | en |
tags | Comma-separated tags | (none) |
alias | Alternate path that redirects to the post | (none) |
canonical_url | Canonical URL | (none) |
meta_description | Meta description | (none) |
meta_image | Meta image URL | (none) |
weather | Weather string | Fetched for the default location |
Returns 201 with the created post, 400 for invalid input, or 409 if the slug already exists.
curl -X POST https://your-posts-instance.com/api/posts \
-H "x-api-key: $POSTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Hello World", "content": "My first post via the API", "status": "published"}'POST /api/files uses the same x-api-key header and takes multipart/form-data with a file field (max 10 MB) and an optional name field to set the filename. Returns 201 with the file's url, filename, original_name, content_type, and size, or 409 if the name is taken.
curl -X POST https://your-posts-instance.com/api/files \
-H "x-api-key: $POSTS_API_KEY" \
-F file=@photo.png \
-F name=my-photoAcknowledgements
Posts is heavily inspired by Bear Blog. If you'd rather not self-host, Bear Blog is a great alternative with the same minimal, no-nonsense approach to blogging.