Add option to run in production mode#15
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe changes introduce production mode deployment capabilities by establishing environment-based API endpoint configuration, adding production build and start scripts across package files, updating web dependencies, and documenting the two-command production workflow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/vite.config.ts`:
- Around line 7-8: The env value assigned to apiOrigin
(process.env["FARFIELD_API_ORIGIN"] ?? "http://127.0.0.1:4311") is not validated
and may cause unclear runtime proxy errors; update vite.config.ts to validate
FARFIELD_API_ORIGIN with a Zod schema (e.g., z.string().url().optional()) and
use z.parse or safeParse to either accept the value or throw a clear startup
error, then set apiOrigin from the validated result (falling back to the default
only after successful validation) so the process fails fast with a descriptive
message if FARFIELD_API_ORIGIN is invalid.
In `@README.md`:
- Around line 46-51: Update the README text that currently reads “Build once and
run in production mode with one command:” to correctly state “with two
commands:” (or similar wording) since the snippet shows separate `bun run build`
and `bun run start` steps; locate the sentence near the code block containing
the `bun run build` and `bun run start` snippet and change the wording to
reflect two commands (or alternatively note how to run both with a single
combined command if you add a combined script).
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
README.mdapps/web/package.jsonapps/web/vite.config.tspackage.json
Reword instructions in README
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/codex-protocol/src/app-server.ts`:
- Around line 33-39: The RateLimit schemas currently call .passthrough() which
allows unknown fields; replace .passthrough() with .strict() on
RateLimitWindowSchema and the other rate-limit schema declarations referenced in
the review (the schemas at the other locations mentioned) so any extra fields
cause validation to fail; locate the RateLimitWindowSchema symbol (and the other
rate-limit schema symbols on the referenced lines) and change the terminal
.passthrough() call to .strict().
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
bun.lockis excluded by!**/*.lockpackages/codex-protocol/src/generated/app-server/GetAccountRateLimitsResponseSchema.tsis excluded by!**/generated/**packages/codex-protocol/src/generated/app-server/index.tsis excluded by!**/generated/**
📒 Files selected for processing (3)
apps/web/package.jsonapps/web/tsconfig.jsonpackages/codex-protocol/src/app-server.ts
|
Idk why the strict test fails to be honest. As funny as it is, works on my machine |
|
FYI we now (as of like 10 seconds ago) automatically deploy production builds to https://farfield.app I was also frustrated by this :) Still have to run and expose the server via a VPN. Trying to come up with better solutions to this (I know there's the outstanding PR for Cloudflare tunneling - still looking into the best course of action here) |
I think these drifted with a couple merged PRs / my own recent work to re-align us to the latest Codex app-server schema. So don't worry about it, I'll get this sorted out… |
packages/codex-protocol/src/generated/app-server/GetAccountRateLimitsResponseSchema.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (2)
package.json (1)
14-15: Thestart:prodalias is redundant but harmless.
start:prodsimply callsstart, providing no additional functionality. Consider removing it to reduce script clutter, or document why the alias exists (e.g., for discoverability in a particular workflow).♻️ Optional: Remove redundant alias
"start": "bun run --parallel --filter `@farfield/server` --filter `@farfield/web` start", - "start:prod": "bun run start",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 14 - 15, The package.json contains a redundant npm script alias "start:prod" that simply invokes "start"; remove the "start:prod" entry or, if you want to keep it for discoverability, add a comment in documentation explaining its purpose; locate the "start" and "start:prod" script entries in package.json and either delete the "start:prod" key or update project docs to justify keeping it.README.md (1)
82-86: Consider using a different example value for the override.The
FARFIELD_API_ORIGINexample uses the default value (http://127.0.0.1:4311), which doesn't illustrate a meaningful override. Consider showing a different host or port to clarify when this variable is actually needed.📝 Suggested doc improvement
If you need a custom backend origin for API proxying: ```bash -FARFIELD_API_ORIGIN=http://127.0.0.1:4311 bun run start +FARFIELD_API_ORIGIN=http://192.168.1.100:4311 bun run start</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@README.mdaround lines 82 - 86, Update the README example for
FARFIELD_API_ORIGIN so it uses a clearly different host/port to demonstrate an
actual override (e.g., replace the default http://127.0.0.1:4311 with an
external example like http://192.168.1.100:4311 or https://api.example.com:443);
locate the snippet that shows the environment variable FARFIELD_API_ORIGIN and
replace only the example value, keeping the surrounding command (bun run start)
unchanged and ensuring the new example makes it obvious when a custom backend
origin is required.</details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In@package.json:
- Around line 14-15: The package.json contains a redundant npm script alias
"start:prod" that simply invokes "start"; remove the "start:prod" entry or, if
you want to keep it for discoverability, add a comment in documentation
explaining its purpose; locate the "start" and "start:prod" script entries in
package.json and either delete the "start:prod" key or update project docs to
justify keeping it.In
@README.md:
- Around line 82-86: Update the README example for FARFIELD_API_ORIGIN so it
uses a clearly different host/port to demonstrate an actual override (e.g.,
replace the default http://127.0.0.1:4311 with an external example like
http://192.168.1.100:4311 or https://api.example.com:443); locate the snippet
that shows the environment variable FARFIELD_API_ORIGIN and replace only the
example value, keeping the surrounding command (bun run start) unchanged and
ensuring the new example makes it obvious when a custom backend origin is
required.</details> --- <details> <summary>ℹ️ Review info</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 537737d20445b40e21f327826641919817c2757a and 6b18caea6927384f37a418a54afc6ab0ccc3bf95. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `README.md` * `package.json` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Personally, I wanted an option to run FE in production mode
I know the project is very much still in progress, but I can't really stand laggy UI especially on mobile, when I just want to use the app remotely
Lighthouse reports (ran multiple times to prevent random results)
bun run dev -- --agents=codex,opencodebun run startSummary by CodeRabbit
Documentation
New Features
FARFIELD_API_ORIGINenvironment variable.