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.
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 initThat's it. trustlocal will:
- Install mkcert if not already present
- Register the local CA (prompts for sudo once)
- Detect your framework (Next.js, Vite, Express, Nginx, or plain)
- Generate trusted certificates for
localhostand127.0.0.1 - Inject HTTPS config into your framework's config file
- Set
NODE_EXTRA_CA_CERTSin.env - Add
.trustlocal/to.gitignore - Write
trustlocal.jsonso 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 syncReads 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 statusShows 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/ts — experimental.https |
| Vite | vite in package.json |
vite.config.js/ts — server.https |
| Express / Node | express in deps or server.js found |
.env — NODE_EXTRA_CA_CERTS + printed snippet |
| Nginx | nginx.conf in project root |
nginx.conf — ssl_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-31Security
.trustlocal/(containing.pemfiles) is automatically added to.gitignore— private keys are never committedtrustlocal.jsonis safe to commit — it contains no keys, only config metadata- All cert generation happens locally via
mkcert.trustlocalnever reads, stores, or transmits any private key
Requirements
- Node.js 18+
- macOS or Linux (Windows support is post-v1)
License
MIT © Sahil Kashyap