Skip to content

feat: add localhost HTTP API server for external integrations#66

Open
MASAKASUNO1 wants to merge 1 commit intoamicalhq:mainfrom
MASAKASUNO1:feat/localhost-http-api
Open

feat: add localhost HTTP API server for external integrations#66
MASAKASUNO1 wants to merge 1 commit intoamicalhq:mainfrom
MASAKASUNO1:feat/localhost-http-api

Conversation

@MASAKASUNO1
Copy link

@MASAKASUNO1 MASAKASUNO1 commented Jan 20, 2026

Summary

  • Add HttpApiManager to expose the existing tRPC router over HTTP on localhost
  • Server runs on port 21417 (127.0.0.1 only for security)
  • Includes CORS headers for local development
  • Gracefully handles port conflicts (doesn't fail if port is in use)
  • Integrates with ServiceManager lifecycle (automatic start/stop)

Usage

Once the desktop app is running, you can access the tRPC API at:

http://127.0.0.1:21417/

Example (get transcriptions):

curl -X POST http://127.0.0.1:21417/transcriptions.getTranscriptions \
  -H "Content-Type: application/json" \
  -d '{"json":{"limit":10,"offset":0,"sortBy":"timestamp","sortOrder":"desc"}}'

Test plan

  • Start the desktop app and verify HTTP API server starts (check logs)
  • Test API endpoint with curl or browser
  • Verify CORS headers work from browser
  • Verify server stops cleanly on app quit

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a local HTTP API server to expose application functionality over HTTP with configurable port settings (default: 21417)
    • Integrated HTTP server lifecycle management with automatic startup, status monitoring, and graceful shutdown
    • Enabled CORS configuration for seamless local development and third-party integrations
    • Added proper error handling for port conflicts and server startup scenarios

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

- Add HttpApiManager to expose tRPC router over HTTP on localhost
- Server runs on port 21417 (127.0.0.1 only for security)
- Includes CORS headers for local development
- Gracefully handles port conflicts
- Integrates with ServiceManager lifecycle (start/stop)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

A new HttpApiManager class is introduced to run a local HTTP API server exposing the tRPC router over HTTP on localhost:21417. It is integrated into ServiceManager as a managed lifecycle component with initialization and cleanup hooks.

Changes

Cohort / File(s) Summary
HTTP API Server Implementation
apps/desktop/src/main/managers/http-api-manager.ts
New file introducing HttpApiManager class with methods to start/stop an HTTP server, manage CORS headers, wire tRPC handler with context creation, and track server state. Handles port conflicts gracefully without crashing.
Service Manager Integration
apps/desktop/src/main/managers/service-manager.ts
Adds HttpApiManager import, httpApiManager field and public interface entry to ServiceMap, initializer method initializeHttpApiManager(), and lifecycle hooks for startup and cleanup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A server springs to life, listening keen,
On localhost where HTTP streams flow,
The tRPC router sings serene,
CORS headers gleam in morning glow—
A rabbitry of code, all set to go! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically summarizes the main change: adding a localhost HTTP API server for external integrations.
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.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@haritabh-z01
Copy link
Contributor

@MASAKASUNO1 Can you please elaborate on how this integration is meant to be used, the problem you are solving for?

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.

2 participants