Skip to content

feat[worker]: add headless/API-only deployment mode#89

Open
ignaciojimenez wants to merge 2 commits intoSharzyL:goshujinfrom
ignaciojimenez:feat/headless-mode
Open

feat[worker]: add headless/API-only deployment mode#89
ignaciojimenez wants to merge 2 commits intoSharzyL:goshujinfrom
ignaciojimenez:feat/headless-mode

Conversation

@ignaciojimenez
Copy link
Contributor

Adds a HEADLESS_MODE environment variable for API-only deployments.

When enabled, the index route serves a minimal landing page with curl
usage instructions instead of the React frontend. URL redirect (/u/)
and article rendering (/a/) return 403, since they depend on the UI.
All read/write/delete API routes are unaffected.

Includes tests and documentation updates.

Add HEADLESS_MODE configuration that disables the React upload UI,
URL redirects (/u/), and article rendering (/a/) for API-only
deployments. The index page becomes a minimal HTML landing page
with usage instructions.

Routes unaffected: paste CRUD (POST, GET, PUT, DELETE), display
page (/d/), metadata (/m/), HEAD, docs (/api, /tos), and static
assets.
@SharzyL
Copy link
Owner

SharzyL commented Mar 16, 2026

I wonder what is headless mode used for. If it is used for CLI-only cases, should it return plain text instead of an HTML page?

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ignaciojimenez
Copy link
Contributor Author

Good question. My main use case is using this as a CRUD interface to Cloudflare KV/R2 storage — a lightweight paste service without the React frontend, CLI-focused or embedded in infrastructure where the SPA isn't needed. I think others might find it useful for the same reason: a simple, deployable API layer on top of Cloudflare storage.

Headless mode disables the upload UI, URL redirects (/u/), and article rendering (/a/), while keeping paste CRUD and the display page (/d/) intact.

For the landing page: you're right that plain text would be more consistent with the CLI-only philosophy. I can switch it to return text/plain — something like:

Pastebin (API-only mode)

Upload:  curl -Fc=@file.txt https://example.com
Docs:    https://example.com/api

Would that work, or do you have a different preference?

(Also pushed a fix for the failing CI — was a missing .js extension on a test import.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants