fix: write a valid care_fe/.env.local so the frontend dev server starts - #2
Merged
khavinshankar merged 1 commit intoSep 11, 2026
Merged
Conversation
`care run` could not start care_fe. `create` copied care_fe's .example.env into .env.local, and its blank `KEY=` placeholders load as "" and fail care_fe's env validation (zod `.optional()` only accepts a missing key), so Vite aborted with 17 errors. .env.local now holds only the CLI's overrides; care_fe/.env already supplies the defaults. REACT_ENABLED_APPS was written as `care_abdm_fe@localhost:5173`. care_fe parses entries as `org/repo@host/path/to/remoteEntry.js` and throws on a bare repo name while loading care.config.ts, which blanks the app. The entry's URL also overrides the plugin config registered in the backend. The registry now uses `10bedicu/care_abdm_fe`, and the entry points at the same remoteEntry.js URL as the plugin config.
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.
Problem
After
care create,care runcan't bring up the frontend:createcopied care_fe's.example.envintocare_fe/.env.local. That template leaves most keys blank (REACT_GITHUB_URL=,REACT_MAIN_LOGO=, …). Vite loads them as"", and care_fe'sscripts/validate-env.tsrejects them because zod's.optional()only accepts a missing key. Vite aborts with 17 validation errors.REACT_ENABLED_APPSwas written ascare_abdm_fe@localhost:5173. care_fe'scare.config.tsexpectsorg/repo@host/path/to/remoteEntry.jsand throwsInvalid plug configuration: care_abdm_fe. Expected 'org/repo@url'.while the module loads. Adding just the org isn't enough: care_fe merges this entry's URL over the plugin config the CLI registers in the backend, and@localhost:5173resolves tohttp://localhost:5173/instead ofremoteEntry.js.Changes
createwrites only the CLI's own keys tocare_fe/.env.local(REACT_CARE_API_URL,REACT_ENABLED_APPS, plus any plug env) and no longer copies.example.env. The defaults already come fromcare_fe/.env, and care_fe's README only asks forREACT_CARE_API_URLin.env.local.remoteEntryUrl()helper supplies the URL for both the registered plugin config andREACT_ENABLED_APPS, which is noworg/repo@host/assets/remoteEntry.js.plugs.json:enabledAppforcare_abdm_feis now10bedicu/care_abdm_fe.types.tsdocuments theorg/repoformat.Testing
npm run typecheckandnpm run buildpass. The builtdist/cli.jsno longer references.example.env.create --skip-installagainst a scratch setup that had care_fe's real.example.envin place (Docker runtime,care_abdm_feselected). The generatedcare_fe/.env.localis exactly:develop) starts, the landing page renders, and the ABDM plugin'sremoteEntry.jsand manifest load from:5173.careAppsparsing fromcare.config.tson three values. The old value throws, org-only giveshttp://localhost:5173/, and the new value gives theremoteEntry.jsURL.create→runfrom the packed tarball in an empty directory.Notes for reviewers
createonly rewrites the CLI's own keys, so the blank template lines stay. Workaround: deletecare_fe/.env.local, then re-runcare create --skip-install. A follow-up could havecreatedrop blankKEY=lines from an existing file.cd <dir> && care run. That doesn't work afternpx @ohcn/care create, because npx doesn't putcareon the PATH. Those users neednpx @ohcn/care run <dir>. This is also left for a follow-up.