https://github.com/srmdn/foliocms
Lightweight, self-hosted CMS for Astro: markdown files, SQLite, REST API
https://github.com/srmdn/foliocms
astro cms golang markdown self-hosted sqlite
Last synced: 3 months ago
JSON representation
Lightweight, self-hosted CMS for Astro: markdown files, SQLite, REST API
- Host: GitHub
- URL: https://github.com/srmdn/foliocms
- Owner: srmdn
- License: mit
- Created: 2026-03-27T00:44:21.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-04T08:49:41.000Z (3 months ago)
- Last Synced: 2026-04-04T17:11:34.381Z (3 months ago)
- Topics: astro, cms, golang, markdown, self-hosted, sqlite
- Language: TypeScript
- Homepage: https://foliocms.com
- Size: 249 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
- Governance: GOVERNANCE.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Folio
A lightweight, self-hostable CMS. Single Go binary. SQLite. Ships with a default Astro theme. No Docker required.
## Why
Most open source CMS options are either too heavy (WordPress, Ghost) or too opinionated about the frontend (Payload, Strapi). Folio is built for developers who self-host on a cheap VPS and want:
- A real Markdown editor out of the box
- A default frontend theme they can swap
- Zero external dependencies: no PostgreSQL, no Redis, no Docker
- One systemd service and done
## Requirements
- Go 1.21+
- Node.js 18+ and npm
- Git
- Linux or macOS
> **Note:** Node.js 22 or later is required for the default theme (Astro 6).
## Install
Download and review the installer, then run it:
```bash
curl -O https://raw.githubusercontent.com/srmdn/foliocms/main/install.sh
bash install.sh
```
This will:
1. Clone Folio and build the binary from source
2. Clone and build the default Astro theme
3. Create a `.env` file with a generated `JWT_SECRET`
4. Run the first-time setup wizard to create your admin account
By default, everything is installed into `./folio/`. To use a different directory:
```bash
bash install.sh --dir /opt/folio
```
## Running
After install:
```bash
cd folio
# Start the backend API (default port 8090)
./folio
# In a separate terminal: start the theme (default port 4321)
cd theme && node dist/server/entry.mjs
```
For production, run both as systemd services. See [docs/configuration.md](docs/configuration.md) for all environment variables.
## First-time setup
The installer runs `--setup` for you. If you need to re-run it later:
```bash
./folio --setup
```
This creates the admin account interactively. You can also set `ADMIN_EMAIL` and `ADMIN_PASSWORD` in `.env` instead.
## Configuration
All configuration is via `.env`. See [docs/configuration.md](docs/configuration.md) for the full reference.
Key variables:
| Variable | Default | Description |
|---|---|---|
| `PORT` | `8090` | Backend API port |
| `JWT_SECRET` | (none) | Required. Generate with `openssl rand -hex 32` |
| `CONTENT_DIR` | `content/blog` | Path to Markdown content |
| `THEME_DIR` | `theme` | Path to the theme directory |
| `THEME_BUILD_CMD` | `npm run build` | Command to rebuild the theme |
| `THEME_SERVICE` | (none) | systemd service name to restart after rebuild |
## Admin Dashboard
Folio includes a built-in admin dashboard at `/admin`. No separate service or install step required — it is embedded in the Go binary.
| Path | Description |
|------|-------------|
| `/admin/login` | Sign in |
| `/admin/posts` | Create, edit, publish, and delete posts |
| `/admin/subscribers` | View and remove newsletter subscribers |
| `/admin/settings` | Trigger a site rebuild and view build status |
The post editor uses [Milkdown](https://milkdown.dev), a WYSIWYG Markdown editor with support for headings, lists, code blocks, tables, and more. Press **Cmd+S** (or **Ctrl+S** on Windows/Linux) to save at any time.
## API
Full API reference: [docs/api.md](docs/api.md)
## Theme
Folio ships with [foliocms-theme-default](https://github.com/srmdn/foliocms-theme-default), an Astro SSR theme. The installer sets it up automatically.
To build a custom theme, see [docs/theme-contract.md](docs/theme-contract.md).
## Architecture
- **Backend**: Go, Chi router, SQLite (`modernc.org/sqlite`, pure Go, no CGo)
- **Auth**: JWT (cookie + Bearer header) + stateless CSRF (HMAC-SHA256)
- **Default theme**: Astro SSR (separate repo)
- **Content**: Markdown files with YAML frontmatter in `content/blog//index.md`
## License
MIT