ngrok
Expose local services to the internet through secure tunnels. Use ngrok to share development servers, test webhooks locally, demo applications to clients, and create temporary public URLs for any local port.
What this skill does
# ngrok
## Overview
Expose local services to the internet through secure ngrok tunnels. Share development servers with clients, test webhooks from Stripe/GitHub/Telegram locally, create temporary public URLs for any local port, and inspect all incoming traffic in real time.
### Prerequisites
- ngrok CLI installed (`brew install ngrok`, `snap install ngrok`, or download from https://ngrok.com/download)
- ngrok account with authtoken configured (`ngrok config add-authtoken <token>`)
- A local service running on a port you want to expose
## Instructions
### Basic HTTP Tunnel
Expose a local web server to the internet:
```bash
# Expose local port 3000 (e.g., Next.js, React dev server)
ngrok http 3000
```
Creates a public URL like `https://abc123.ngrok-free.app` forwarding to `localhost:3000`. The URL changes on each restart unless you use a custom domain.
### Custom Domain
Use a static domain so the URL persists between sessions:
```bash
# Free static domain (one per account)
ngrok http --domain=your-app.ngrok-free.app 3000
# Custom domain you own (paid plan)
ngrok http --domain=dev.yourcompany.com 3000
```
### Webhook Testing
Expose a local endpoint for webhook development:
```bash
# Start tunnel for webhook receiver on port 8080
ngrok http 8080
# Inspect webhook payloads at http://127.0.0.1:4040
```
The inspector at `localhost:4040` shows every request with headers, body, and timing. Replay requests to debug without retriggering the webhook.
### Configuration File
Define tunnels in `ngrok.yml` for multi-service setups:
```yaml
# ~/.config/ngrok/ngrok.yml
version: "3"
agent:
authtoken: your-authtoken-here
tunnels:
webapp:
addr: 3000
proto: http
domain: your-app.ngrok-free.app
inspect: true
api:
addr: 8080
proto: http
inspect: true
ssh:
addr: 22
proto: tcp
```
```bash
ngrok start --all # Start all tunnels
ngrok start webapp api # Start specific tunnels
```
### TCP and TLS Tunnels
Expose non-HTTP services — databases, SSH, game servers:
```bash
ngrok tcp 22 # SSH
ngrok tcp 5432 # PostgreSQL
ngrok tls 443 # TLS termination at ngrok edge
```
### Request Inspection and Replay
```bash
ngrok http 3000
# Open http://127.0.0.1:4040 or use the API:
curl http://127.0.0.1:4040/api/requests/http
```
Use the inspector to view requests, replay them, filter by status/method, and export data.
### Authentication and Security
```bash
# Basic auth
ngrok http 3000 --basic-auth="user:password"
# IP restriction (paid plan)
ngrok http 3000 --cidr-allow="203.0.113.0/24"
# Webhook signature verification
ngrok http 3000 --verify-webhook=stripe --verify-webhook-secret=whsec_xxx
```
### Traffic Policy
Apply middleware rules to traffic before it reaches your service:
```yaml
# traffic-policy.yml
on_http_request:
- actions:
- type: rate-limit
config:
name: global
algorithm: sliding_window
capacity: 100
rate: 60s
bucket_key:
- conn.client_ip
- expressions:
- req.url.path.startsWith('/api/webhooks')
actions:
- type: verify-webhook
config:
provider: stripe
```
```bash
ngrok http 3000 --traffic-policy-file=traffic-policy.yml
```
### ngrok API
Manage tunnels programmatically:
```javascript
const response = await fetch('https://api.ngrok.com/tunnels', {
headers: { 'Authorization': `Bearer ${NGROK_API_KEY}`, 'Ngrok-Version': '2' }
});
const { tunnels } = await response.json();
```
### Docker Integration
```yaml
# docker-compose.yml
services:
app:
build: .
ports:
- "3000:3000"
ngrok:
image: ngrok/ngrok:latest
restart: unless-stopped
command: "http app:3000 --domain=your-app.ngrok-free.app"
environment:
- NGROK_AUTHTOKEN=${NGROK_AUTHTOKEN}
ports:
- "4040:4040"
depends_on:
- app
```
### Common Patterns
**Local demo for clients:**
```bash
ngrok http 3000 --basic-auth="demo:clientname2025"
```
**Telegram/Slack bot development:**
```bash
node bot.js # listening on :8443
ngrok http 8443 --domain=your-bot.ngrok-free.app
# Set webhook: https://api.telegram.org/bot<token>/setWebhook?url=https://your-bot.ngrok-free.app/webhook
```
**CI/CD preview environments:**
```bash
ngrok http 3000 --domain=pr-${PR_NUMBER}.ngrok-free.app &
```
## Examples
### Expose a Next.js dev server for client review
```prompt
I'm building a Next.js app on port 3000 and need to share it with a client for review. Set up ngrok with a stable URL and basic auth so only they can access it.
```
### Test Stripe webhooks locally
```prompt
I'm integrating Stripe payments. Set up ngrok to receive webhooks on my local server (port 8080) with Stripe signature verification, and show me how to use the inspector to debug incoming events.
```
### Multi-service development environment
```prompt
I have a frontend on port 3000, API on port 8080, and a WebSocket server on port 3001. Create an ngrok config that exposes all three with stable domains and request inspection enabled.
```
## Guidelines
- Use custom domains for stable URLs — free accounts get one static domain
- Always use `--basic-auth` when sharing tunnels with external parties
- Use the inspector at `localhost:4040` to debug webhook payloads before writing handler code
- For production webhook receivers, use `--verify-webhook` to validate request signatures
- Define multi-tunnel setups in `ngrok.yml` rather than running multiple CLI commands
- TCP tunnels expose raw ports — only use for trusted services like SSH with key auth
- The free plan has rate limits and connection limits; paid plans remove these
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.