docs: add an MIT license and require NEXT_PUBLIC_API_URL in production builds - #41
Merged
Merged
Conversation
|
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
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.
Why
Two independent gaps.
The repository is public with no LICENSE file, so default copyright applies and nobody may legally use, fork, or contribute to the code. MIT matches the convention across this account's other repositories.
apps/web/env.tsgaveNEXT_PUBLIC_API_URLa.default("http://localhost:3001"). Next.js inlines that value into the client bundle, so forgetting to set the variable produced a green production build whose users' browsers posted every image to their own machine, with the status link pointing there too. A default defeats the point of the validated-env boundary: the failure belongs at build time, not in a user's browser.What changed
LICENSE(MIT), alicensefield on the root manifest, and a License section in the README.env.tsrequires the variable whenNODE_ENVisproductionand keeps the localhost default otherwise, sonext buildfails without it whilebun devstays zero-config.next.config.tsreads the raw variable for the development rewrite instead of importing the validated module.next typegenloads the config withNODE_ENV=production, so importing the module there would have madebun run typecheckrequire a production-only variable for every contributor. Application code still imports@/env, which is what triggers validation during a build.NEXT_PUBLIC_API_URLto their Build step, making explicit the value they previously got from the removed default. CI builds are never deployed, so a placeholder is correct there.Verification
bun run typecheckwith the variable unsetbun run buildwith the variable unsetbun run buildwith a valid URLbun devwith no env fileRoot
bun run testandbun run checkboth exit 0.Note for deployment
Any deployment of the web app must now set
NEXT_PUBLIC_API_URLin its platform environment. On Vercel this is a project setting; the build fails without it, which is the intent.