Docs: add Next.js (App Router) example in examples/nextjs-app (#350) - #387
Merged
Conversation
|
@JafetCHVDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Create a minimal Next.js example that demonstrates how to use @conduit-protocol/sdk in a modern React framework: - Fetch and list active streams for a given Stellar address - Create a new stream via a modal form (recipient, token, amount, duration) - Withdraw from an active stream - Singleton ConduitClient initialization in lib/conduit.ts - Helper functions for stream operations in lib/streams.ts Closes conduit-protocol#350
- Move getClient()'s keypair-signing calls behind a 'use server' boundary (lib/streams.ts) and rename NEXT_PUBLIC_STELLAR_SECRET -> STELLAR_SECRET. The NEXT_PUBLIC_ prefix tells Next.js to inline the value into the client-side JS bundle, which would have shipped a real signing secret to every browser loading the page — verified by grepping the production build's client chunks for the env var name before and after this fix. - Fix @conduit-protocol/sdk: "workspace:*" in the example's package.json, which fails with plain npm since this repo has no workspaces config (confirmed via `npm install --dry-run`); use "file:../.." instead, which resolves against the built dist/ output the README already has the reader `npm run build` before this step. - Rename next.config.ts -> next.config.mjs: the pinned Next.js 14.2.x line doesn't support next.config.ts (that lands in a later major), so the build failed immediately with "Configuring Next.js via 'next.config.ts' is not supported." - Add coverage/, examples/nextjs-app/.next/, and examples/nextjs-app/next-env.d.ts to .gitignore so generated output doesn't get committed by accident. Verified: npm install, npm run build (SDK), then npm install && npx tsc --noEmit && npm run build inside examples/nextjs-app all succeed.
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.
Context
The \examples/\ folder currently only has a raw Node.js script and a Vite dashboard. This PR adds a modern Next.js (App Router) example.
Changes
How to run
�ash npm install && npm run build cd examples/nextjs-app cp .env.example .env.local # fill in your keys npm run devCloses #350