A static Mastodon-compatible API server powered by markdown files and Cloudflare Workers.
- Write in Markdown - Create posts as simple markdown files with frontmatter
- Mastodon-Compatible - Works with existing Mastodon clients
- No Database - All data compiled to static JSON at build time
- Serverless - Runs on Cloudflare Workers, serves from R2
- Simple - ~200 lines of TypeScript total
octodon/
├── posts/ # Your markdown posts
├── account.json # Your account information
├── src/
│ ├── build.ts # Compiles markdown → JSON
│ └── worker.ts # Cloudflare Worker (API endpoints)
├── wrangler.toml # Cloudflare config
└── package.json
npm installEdit account.json with your information.
Create markdown files in posts/ with frontmatter:
---
date: 2025-01-15T10:30:00.000Z
visibility: public
---
Your post content in **markdown** format.npm run buildThis generates dist/posts.json.
npx wrangler r2 bucket create octodon-datanpx wrangler r2 object put octodon-data/posts.json --file=dist/posts.jsonnpm run deploy# Get public timeline
curl https://octodon.YOUR_USERNAME.workers.dev/api/v1/timelines/public
# Get instance info
curl https://octodon.YOUR_USERNAME.workers.dev/api/v1/instanceTest locally with:
npm run devNote: Local dev mode won't have access to R2. You'll need to mock the data or test after deploying.
GET /api/v1/timelines/public- Public timelineGET /api/v1/statuses/:id- Individual statusGET /api/v1/instance- Instance informationGET /api/v1/accounts/:id- Account information
date- ISO 8601 timestamp (or extracted from filename)visibility-public,unlisted,private,direct(default:public)sensitive- Boolean (default:false)spoiler_text- Content warning text (default:"")language- ISO 639-1 code (default:en)
- Pagination (returns all posts, clients handle display)
- ActivityPub federation
- Replies, boosts, favorites
- Media uploads (can link to external images in markdown)
- Search
- Authentication (read-only API)
MIT