auth-aware-delivery
Status, 2026-08-04: not built, and not currently planned. This is a design exploration from May 2025. Nothing in it shipped.
What did ship is simpler and mostly orthogonal: OAuth login, plus comments and reactions gated on it. Markdown is still served as static files built by Docusaurus and pushed to S3 β there is no server-side markdown gateway, no per-file UUID, and no auth-level filtering of content.
Keep the page for the thinking. Don't read it as a roadmap.
Once you bring authorization-aware delivery into the mix, youβre essentially building a smart content gateway. Every Markdown file becomes a secured asset, with variable visibility based on the requester.
Below: what this architecture means, where it shines, and how to implement it without slowing yourself down.
π§ The Model: Markdown-as-Restricted-Contentβ
Concept:β
Every markdown file is:
- Identified by a
UUID - Parsed server-side
- Filtered by auth level
- Then sent to the frontend for rendering
GET /markdowns/:uuid
Authorization: Bearer <JWT or session>
Returns:
{
"front_matter": { ... },
"body": "<filtered markdown string>"
}
π Why This Is Necessaryβ
If you want:
{auth=adminOnly}style in-markdown gates- Sections that vary per user (like a comment box that only shows if logged in)
- Logging which parts of content get read
- Gamified or progressive unlocks
...then you must control delivery from the server.
π§ How It Works (At a High Level)β
1. Parse the Markdown server-sideβ
- Use any parser that gives you access to AST or just plain text blocks
- Extract
{auth=...}directives
2. Authenticate the requestβ
- Session, JWT, API key, whatever
3. Transform the documentβ
- Strip unauthorized blocks
- Optionally insert βlockedβ placeholders or progress hints
4. Return to the frontendβ
- Can still be hydrated via MDX if needed, or rendered raw
π Suggested Folder Structure (Server-side)β
markdowns/
65cc66.md β actual content
65cc66.meta β front matter or cached AST
_category_.json
βοΈ Backend Endpointβ
GET /api/markdowns/:uuid
Header: Authorization: Bearer xyz
Backend does:
- Load markdown file
- Parse front matter and
{auth=}blocks - Look up userβs access level
- Filter β return body + front matter
β¨ Bonus Ideasβ
- π Serve as static if no
{auth=}blocks are present - π§ Precompile filtered versions per access tier (if content is stable)
- π― Add headers like
X-Content-Access-Level: full/partial/locked - π Include hidden blocks with
<!-- locked -->comments (if you want client-side hinting too)
π§© Why This Rocksβ
You now have:
- Variable markdown delivery
- A backend that understands semantics, not just blobs
- The groundwork for unlockable content, gamified auth, and dynamic personalization
If you'd like:
- A Go or Python example of how to parse
{auth=}tags - A file-backed storage model with basic auth
- A pipeline that pre-renders markdown for different roles
Iβd be happy to sketch it out. This is definitely next-level content architecture β but youβre already halfway there.
Comments
No comments yet. Be the first!