Added static hosting on profile, poting workflow and LLM Skill.#17
Draft
pmarquees wants to merge 1 commit intohrescak:mainfrom
Draft
Added static hosting on profile, poting workflow and LLM Skill.#17pmarquees wants to merge 1 commit intohrescak:mainfrom
pmarquees wants to merge 1 commit intohrescak:mainfrom
Conversation
What this adds - Introduces profile-owned static sites and canonical hosting URLs: /u/<profileSlug>/<siteSlug>. - Adds authenticated static publish pipeline endpoints: - POST /api/static-sites/init - POST /api/static-sites/sign - POST /api/static-sites/finalize - Adds browser helper endpoints: - POST /api/static-sites/session (mint short-lived user publish token) - GET /api/static-sites/publisher-script (download publisher client) - Adds compatibility route /s/<slug>/... that redirects to canonical /u/... when unambiguous. - Adds ownership/auth resolution for publish actors: - service token (STATIC_PUBLISH_TOKEN) - user-scoped session tokens - Adds profile slug support end-to-end in auth/user/session. - Adds deployment metadata and post linkage in Prisma: - User.profileSlug (unique) - StaticSite owner relation + unique(ownerId, slug) - StaticPublishSession model - StaticDeployment.publishedPostId relation to Post - Finalize supports createPost switch: - createPost=true (default): auto-create post - createPost=false: activate deployment only - Adds compose-prefill UX: - /compose accepts ?liveUrl=<...>&title=<...> - publish script compose mode prints (and can auto-open) prefilled compose URL - Adds CLI publisher script and docs, including basePath validation warnings. Setup / migration instructions 1. Apply migrations: npx prisma migrate deploy 2. Ensure R2 env vars are configured: R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_BUCKET_NAME 3. Optional service publish token: STATIC_PUBLISH_TOKEN=<hex token> 4. Generate Prisma client if needed: npm run db:generate How users publish static Next.js output - In exported app, set basePath to the final public URL path (recommended): STATIC_BASE_PATH=/u/<profile>/<slug> - Build app output: STATIC_BASE_PATH=/u/<profile>/<slug> npm run build - Publish with script: node draftboard-publish.mjs --base-url <draftboard-url> --token <token> --profile <profile> --slug <slug> --out-dir ./out Compose-first flow for Cursor skills - Use compose mode so deployment is activated first and user lands in Draftboard compose with Live URL prefilled: node draftboard-publish.mjs --base-url <draftboard-url> --token --profile <profile> --slug <slug> --name <title> --post-mode compose --open-compose true --out-dir ./out - In compose mode: - deployment becomes active - no post is auto-created - script returns /compose?liveUrl=...&title=... and can open it automatically Cursor skill guidance - Keep DRAFTBOARD_STATIC_PUBLISH_TOKEN as a skill/runtime secret (never expose to users). - Skill should: 1) infer profile + slug 2) build with STATIC_BASE_PATH=/u/<profile>/<slug> 3) publish in --post-mode compose 4) open returned compose URL - If stronger per-user auth is desired, use /api/static-sites/session tokens instead of shared service token. Validation performed - npx prisma migrate deploy - npx tsc --noEmit - npm run build - End-to-end publish runs against /Users/pmarques/Dev/experiments/nextjsthing/out in both auto and compose modes - Verified compose mode leaves publishedPostId null until user submits compose form
Contributor
Author
|
Demo video: publish.mp4 |
Contributor
Author
|
@hrescak this is a new PR, I closed the old one. Too messy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Profile-owned static publishing + compose-first workflow for Cursor skills
Summary
This PR adds a full static deployment pipeline for Next.js exported apps, scoped to user profiles, with a compose-first publishing mode designed for non-technical users.
Core outcomes:
/u/<profileSlug>/<siteSlug>./s/<slug>requests are redirected to canonical/u/...when unambiguous./composewithliveUrlprefilled, so users only finish metadata/content and click Publish.Architecture
Data model
User.profileSlugadded (unique).StaticSitenow belongs toownerId(User) with unique(ownerId, slug).StaticPublishSessionmodel added for short-lived user publish tokens.StaticDeployment.publishedPostIdadded to link an auto-created post when enabled.Routing
GET/HEAD /u/[profileSlug]/[siteSlug]/[[...path]]GET/HEAD /s/[slug]/[[...path]]->307to canonical when unique./u/...and/s/...are publicly accessible.Publish API flow
POST /api/static-sites/initPOST /api/static-sites/signPOST /api/static-sites/finalizeBehavior at finalize:
createPost=true(default): activates deployment and creates a post.createPost=false: activates deployment only (for compose-first flow).Auth model
STATIC_PUBLISH_TOKEN(server-side secret).POST /api/static-sites/session(short-lived token tied to logged-in user).Compose-first support
/composenow accepts:?liveUrl=<url>?title=<text>--post-mode compose--open-compose trueWhat is required to make this work
R2_ACCOUNT_IDR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYR2_BUCKET_NAMER2_PUBLIC_URL(optional but recommended)STATIC_PUBLISH_TOKEN=<hex-token>output: "export") and built with correct base path:End-user flow
Goal: user runs a skill, lands on
/compose, sees Live URL prefilled, adds context/attachments, clicks Publish.Flow:
createPost=false).How users can create a Cursor skill
Use a project skill that takes:
profileSlugsiteSlugtitleprojectPathdraftboardBaseUrlStore this secret in Cursor (not in repo):
DRAFTBOARD_STATIC_PUBLISH_TOKENSkill commands:
Recommended Cursor skill prompt:
Testing completed
npx prisma migrate deploynpx tsc --noEmitnpm run buildpublishedPostIdstays null until user publishes manually)Notes
/u/<profile>/<site>, while/s/<slug>remains compatibility-only.