Skip to content

chore: adding hello vercel example app#1283

Draft
joker23 wants to merge 2 commits intomainfrom
skz/sdk-2178/hello-vercel
Draft

chore: adding hello vercel example app#1283
joker23 wants to merge 2 commits intomainfrom
skz/sdk-2178/hello-vercel

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Apr 15, 2026

This PR will update the current "complete" example so that it is simpler and aligns with our example specs. This should be an easier to follow usage of our Vercel edge sdk.

NOTE: I am also planning on updating the existing examples in future PRs to modernize the implementation.


Note

Low Risk
Low risk since changes are confined to sample apps and release tooling config; main risk is potential breakage of workspace/build tooling due to updated example dependencies and added release-please tracking.

Overview
Adds a new simplified packages/sdk/vercel/examples/complete (“hello vercel”) sample that demonstrates edge flag evaluation via an edge middleware-style proxy.ts (sets an x-ld-flag-value header) plus an edge route handler (/api/flag) that the client polls for live updates.

Replaces the prior “complete” Apple-store/Tailwind + React SDK bootstrap demo with a minimal Next app: removes middleware rewrites/extra pages and the React client SDK provider, introduces a lazily initialized getLdEdgeClient() with clearer env var handling (LD_CLIENT_SIDE_ID, EDGE_CONFIG, LAUNCHDARKLY_FLAG_KEY), and updates example configs/deps (Next/React/TS, simplified .gitignore, README).

Updates repo/workflows to include the new example workspace, renames the React vercel-edge example package to the public @launchdarkly/... scope, and extends release-please-config.json to keep the new example’s @launchdarkly/vercel-server-sdk dependency in sync.

Reviewed by Cursor Bugbot for commit 3f83551. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25623 bytes
Compressed size limit: 29000
Uncompressed size: 125843 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31840 bytes
Compressed size limit: 34000
Uncompressed size: 113634 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179547 bytes
Compressed size limit: 200000
Uncompressed size: 830815 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38473 bytes
Compressed size limit: 39000
Uncompressed size: 211104 bytes

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 15, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c42eb49. Configure here.

@joker23 joker23 marked this pull request as ready for review April 15, 2026 22:03
@joker23 joker23 requested a review from a team as a code owner April 15, 2026 22:03
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@joker23 joker23 marked this pull request as draft April 23, 2026 17:19
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 23, 2026

converting this back to draft because we should make this example deployable to vercel. So will need to align this more towards https://github.com/launchdarkly/js-core/tree/main/packages/sdk/vercel/examples/complete.

We can look into https://github.com/vercel-labs/emulate to drive e2e and/or easier example start up.

@joker23 joker23 force-pushed the skz/sdk-2178/hello-vercel branch 3 times, most recently from 57b2c9f to feb0bf7 Compare April 28, 2026 15:50
@joker23 joker23 force-pushed the skz/sdk-2178/hello-vercel branch from feb0bf7 to 3f83551 Compare April 28, 2026 15:56
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 28, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f83551. Configure here.


const response = NextResponse.next();
response.headers.set(FLAG_HEADER, String(flagValue));
return response;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy sets response header but page reads request headers

High Severity

The proxy sets FLAG_HEADER on the response via response.headers.set(), but app/page.tsx reads it via Next.js's headers() which returns request headers. The header will never be visible to the server component, so middlewareValue will always be null and the server-rendered initial state will never work. To forward a header to server components, the proxy needs to clone the incoming request headers and pass them via NextResponse.next({ request: { headers } }). The _request parameter (currently marked unused with an underscore prefix) would need to be used for this.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3f83551. Configure here.

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.

1 participant