JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q46993F
  • License MIT

One command. HTTPS everywhere. Zero config.

Package Exports

  • trustlocal
  • trustlocal/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trustlocal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

trustlocal

One command. HTTPS everywhere. Zero config.

npm version npm downloads license

trustlocal automates local HTTPS setup for web development projects. It uses mkcert to generate locally trusted certificates, then detects your framework and injects the correct SSL configuration — eliminating every manual step between "I want HTTPS locally" and "it works."


Quick start

npx trustlocal init

That's it. trustlocal will:

  1. Install mkcert if not already present
  2. Register the local CA (prompts for sudo once)
  3. Detect your framework (Next.js, Vite, Express, Nginx, or plain)
  4. Generate trusted certificates for localhost and 127.0.0.1
  5. Inject HTTPS config into your framework's config file
  6. Set NODE_EXTRA_CA_CERTS in .env
  7. Add .trustlocal/ to .gitignore
  8. Write trustlocal.json so teammates can sync with one command

Commands

init — First-time setup

npx trustlocal init [--domains myapp.local] [--force] [--dry-run]
Flag Description
--domains <list> Comma-separated extra domains (e.g. --domains myapp.local,api.local)
--force Re-initialise even if trustlocal.json already exists
--dry-run Preview what would happen without writing any files

sync — Onboard a new teammate

npx trustlocal sync

Reads trustlocal.json, generates fresh certs on the new machine (no private key sharing), injects config identically, and gets HTTPS working in under 30 seconds.

renew — Renew expiring certs

npx trustlocal renew [--force]

Certs expire after 2 years. Deletes old certs and generates fresh ones. Framework config files are not touched — cert paths stay the same.

status — Check your setup

npx trustlocal status

Shows framework, cert expiry, config injection status, NODE_EXTRA_CA_CERTS, and .gitignore — with coloured OK / WARNING / ERROR indicators.


Supported frameworks

Framework Detection Config target
Next.js next in package.json next.config.js/tsexperimental.https
Vite vite in package.json vite.config.js/tsserver.https
Express / Node express in deps or server.js found .envNODE_EXTRA_CA_CERTS + printed snippet
Nginx nginx.conf in project root nginx.confssl_certificate block
Plain fallback Certs placed in .trustlocal/ with instructions

How it works

npx trustlocal init

  → Checking mkcert...
  ✓  mkcert 1.4.4 found
  → Detecting framework...
  ✓  Detected: Next.js (next.config.ts)
  → Generating certificates for: localhost, 127.0.0.1
  ✓  Certificates generated → .trustlocal/
  → Injecting HTTPS config into next.config.ts...
  ✓  Config updated
  → Updating .env...
  ✓  NODE_EXTRA_CA_CERTS set
  → Updating .gitignore...
  ✓  .trustlocal/ added to .gitignore

  ✓  Done! Open https://localhost:3000

  Teammates: run  npx trustlocal sync  to get HTTPS on their machines.
  Cert expires: 2028-03-31

Security

  • .trustlocal/ (containing .pem files) is automatically added to .gitignoreprivate keys are never committed
  • trustlocal.json is safe to commit — it contains no keys, only config metadata
  • All cert generation happens locally via mkcert. trustlocal never reads, stores, or transmits any private key

Requirements

  • Node.js 18+
  • macOS or Linux (Windows support is post-v1)

License

MIT © Sahil Kashyap