Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Posts

demo of 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

VariableDescriptionDefault
POSTS_PASSWORDPassword for admin loginchangeme
POSTS_API_KEYAPI key for POST /api/posts and POST /api/files(unset)
POSTS_DB_PATHSQLite database file pathposts.sqlite
UPLOADS_DIRDirectory for uploaded files (used when R2 unset)uploads
SITE_URLPublic URL for RSS feed and linkshttp://localhost:3000
HOSTServer bind address127.0.0.1
PORTServer port3000
COOKIE_SECUREEnable HTTPS-only cookiesfalse
R2_BUCKETCloudflare R2 bucket name (enables R2 storage)(unset)
R2_ACCOUNT_IDCloudflare account ID(unset)
R2_ACCESS_KEY_IDR2 access key ID(unset)
R2_SECRET_ACCESS_KEYR2 secret access key(unset)
R2_PUBLIC_URLPublic 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.

Deploy on Railway

Docker

cd apps/posts
cp .env.example .env
# Edit .env with your password
docker compose up -d

This will start Posts on port 3000 with a persistent volume for the SQLite database and uploads.

Binary

Install with Homebrew:

brew install stevedylandev/tap/posts

Or 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

MethodPathDescription
GET/api/posts?limit=30List published posts
GET/api/posts/{slug}Get a published post by slug
POST/api/postsCreate a post
POST/api/filesUpload a file

POST /api/posts requires an x-api-key header matching POSTS_API_KEY. The JSON body accepts:

FieldDescriptionDefault
contentMarkdown content (required)—
titlePost title(none)
slugURL slugDerived from title, or a random ID
statusdraft or publisheddraft
published_datePublish date (RFC3339 or YYYY-MM-DD)Now
langLanguage codeen
tagsComma-separated tags(none)
aliasAlternate path that redirects to the post(none)
canonical_urlCanonical URL(none)
meta_descriptionMeta description(none)
meta_imageMeta image URL(none)
weatherWeather stringFetched 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-photo

Acknowledgements

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.