Skip to content

Title: [BUG] Widespread port mismatch (4000 vs 8080) across documentation and environment defaults#369

Open
shaurya-shaw wants to merge 2 commits into
apsinghdev:mainfrom
shaurya-shaw:fix/port-mismatch-8080
Open

Title: [BUG] Widespread port mismatch (4000 vs 8080) across documentation and environment defaults#369
shaurya-shaw wants to merge 2 commits into
apsinghdev:mainfrom
shaurya-shaw:fix/port-mismatch-8080

Conversation

@shaurya-shaw
Copy link
Copy Markdown

@shaurya-shaw shaurya-shaw commented Apr 28, 2026


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-api is 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

  1. Copy the default environment variables: cp apps/api/.env.example apps/api/.env
  2. Run the documented Docker command: docker run -p 4000:4000 --env-file apps/api/.env opensox-api
  3. Observe the container logs showing: Listening on port 8080
  4. Try accessing the API at http://localhost:4000 → Connection Refused

Local Development Setup

  1. Follow the local setup instructions.
  2. Run pnpm run dev in the apps/api directory.
  3. The documentation states: "Voila! Your API server is running on localhost:4000."
  4. Actual terminal output shows the server is running on port 8080.

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:

  • The default value in apps/api/.env.example
  • The PORT variable used by the API server
  • The NEXT_PUBLIC_API_URL in the frontend's .env.local

This change will eliminate confusion and prevent connection failures for new contributors and developers.


Summary by CodeRabbit

  • Documentation
    • Updated backend runtime configuration references to use port 8080 instead of 4000 across local development, Docker, and Docker Compose setups.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

@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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@shaurya-shaw has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 50 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4a5aef01-f1d7-449f-8eab-d06e85457b6b

📥 Commits

Reviewing files that changed from the base of the PR and between c413e5a and 0ddc401.

📒 Files selected for processing (2)
  • Dockerfile
  • apps/api/src/index.ts
📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Port Configuration Updates
README.md
Updated all backend runtime examples and availability URLs from port 4000 to 8080, including local development success message, Docker port mappings, PORT environment variables, and Docker Compose service configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 From four-oh-oh to eighty-ten we go,
A port so fresh, in a README glow,
Docker and Compose both dance in delight,
Eight thousand and eighty shines oh-so-bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies a specific bug (port mismatch) and comprehensively describes the main change affecting both documentation and environment defaults.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3a7fd0c8-1377-4f3b-bf97-73017467ba78

📥 Commits

Reviewing files that changed from the base of the PR and between a2ef5f3 and c413e5a.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md
Comment thread README.md
@shaurya-shaw
Copy link
Copy Markdown
Author

Update:
I have now updated both files as discussed:

Changed const PORT = process.env.PORT || 4000; → const PORT = process.env.PORT || 8080; in apps/api/src/index.ts
Changed EXPOSE 4000 → EXPOSE 8080 in the Dockerfile

The port 8080 is now consistent across:

Code default/fallback
.env.example
Dockerfile (EXPOSE)
Frontend (NEXT_PUBLIC_API_URL)
README documentation

This should fully resolve the original inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant