Skip to content

refactor(indexer): replace express healthcheck server with hono - #3555

Merged
stalniy merged 2 commits into
mainfrom
refactor/indexer-replace-express-with-hono
Aug 6, 2026
Merged

refactor(indexer): replace express healthcheck server with hono#3555
stalniy merged 2 commits into
mainfrom
refactor/indexer-replace-express-with-hono

Conversation

@stalniy

@stalniy stalniy commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Why

Consistency. Closes CON-790

What

Swap the Express-based status/nodes healthcheck endpoints for a Hono app served via @hono/node-server, dropping the express and @types/express deps.

Summary by CodeRabbit

  • Refactor

    • Updated the indexer’s HTTP service with a modern runtime while preserving existing behavior.
    • Improved server startup and request handling.
  • Bug Fixes

    • The /status and /nodes endpoints continue returning the same information.
    • Error reporting and server error responses remain consistent.
  • Documentation

    • Updated project and architecture documentation to reflect the current indexer service implementation.

@stalniy
stalniy requested a review from a team as a code owner August 4, 2026 20:13
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1cfc9856-fad5-458e-a2e3-7f4bdfcea4e7

📥 Commits

Reviewing files that changed from the base of the PR and between 3b09409 and f461015.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • CLAUDE.md
  • apps/indexer/package.json
  • apps/indexer/src/index.ts
  • doc/architecture.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • CLAUDE.md
  • apps/indexer/package.json
  • doc/architecture.md
  • apps/indexer/src/index.ts

📝 Walkthrough

Walkthrough

The indexer replaces Express with Hono. It updates dependencies, route handlers, error responses, server startup, and documentation while preserving endpoint payloads and status behavior.

Changes

Indexer Hono migration

Layer / File(s) Summary
Hono runtime and server startup
apps/indexer/package.json, apps/indexer/src/index.ts, CLAUDE.md, doc/architecture.md
The indexer adds Hono packages, removes Express packages, creates a Hono application, starts the server with serve({ fetch: app.fetch, port }), and updates project documentation.
Hono route handlers
apps/indexer/src/index.ts
The /status and /nodes handlers use Hono context responses. Existing payloads, Sentry reporting, error text, and HTTP 500 responses remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/indexer-replace-express-with-hono

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/indexer/package.json

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

apps/indexer/src/index.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.


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

@socket-security

socket-security Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​hono/​node-server@​1.19.171009910096100

View full report

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.25%. Comparing base (3b09409) to head (f461015).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3555   +/-   ##
=======================================
  Coverage   75.25%   75.25%           
=======================================
  Files        1163     1163           
  Lines       30165    30165           
  Branches     7502     7504    +2     
=======================================
+ Hits        22700    22702    +2     
+ Misses       6591     6589    -2     
  Partials      874      874           
Flag Coverage Δ
api 88.54% <ø> (+0.02%) ⬆️
deploy-web 65.00% <ø> (ø)
log-collector 85.85% <ø> (ø)
notifications 93.84% <ø> (ø)
provider-console 81.38% <ø> (ø)
provider-inventory 84.98% <ø> (ø)
provider-proxy 88.17% <ø> (ø)
tx-signer 86.72% <ø> (ø)
see 1 file with indirect coverage changes
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread package-lock.json

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — clean, mechanical swap of Express for Hono in the indexer's healthcheck server.

Extended reasoning...

Overview

This PR touches only apps/indexer/package.json, apps/indexer/src/index.ts, and the lockfile. It replaces the Express-based /status and /nodes healthcheck endpoints with an equivalent Hono app served via @hono/node-server, and drops the express/@types/express dependencies. The route logic itself is unchanged — res.send(...) becomes c.json(...), res.status(500).send(...) becomes c.text(..., 500), and app.listen becomes serve({ fetch: app.fetch, port }). This matches the framework already used elsewhere in the monorepo (apps/api, apps/provider-proxy, apps/tx-signer), so it's a consistency-motivated refactor rather than a behavior change.

Security risks

None. This is an internal healthcheck endpoint (status/nodes reporting), not user input handling, auth, or crypto. No new attack surface is introduced by the framework swap.

Level of scrutiny

Low. The diff is small, mechanical, and 1:1 in behavior — same two GET routes, same response bodies, same status codes, same port binding. It's a dependency swap plus direct API translation, not a design change requiring a human decision.

Other factors

The one finding from the bug-hunting pass is a documentation nit (CLAUDE.md/architecture.md still say "Express" for apps/indexer) — not a functional bug, and doesn't warrant blocking this PR.

Comment thread apps/indexer/src/index.ts

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — straightforward Express-to-Hono swap for the indexer healthcheck server, consistent with the rest of the monorepo already standardizing on Hono.

What was reviewed: the /status and /nodes route handlers (response bodies and error paths preserved: res.sendc.json, res.status(500).send(...)c.text(..., 500)), the app.listenserve({ fetch: app.fetch, port }) startup swap, the package.json dependency swap (express/@types/express removed, hono/@hono/node-server added), and the doc updates in CLAUDE.md and doc/architecture.md, which now correctly say "Hono" instead of "Express" (this addresses the stale-docs nit from my previous run on this PR).

Extended reasoning...

Overview

This PR replaces the Express-based healthcheck server in apps/indexer with a Hono app served via @hono/node-server, dropping the express and @types/express dependencies. Only /status and /nodes GET routes are affected; all other indexer logic (scheduler, sync tasks, DB access) is untouched.

Security risks

None. This is an internal healthcheck endpoint with no auth, input parsing, or user-controlled data — the change is a like-for-like framework swap with identical response payloads and error-handling behavior (500 + "An error occurred" on exception, same JSON bodies on success).

