Title: [BUG] Widespread port mismatch (4000 vs 8080) across documentation and environment defaults#369
Conversation
|
@shaurya-shaw is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe pull request updates README.md documentation to reflect a backend port configuration change from 4000 to 8080. Updates are applied consistently across local development examples, Docker runtime instructions, and Docker Compose service configurations. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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 `@README.md`:
- Around line 211-222: README now documents port 8080 but the Dockerfile still
declares EXPOSE 4000, causing inconsistent port metadata; update the Dockerfile
by replacing the EXPOSE 4000 directive with EXPOSE 8080 (and update any other
EXPOSE 4000 occurrences referenced around the second block noted) so the image
metadata matches README, or alternatively add a brief comment in the Dockerfile
explaining why EXPOSE remains 4000 if you intentionally keep it; search for the
EXPOSE token in the Dockerfile and adjust all instances to 8080 (or add the
explanatory comment) to keep repo artifacts consistent.
- Line 186: The README currently states the API runs on `localhost:8080` but the
server code in apps/api/src/index.ts falls back to port 4000 when
process.env.PORT is unset; update either the code or docs so they match: either
change the default in apps/api/src/index.ts to 8080 (adjust the PORT fallback
logic where process.env.PORT is read) or modify README.md lines referencing
`8080` to clarify that `PORT=8080` must be set in apps/api/.env and the runtime
fallback is 4000; reference the PORT environment variable and the fallback logic
in apps/api/src/index.ts when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
Update: Changed const PORT = process.env.PORT || 4000; → const PORT = process.env.PORT || 8080; in apps/api/src/index.ts The port 8080 is now consistent across: Code default/fallback This should fully resolve the original inconsistency. |
Documentation Mismatch: API Port Inconsistency (4000 vs 8080)
Description
There is a significant mismatch in the README.md regarding the port used by the API server.
The documentation frequently references port 4000, while the default configurations in .env.example, the actual environment variables, and the frontend setup are hardcoded to use port 8080.
This inconsistency creates confusion and causes two major failure points for new developers:
1. Docker Routing Failure
When following the Docker instructions, the command
docker run -p 4000:4000 --env-file apps/api/.env opensox-apiis used. However, the .env file sets PORT=8080 by default. The container listens on port 8080 internally, but Docker only maps host port 4000. This results in a "Connection refused" error when trying to access the API.2. Frontend Connection Failure
The "Local Run" section in the documentation claims the API runs on localhost:4000. In reality, when using default environment variables, the API starts on localhost:8080. Additionally, the frontend's .env.local is configured with NEXT_PUBLIC_API_URL="http://localhost:8080", causing the frontend to fail to connect to the API if the documentation is followed literally.
Steps to Reproduce
Docker Setup
Local Development Setup
pnpm run devin the apps/api directory.Expected Behavior
The documentation should consistently reference the same port that matches the default environment variables and frontend configuration.
Suggested Fix
Standardize the entire documentation to use port 8080, as it aligns with:
This change will eliminate confusion and prevent connection failures for new contributors and developers.
Summary by CodeRabbit