tuna --init
Interactive setup wizard for configuring tuna in your project.
Usage
tuna --initWhat It Does
- Checks for existing
package.json - Detects if tuna is already configured
- Prompts for configuration options
- Writes config to
package.json
Interactive Flow
$ tuna --init
🐟 Tuna Project Setup
? Use $USER variable for unique subdomains per developer? Yes
? Subdomain pattern (will become $USER-<pattern>.example.com): api
? Local port to forward: 3000
? Enable Zero Trust Access control? Yes
? Access rules (comma-separated emails or @domains): @mycompany.com
✓ Configuration saved to package.json
Added to package.json:
{
"tuna": {
"forward": "$USER-api.example.com",
"port": 3000,
"access": ["@mycompany.com"]
}
}
Next steps:
Run: tuna npm run dev
Your tunnel URL will be:
https://alice-api.example.comOptions
Subdomain Pattern
Choose a pattern for your subdomain:
- With
$USER:$USER-api.example.com→alice-api.example.com - Without:
api.example.com(fixed subdomain)
Port
The local port your dev server runs on. Common defaults:
| Framework | Default Port |
|---|---|
| Vite | 5173 |
| Next.js | 3000 |
| Create React App | 3000 |
| Express | 3000 |
| FastAPI | 8000 |
Access Control
Optionally restrict who can access your tunnel:
@company.com- Anyone with that email domainuser@example.com- Specific email addresses
Overwriting Existing Config
If tuna is already configured, you'll be asked to confirm:
$ tuna --init
? Tuna config already exists. Overwrite? No
Keeping existing config.Manual Alternative
Instead of --init, you can manually add to package.json:
{
"name": "my-app",
"tuna": {
"forward": "$USER-api.example.com",
"port": 3000,
"access": ["@mycompany.com"]
}
}Prerequisites
- Must have a
package.jsonin current directory - Should have run
tuna --loginfirst (for domain suggestion)
See Also
- Configuration - All config options
- tuna --login - Set up credentials first
- Team Collaboration - Using $USER for teams