Level of scrutiny

Low. This is a mechanical, well-scoped refactor (XS size label) that follows an established pattern already used in apps/api, apps/provider-proxy, apps/tx-signer, and apps/provider-inventory, all of which use Hono. The diff is small, self-contained, and the behavior-preservation is easy to verify by direct comparison of the before/after handlers.

Other factors

CI (Codecov) reports all tests passing with no coverage regression. The package-lock.json diff is a clean dependency swap with no unexpected transitive changes. The previously-flagged stale documentation (CLAUDE.md and doc/architecture.md still describing the indexer as Express-based) has already been corrected in this diff.

@stalniy
stalniy force-pushed the refactor/indexer-replace-express-with-hono branch from 8dc5dc0 to 4907a8a Compare August 5, 2026 09:17
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. The stale docs I flagged previously (CLAUDE.md and doc/architecture.md still referencing Express) have been updated to reference Hono in this revision.

Extended reasoning...

Overview

This PR swaps the indexer's Express-based /status and /nodes healthcheck routes for Hono served via @hono/node-server, dropping express/@types/express. Changes are confined to apps/indexer/src/index.ts (route handlers + server startup), apps/indexer/package.json (dependency swap), package-lock.json, and two doc files (CLAUDE.md, doc/architecture.md).

Security risks

None. This is an internal healthcheck server (no auth, no user-facing data), and the route logic (fetch task/sync status, catch-wrap into a 500 text response) is preserved 1:1 from the Express version.

Level of scrutiny

Low. This is a well-scoped, mechanical framework substitution in a non-critical internal endpoint (indexer healthcheck), sized XS, with response payloads and error handling kept behaviorally identical to the original Express implementation.

Other factors

My earlier inline nit about stale Express references in CLAUDE.md/doc/architecture.md has since been fixed in this revision (both now say Hono). No tests exist for these healthcheck routes in either the before or after state, which is consistent with the endpoint's low-stakes internal-tooling nature. No bugs were found by the bug hunting system on this run.

@stalniy

stalniy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

it's safe to merge with this snyk error because indexer web server is not publicly available

@stalniy
stalniy force-pushed the refactor/indexer-replace-express-with-hono branch from 4907a8a to f811a15 Compare August 6, 2026 05:12
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — straightforward, mechanical migration from Express to Hono for the indexer healthcheck server.

Extended reasoning...

Overview

This PR swaps the indexer's internal /status and /nodes healthcheck endpoints from Express to Hono + @hono/node-server, matching the framework already used by apps/api, apps/provider-proxy, apps/provider-inventory, and apps/tx-signer. The route handlers are a direct 1:1 translation (res.send(...)c.json(...), res.status(500).send(...)c.text(..., 500)), server startup switches from app.listen to serve({ fetch: app.fetch, port }), and express/@types/express are fully removed from package.json. Documentation (CLAUDE.md, doc/architecture.md) is updated in the same PR to reflect the new stack.

Security risks

None identified. This is an internal healthcheck server (confirmed by the author as not publicly exposed), and the change preserves existing response payloads, error handling, and Sentry reporting exactly.

Level of scrutiny

Low — this is a well-precedented, mechanical framework substitution with no behavior change, small diff surface (one source file plus deps/docs), and CI (tests, coverage) passing.

Other factors

A nit I raised in a prior run (stale Express references in CLAUDE.md/doc/architecture.md) has already been fixed in the current diff. No other findings from this run.

stalniy and others added 2 commits August 6, 2026 07:33
Swap the Express-based status/nodes healthcheck endpoints for a Hono app
served via @hono/node-server, dropping the express and @types/express deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to the express->hono webserver swap: update the architecture
docs and project description that still described the indexer as Express.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stalniy
stalniy force-pushed the refactor/indexer-replace-express-with-hono branch from f811a15 to f461015 Compare August 6, 2026 05:33
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — the prior doc staleness nit (CLAUDE.md / doc/architecture.md still saying Express) has been fixed in this revision, both now correctly say Hono.

Extended reasoning...

Overview

This PR swaps the indexer's internal healthcheck server (/status, /nodes) from Express to Hono + @hono/node-server, matching the framework already used by apps/api, apps/provider-proxy, and apps/provider-inventory. The route handlers, response payloads, Sentry error reporting, and 500-error text are preserved 1:1 — only the framework glue (req/resc.json/c.text, app.listenserve({ fetch: app.fetch, ... })) changed. Docs (CLAUDE.md, doc/architecture.md) and package.json/package-lock.json were updated consistently to drop express/@types/express and add hono/@hono/node-server.

Security risks

None. This is an internal healthcheck/status server; the author confirmed on the PR thread that it is not publicly exposed, which also addresses the earlier Snyk advisory noise. No auth, crypto, or data-access code is touched.

Level of scrutiny

Low. This is a mechanical, same-behavior framework swap in a small, non-public surface, consistent with the pattern already used elsewhere in the monorepo. CI (tests, coverage, lint) is green and the diff is easy to verify line-by-line against the old Express handlers.

Other factors

I left a nit on a previous revision about CLAUDE.md and doc/architecture.md still describing the indexer as Express-based; both have since been corrected to say Hono, so that's resolved. No bugs were found by the bug hunting system on this run, and nothing else stood out in apps/indexer/src/index.ts or the dependency changes.

@stalniy
stalniy merged commit 53222ee into main Aug 6, 2026
57 of 59 checks passed
@stalniy
stalniy deleted the refactor/indexer-replace-express-with-hono branch August 6, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants