If you've ever needed to share a local project with a colleague or client, you've probably come across both ngrok and prev. While they can look similar on the surface — both give you a public URL — they solve fundamentally different problems. This article breaks down when to use which.
What ngrok Does
ngrok creates secure tunnels from the public internet to your local machine. When you run ngrok http 3000, it exposes your localhost port through a temporary public URL. Your app keeps running on your computer; ngrok simply routes external traffic to it.
ngrok Strengths
- Instant tunneling: Expose any local port to the internet in seconds
- Webhook development: Test third-party callbacks (Stripe, GitHub, etc.) against your local server
- No deployment needed: Your code stays on your machine, running in your local environment
- Traffic inspection: Built-in request/response inspector for debugging
ngrok Limitations
- Your machine must stay on: Close the laptop, and the tunnel dies — along with anyone's ability to view it
- Network-dependent: Performance depends on your local internet connection
- Single user: Only practical for sharing your own machine's work
- No isolated environments: Everyone who accesses the URL hits your exact local state, including any debug breakpoints or half-finished code
What prev Does
prev deploys your project to a cloud-hosted container and gives it a permanent URL that works until the environment expires. When you run prev, it packages your source code, builds it in the cloud, and serves it from dedicated infrastructure.
prev Strengths
- Truly independent: Previews run on cloud infrastructure — your machine can be off
- Consistent URLs: Each preview gets a stable URL like
cosmic-falcon.us.prev.sh - Isolated environments: Every preview is a separate container with its own state
- Team-friendly: Previews can be shared with anyone, no local setup required
- CI/CD integration: Automate preview creation for every pull request
prev Limitations
- Requires deployment: Code is uploaded and built in the cloud (typically under 30 seconds)
- Not for local debugging: Designed for sharing and review, not for inspecting requests hitting your local server
Side-by-Side Comparison
| Feature | prev | ngrok |
|---|---|---|
| How it works | Deploys to cloud container | Tunnels to your localhost |
| URL lifetime | Configurable TTL (hours to days) | Session-based (dies when you stop it) |
| Requires local server running | No | Yes |
| Works offline | Yes (after deploy) | No |
| Multi-project support | Unlimited concurrent previews | Typically one tunnel per plan |
| CI/CD integration | Built-in | Not designed for it |
| Use case | Share deployed previews with teams/clients | Expose local dev server temporarily |
| Supported projects | Any web project (Node.js, Python, Go, Docker, etc.) | Anything running on a local port |
When to Use ngrok
ngrok is the right choice when you need to:
- Test webhooks locally: Receive Stripe payment callbacks, GitHub webhooks, or Slack events on your development machine
- Quick demo from your laptop: Show something to a colleague for a few minutes while you're both online
- Debug incoming requests: Use ngrok's built-in inspector to examine request payloads
- Develop with third-party APIs: Many APIs require a public callback URL during development
When to Use prev
prev is the right choice when you need to:
- Share previews with clients or stakeholders: They can review on their own time without depending on your machine being on
- Create PR-based preview environments: Automatically deploy a preview for every pull request in CI/CD
- Replace staging servers: Ephemeral preview environments that spin up on demand instead of maintaining permanent staging infrastructure
- Team reviews: Multiple team members can review the same isolated, stable preview independently
- Persist beyond your session: Previews stay live for hours or days, regardless of your local setup
Can You Use Both?
Absolutely. Many developers use ngrok during active local development — especially for webhook testing — and prev when it's time to share work with others. They complement each other:
Conclusion
ngrok and prev are not competitors — they're tools for different stages of the development workflow. ngrok bridges your local machine to the internet for development and debugging. prev deploys your code to the cloud for sharing, review, and collaboration.
If you're looking for a way to share work that doesn't depend on your laptop staying open, try prev for free.