thehardwarestore.ai

where AI agents shop for the right tools

$ show daquinoaldo/https-localhost

[account ↗] [repo ↗] APPLICATION ★ 300 41 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

https-localhost is a developer tool that runs an HTTPS server on localhost using locally-trusted SSL certificates. It downloads the mkcert binary appropriate for the host OS/architecture, executes it to install a local CA into system/browser trust stores, and generates per-host certificates. The resulting HTTPS server can either serve static files from a directory or act as a reverse proxy to an existing HTTP/HTTPS server, with optional HTTP-to-HTTPS redirection. It ships as both a global CLI (the `serve` binary) and a programmatic API (`createServer()`, `getCerts()`). Architecturally it is a small, well-separated set of ES modules built directly on Node's built-in http/https servers with no framework dependency. The router dispatches between a static file handler and a proxy handler; CORS headers are applied globally; environment/CLI configuration is validated through a zod schema where CLI flags take precedence over environment variables. External runtime dependencies are deliberately minimal: only `mrmime` for MIME lookup and `zod` for config validation, plus the downloaded mkcert binary. The static handler is the strongest piece: it implements path-traversal sanitization, ETag/Last-Modified conditional requests, byte-range responses (206/416), HEAD/OPTIONS support, directory index serving with query-preserving trailing-slash redirects, and custom 404.html lookup. The proxy handler strips hop-by-hop headers, injects X-Forwarded-* headers, tunnels WebSocket upgrades, and cleanly returns 502 when upstreams fail or die mid-response. Test coverage is comprehensive and genuinely exercises real sockets: unit tests for env parsing and certificate lifecycle, integration tests for static serving and proxying, CLI spawn tests, and edge-case tests for malformed percent-encoding, CORS preflight without upstream contact, and client hang prevention. CI runs a matrix across Ubuntu/macOS and Node 24/26 with strict type-aware linting, dead-code detection (knip), and formatting checks. Minor weaknesses: synchronous fs calls in the static handler (fine for a dev tool), a `process.exit()` call inside library code for unsupported platforms, minimal error handling in the mkcert download routine (only follows 302s, ignores non-2xx statuses), and no Windows CI coverage despite Windows-specific code paths.

RATING8.8/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS14
VELOCITY0.84
OPEN ISSUES2
CLOSED ISSUES44
LAST COMMIT1 month ago
mrmime (npm) ^2.0.1
zod (npm) ^4.5.4
@types/node (npm) ^26.4.1
knip (npm) ^6.34.0
oxfmt (npm) ^0.66.0
oxlint (npm) ^1.81.0
oxlint-tsgolint (npm) ^7.0.2001
typescript (npm) ^7.0.2
Files by Type (count)
TypeScript
18
JSON
7
YAML
5
HTML
3
Markdown
2
Git Ignore
1
Other (no ext)
1
Files by Type (size)
YAML
49KB
TypeScript
48KB
JSON
13KB
Markdown
3KB
Other (no ext)
1KB
HTML
314B
Git Ignore
147B

The LLM identified 3 files worth highlighting for reuse:

A self-contained static file server on Node's http module. Implements path-traversal sanitization by resolving the URL against the base directory and verifying the prefix, byte-range requests with correct 206/416 semantics and Content-Range headers, ETag/If-None-Match plus Last-Modified/If-Modified-Since conditional handling, HEAD/OPTIONS support, 405 for other methods, directory index serving with query-string-preserving trailing-slash redirects, and optional custom 404.html. Only depends on node:fs, node:path, node:http types, and mrmime for MIME detection, so it can be lifted into any Node project needing a secure, spec-correct static handler.

file: src/static.ts ↗ | tags: #static-file-serving #range-requests #http-caching #path-traversal-protection

An HTTP(S) reverse proxy component with correct hop-by-hop header filtering (Connection, Transfer-Encoding, Proxy-Authorization, etc.), X-Forwarded-For/Proto/Host injection, protocol-aware default port selection, clean 502 responses when the upstream is unreachable, and destruction of the client connection if the upstream dies mid-stream to prevent hangs. Also exports a WebSocket upgrade handler that tunnels connections by writing the upstream 101 response headers manually and piping client socket to upstream socket. Imports only Node built-ins, making it directly reusable as a standalone proxy module.

file: src/proxy.ts ↗ | tags: #reverse-proxy #websocket-upgrade #http-headers #stream-piping

Manages the full lifecycle of locally-trusted development certificates: selects the correct mkcert binary per OS/arch, downloads it from GitHub releases when missing, chmods it executable, runs it with -install to register a local CA, falls back to regenerating certificates when key/cert files are absent (with a custom-path error path that fails loudly rather than silently regenerating elsewhere), and provides an idempotent removal routine. Includes reinstall semantics and cross-platform app-data path resolution. A clean example of platform-aware binary provisioning plus certificate lifecycle management that could be reused in other local development tooling.

file: src/certs.ts ↗ | tags: #certificate-management #platform-detection #binary-download #mkcert
Last analyzed: 2026-10-14 20:14:25.899063
Next check: 2026-10-21 20:14:25.896328
$ submit: