Skip to content

Added Support for Node#17

Merged
dcodesdev merged 10 commits intomainfrom
dev
May 11, 2025
Merged

Added Support for Node#17
dcodesdev merged 10 commits intomainfrom
dev

Conversation

@dcodesdev
Copy link
Copy Markdown
Owner

@dcodesdev dcodesdev commented May 11, 2025

closes #16

Summary by CodeRabbit

  • New Features

    • Added support for running the backend with Node.js, including a dedicated Docker image, Docker Compose setup, and updated release process.
    • Introduced automatic update checks in the web app, refreshing release data every minute.
    • Integrated analytics tracking into the documentation site.
  • Documentation

    • Updated release notes and getting started docs to reflect Node.js support and new Docker image options.
  • Chores

    • Improved backend build scripts and configuration for better TypeScript build management.
    • Updated project version to 0.8.0.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
letter-space-docs ⬜️ Ignored (Inspect) Visit Preview May 11, 2025 10:16am
letter-space-landing-page ⬜️ Ignored (Inspect) Visit Preview May 11, 2025 10:16am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2025

Warning

Rate limit exceeded

@dcodesdev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 36 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 04dcc37 and 5ecefb2.

📒 Files selected for processing (1)
  • .github/workflows/docker.yaml (4 hunks)

"""

Walkthrough

This update introduces Node.js support alongside Bun for the backend, including new Docker and Docker Compose configurations, conditional runtime logic, and workflow changes to build and release both Bun and Node.js images. Documentation and release notes are updated to reflect these changes, and analytics are added to the documentation site.

Changes

File(s) Change Summary
.github/workflows/docker.yaml Workflow now builds and pushes both Bun and Node.js Docker images; adds a release job dependent on both image builds.
Dockerfile ENTRYPOINT modified to include --bun argument for runtime selection.
Dockerfile.node, docker-compose.node.yaml New Dockerfile and Compose file for Node.js backend and Postgres setup.
apps/backend/entrypoint.sh Adds logic to run with Bun or Node.js based on argument.
apps/backend/package.json, apps/backend/tsconfig.build.json Adds build script and TypeScript build config for backend Node.js compatibility.
apps/backend/.gitignore Ignores build output and TypeScript build info.
apps/docs/src/app/getting-started/page.mdx Documents Node.js image option in Docker Compose example.
apps/docs/src/app/layout.tsx, apps/docs/src/components/analytics.tsx, .../index.ts Adds and exports Analytics component, integrates it into documentation site layout.
apps/web/src/hooks/use-update-check.ts Sets update check to refetch every minute.
RELEASE_NOTES.md Adds Node.js support to features section.
package.json Bumps version from 0.7.2 to 0.8.0.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant DockerHub/GHCR

    User->>GitHub Actions: Push code or tag
    GitHub Actions->>GitHub Actions: build-and-push-bun job
    GitHub Actions->>DockerHub/GHCR: Push Bun image
    GitHub Actions->>GitHub Actions: build-and-push-node job
    GitHub Actions->>DockerHub/GHCR: Push Node image
    GitHub Actions->>GitHub Actions: release job (after both builds)
    GitHub Actions->>GitHub: Create Release
Loading
sequenceDiagram
    participant Container
    participant entrypoint.sh

    Container->>entrypoint.sh: Start with --bun argument
    entrypoint.sh-->>Container: Run with Bun

    alt Started without --bun
        entrypoint.sh-->>Container: Run with Node.js
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Migrate project to Node.js (#16)

Possibly related PRs

  • Analytics #10: Adds an Analytics component and integrates it into the docs app layout, related by feature to analytics additions in this PR.
  • Better dates, bug fixes #6: Both PRs modify the GitHub Actions workflow to add a release step after building and pushing Docker images, showing a direct connection in release automation.

Poem

In the warren where code does grow,
Now Bun and Node together flow!
With Docker builds and docs anew,
Analytics track what users do.
Compose and scripts, all in line—
Version bumped, the stars align!
🐇✨
"""


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

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

🧹 Nitpick comments (10)
RELEASE_NOTES.md (1)

3-3: Use the official spelling "Node.js" instead of "NodeJS".

Update the release note to use the official spelling with the dot.

-- Added support for NodeJS.
++ Added support for Node.js.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~3-~3: The official spelling of this programming framework is “Node.js”.
Context: ### ✨ Features - Added support for NodeJS. - New features and improvements. ### ...

(NODE_JS)

apps/backend/entrypoint.sh (1)

6-10: Ensure proper signal forwarding and error handling in the entrypoint script

To allow the container to handle signals (e.g., SIGTERM) correctly and to fail fast on errors, consider adding set -euo pipefail at the top and using exec to replace the shell with the child process:

+#!/bin/sh
+set -euo pipefail
 if [ "$1" = "--bun" ]; then
-  bun run src/index.ts
+  exec bun run src/index.ts
 else
-  node dist/index.js
+  exec node dist/index.js
 fi
apps/docs/src/app/getting-started/page.mdx (1)

33-33: Clarify Node.js alternative in documentation

Instead of commenting out the Node.js image line within the same YAML block, consider presenting a separate snippet or a second code block to clearly illustrate both Bun and Node.js configurations for readers. This will improve readability and reduce the chance of confusion between the two runtimes.

Dockerfile (1)

27-27: Use CMD for default runtime flag to improve Dockerfile reuse

Hardcoding --bun in the ENTRYPOINT makes the Bun Dockerfile rigid. You could separate the entrypoint and default flag, allowing the Node.js variant to simply override CMD:

-ENTRYPOINT ["./entrypoint.sh", "--bun"]
+ENTRYPOINT ["./entrypoint.sh"]
+CMD ["--bun"]

