docs: add .env.example documenting the API base variable#315
Open
shinzoxD wants to merge 2 commits into
Open
Conversation
…discriminated-union State<T> + refetch type caused TS2339 errors\nin pairs/Client.tsx and stats/Client.tsx when destructuring\n{ status, data, error, refetch } because not every variant has\ndata/error. Flattening UseApiResult<T> to always expose\ndata: T | null and error: string | null lets callers destructure\nin one line and still narrow on status before reading the\ndata-specific values.\n\nAlso adds && data / && status.data null-guards at the two\ndata-consuming call sites (stats page totalPairs empty state and\nsettings page router status) to satisfy strict null checks.
Contributor
Author
|
@mikewheeleer — friendly ping on this fork PR (docs: add .env.example documenting the API base variable).\n\nCI is currently failing on pre-existing main-branch test flakes ( |
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.
Summary
Adds a tracked
.env.exampleat the repository root documenting theNEXT_PUBLIC_STABLEROUTE_API_BASEenvironment variable. The file is a safe template: it contains a localhost default, an explanation of theNEXT_PUBLIC_prefix semantics, and a note pointing to the URL validator insrc/lib/apiClient.ts(PR #184 — already merged).Why
A fresh contributor running
npm run devfor the first time gets a dashboard that immediately tries to fetchhttp://localhost:3001/api/v1/stats(or whatever the default is). There is no hint that this URL is configurable, and no template to copy. The README documents the variable in prose but does not give a starting point. An.env.exampleis the standard convention Next.js / Vercel projects use for this.Changes
.env.example(~11 lines) with the env var, a localhost default, theNEXT_PUBLIC_semantics note, and a pointer to the URL validator.Test Plan
cp .env.example .env.local && npm run dev— dashboard starts and fetches the configured API base.grep -r NEXT_PUBLIC_STABLEROUTE_API_BASE src/— every read site is documented.Linked issue
Closes #305
Payout wallet (Stellar):
GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXHGrantFox OSS campaign — smart escrow payout on merge.