The connect expose command creates a secure tunnel that makes your local services accessible to other agents in your workspace. Whether itβs a database, API, or any TCP/UDP service, Private Connect handles the networking so you can focus on development.
Quick Start: Use the shorthand connect <target> instead of connect expose <target> for faster commands.
Run the command on the machine where your service is running:
connect expose localhost:5432 --name prod-db
Output:
π Exposing localhost:5432 as "prod-db"... Agent ID: 550e8400-e29b-41d4-a716-446655440000 Label: laptop Hub URL: https://api.privateconnect.co[ok] Service registered Service ID: svc_abc123 Tunnel Port: 40001 Protocol: tcp[ok] Connected to hub[ok] Tunnel establishedπ‘ Service "prod-db" is now accessible through the hub From another machine: $ connect reach prod-db This creates a local tunnel so the service appears on localhost Running initial diagnostics...[ok] prod-db is REACHABLE DNS [ok] TCP [ok] 45ms Press Ctrl+C to stop exposing
2
Service is now available
Your service is now accessible to other agents in your workspace through the hub.
The tunnel stays active as long as the command is running. Press Ctrl+C to stop exposing the service.
Create a public URL that anyone can access, perfect for webhooks and demos:
connect expose localhost:3000 --public
Output:
π Public URL: https://abc123.privateconnect.co External services (Stripe, GitHub, etc.) can send webhooks to this URLπ‘ Service "my-app" is now accessible through the hub Public URL: https://abc123.privateconnect.co Anyone can reach this service at the URL above
Public URLs are not recommended for database services (PostgreSQL, MySQL, Redis, etc.). Use connect reach instead for secure peer-to-peer connections.
Private Connect automatically prevents public URLs for database ports:
connect expose localhost:5432 --public
Output:
[!] --public creates a public HTTP URL, which doesn't work for database/TCP services (port 5432). To access this service remotely, use: connect reach prod-db
Protected ports: 5432 (PostgreSQL), 3306 (MySQL), 27017 (MongoDB), 6379 (Redis), and more.