Then in Dockerfile.node, override the CMD or omit it to default to Node.js.

.github/workflows/docker.yaml (2)

72-83: Consider using a distinct image name for Node builds
Currently both Bun and Node images are pushed under the same repository (ghcr.io/dcodesdev/letterspace) with different tag suffixes. Using a dedicated repository or image name (e.g., letterspace-node) enhances discoverability and avoids potential tag‐parsing issues in registries that don’t fully support semver suffixes.


95-101: Add concurrency control to prevent duplicate releases
If multiple tag pushes happen in quick succession, you might end up with redundant release jobs. Introducing a concurrency group scoped to ${{ github.ref }} ensures only one release per tag is created:

  release:
    concurrency:
      group: ${{ github.ref }}
      cancel-in-progress: true
    name: Create GitHub Release
    runs-on: ubuntu-latest
    ...
docker-compose.node.yaml (1)

1-2: Specify Compose file version for compatibility
Explicitly declare the Compose schema version to improve portability and tool support:

version: '3.9'

services:
  db:
    ...
Dockerfile.node (3)

3-4: Reduce image size by refining apt-get usage
Combine flags, avoid extra packages, and clean up apt lists to shrink the final image:

- RUN apt-get update -y && apt-get install -y openssl
+ RUN apt-get update \
+     && apt-get install -y --no-install-recommends openssl \
+     && rm -rf /var/lib/apt/lists/*

17-17: Leverage a .dockerignore to speed builds
The COPY . . step will include all files unless excluded. Ensure a .dockerignore exists to omit node_modules, local build artifacts, and other unnecessary files for faster, cleaner builds.


28-30: Consider using CMD instead of ENTRYPOINT for flexibility
Switching to CMD allows easier overrides (e.g., for debugging). If you don’t need to enforce the script, you can change:

- ENTRYPOINT ["./entrypoint.sh"]
+ CMD ["./entrypoint.sh"]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd77c85 and e75e2b4.

📒 Files selected for processing (15)
  • .github/workflows/docker.yaml (4 hunks)
  • Dockerfile (1 hunks)
  • Dockerfile.node (1 hunks)
  • RELEASE_NOTES.md (1 hunks)
  • apps/backend/.gitignore (1 hunks)
  • apps/backend/entrypoint.sh (1 hunks)
  • apps/backend/package.json (1 hunks)
  • apps/backend/tsconfig.build.json (1 hunks)
  • apps/docs/src/app/getting-started/page.mdx (1 hunks)
  • apps/docs/src/app/layout.tsx (2 hunks)
  • apps/docs/src/components/analytics.tsx (1 hunks)
  • apps/docs/src/components/index.ts (1 hunks)
  • apps/web/src/hooks/use-update-check.ts (1 hunks)
  • docker-compose.node.yaml (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/docs/src/app/layout.tsx (1)
apps/docs/src/components/analytics.tsx (1)
  • Analytics (3-13)
🪛 LanguageTool
RELEASE_NOTES.md

[uncategorized] ~3-~3: The official spelling of this programming framework is “Node.js”.
Context: ### ✨ Features - Added support for NodeJS. - New features and improvements. ### ...

(NODE_JS)

🪛 Checkov (3.2.334)
docker-compose.node.yaml

[MEDIUM] 24-25: Basic Auth Credentials

(CKV_SECRET_4)

🔇 Additional comments (8)
apps/docs/src/components/index.ts (1)

1-1: Clean export implementation.

This barrel file export provides a clean way to access the Analytics component from a centralized import path.

apps/docs/src/app/layout.tsx (2)

9-9: Import uses proper path alias.

The import uses the Next.js path alias convention properly.


131-131: Well-positioned analytics integration.

The Analytics component is appropriately placed inside the Layout component after the main content, which is a good practice for analytics scripts to ensure they don't block rendering of the main content.

apps/docs/src/components/analytics.tsx (1)

1-13: Well-implemented analytics with performance considerations.

The Analytics component is correctly implemented using Next.js's Script component with appropriate loading strategy:

  1. Using strategy="afterInteractive" ensures the script loads after the page becomes interactive, not blocking initial render
  2. The defer attribute properly delays execution until after parsing
  3. Plausible Analytics is a privacy-friendly choice that complies with regulations like GDPR

The component is well-structured as a standalone module that can be easily imported and maintained.

package.json (1)

2-2: Version bump is appropriate for Node.js support.

The version increment from 0.7.2 to 0.8.0 follows semantic versioning principles, correctly representing the addition of Node.js support as a minor version change with new functionality that maintains backward compatibility.

apps/backend/tsconfig.build.json (1)

1-8: Good TypeScript build configuration for Node.js support.

This configuration correctly extends the base config and sets up the necessary compiler options for building TypeScript files to JavaScript for Node.js compatibility. The exclusions are appropriate to avoid processing unnecessary files.

apps/web/src/hooks/use-update-check.ts (1)

28-28: Automatic update checking interval is reasonable.

Adding a one-minute refetch interval for update checks provides more timely notifications to users when new releases are available, including the new Node.js support.

apps/backend/package.json (1)

9-9: Build script for TypeScript artifacts

The new build script (rm -rf dist && tsc -b tsconfig.build.json) correctly compiles the backend for the Node.js runtime, ensuring that the dist folder is recreated on each build. This aligns well with the Node.js Docker build process.

Comment thread apps/backend/.gitignore
Comment thread .github/workflows/docker.yaml Outdated
Comment thread docker-compose.node.yaml
Comment thread docker-compose.node.yaml
@dcodesdev dcodesdev merged commit b401599 into main May 11, 2025
4 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Dec 26, 2025
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.

[BUG] Bun issues on older kernel.

1 participant