Skip to content

Conversation

@Blaumaus
Copy link
Member

@Blaumaus Blaumaus commented Jan 26, 2026

Summary by CodeRabbit

  • New Features

    • Added a unified proxy service so frontend and backend are served together.
    • Improved proxy behavior and added security headers, gzip, and connection upgrade handling.
  • Configuration

    • Renamed API_URL to BASE_URL across setup, prompts, and docs; setup now collects BASE_URL (public URL without trailing slash).
    • Removed direct public port mappings from individual services; access via the unified endpoint.
    • Removed legacy cloud proxy toggle.

✏️ Tip: You can customize this high-level summary in your review settings.

* use nginx for handling request

* Use /backend, not /api (/api is already used)

* BASE_URL; add conditions for nginx start

* api -> backend

* Use descriptive language

* Config hardening

* Fix config for websocket support

---------

Co-authored-by: Blue Mouse <durexp@protonmail.ch>
@Blaumaus Blaumaus self-assigned this Jan 26, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Warning

Rate limit exceeded

@Blaumaus has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 57 seconds before requesting another review.

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

📝 Walkthrough

Walkthrough

Adds an nginx reverse-proxy service and configuration, renames frontend API variable to BASE_URL across env and scripts, removes direct service port mappings, and updates README to reference BASE_URL and proxy-based access on port 80.

Changes

Cohort / File(s) Summary
Environment & scripts
\.env.example`, `configure.sh``
Replaced API_URL with BASE_URL (comment: public URL without trailing slash). configure.sh prompts for BASE_URL, trims trailing slashes, writes BASE_URL. Removed CLOUDFLARE_PROXY_ENABLED line from .env.example.
Compose / services
\compose.yaml``
Removed published ports from swetrix (80:3000) and swetrix-api (8080:5005). Updated swetrix env to BASE_URL. Added nginx-proxy service (nginx:1.29.4-alpine) exposing 80:80, depends_on with health checks, links to backends, mounts ./nginx/config as nginx config.
Nginx configuration
\nginx/config``
New consolidated nginx config: listener on port 80, connection-upgrade map, security headers, gzip settings; proxies root / to swetrix:3000 and /backend/ to swetrix-api:5005 with expanded proxy headers and buffering.
Documentation
\README.md``
Updated setup steps to mention BASE_URL in configure.sh and to instruct accessing the site via BASE_URL (default http://localhost) rather than direct service ports.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Nginx as Nginx (Port 80)
    participant Frontend as Swetrix (3000)
    participant API as Swetrix-API (5005)

    Client->>Nginx: HTTP request to BASE_URL
    alt Frontend request ("/" or asset)
        Nginx->>Frontend: proxy_pass to swetrix:3000 (with proxy headers)
        Frontend-->>Nginx: response
    else API request ("/backend/")
        Nginx->>API: proxy_pass to swetrix-api:5005 (with proxy headers & upgrade handling)
        API-->>Nginx: response
    end
    Nginx-->>Client: HTTP response (with security headers)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped where ports once loudly spoke,
Now nginx listens on a single stroke,
BASE_URL leads each curious quest,
Frontend and API tucked in a nest,
A rabbit cheers this tidy rest. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Swetrix CE v5 preparations' is vague and generic, using non-descriptive phrasing that doesn't clearly convey the specific changes made in the changeset. Replace with a more specific title describing the main architectural change, such as 'Add nginx proxy service and update base URL configuration' to better reflect the significant infrastructure updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

@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: 1

🤖 Fix all issues with AI agents
In `@configure.sh`:
- Around line 254-264: In the while loop that reads and normalizes base_url,
change the single-slash trim (base_url="${base_url%/}") to remove all trailing
slashes; update the normalization for the variable base_url after the read
(e.g., replace that line with a command that strips all trailing slashes such as
using sed: base_url="$(echo \"$base_url\" | sed 's:/*$::')" or use bash extglob
to remove all slashes) so values like "https://example.com///" become
"https://example.com" before writing BASE_URL to .env.

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.

3 participants