Documentation Index
Fetch the complete documentation index at: https://mintlify.com/siteway/netbird-selfservice/llms.txt
Use this file to discover all available pages before exploring further.
Overview
NetBird Selfservice uses environment variables for configuration. All settings are stored in the.env file at the root of your application. This page provides a comprehensive reference for all configuration options.
Environment Variables Reference
Application Settings
Core Laravel application configuration:| Variable | Required | Default | Description |
|---|---|---|---|
APP_NAME | Yes | "VPN Selfservice" | Application name displayed in UI and emails |
APP_ENV | Yes | local | Environment: local, staging, or production |
APP_KEY | Yes | Auto-generated | Encryption key (generated by php artisan key:generate) |
APP_DEBUG | Yes | true | Enable debug mode. Set to false in production |
APP_URL | Yes | http://localhost | Full URL where application is accessible |
APP_LOCALE | No | en | Default language |
APP_FALLBACK_LOCALE | No | en | Fallback language if translation missing |
APP_FAKER_LOCALE | No | en_US | Locale for fake data generation |
Database Configuration
Database connection settings:| Variable | Required | Default | Description |
|---|---|---|---|
DB_CONNECTION | Yes | sqlite | Database driver: mysql, mariadb, sqlite, or pgsql |
DB_HOST | No* | 127.0.0.1 | Database server hostname (not needed for SQLite) |
DB_PORT | No* | 3306 | Database server port (not needed for SQLite) |
DB_DATABASE | Yes | laravel | Database name or path to SQLite file |
DB_USERNAME | No* | root | Database username (not needed for SQLite) |
DB_PASSWORD | No* | - | Database password (not needed for SQLite) |
Variables marked with * are only required when using MySQL, MariaDB, or PostgreSQL.
Google OAuth Configuration
While the default is Google OAuth, NetBird Selfservice supports any OAuth provider compatible with Laravel Socialite.
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLIENT_ID | Yes | OAuth 2.0 Client ID from Google Cloud Console |
GOOGLE_CLIENT_SECRET | Yes | OAuth 2.0 Client Secret from Google Cloud Console |
GOOGLE_REDIRECT_URI | Yes | OAuth callback URL (must match Google Cloud Console configuration) |
Google OAuth Setup
Access Google Cloud Console
Navigate to Google Cloud Console and sign in with your Google account.
Create or Select Project
Create a new project or select an existing one for your NetBird Selfservice deployment.
Enable OAuth Consent Screen
- Navigate to APIs & Services > OAuth consent screen
- Choose Internal (for Google Workspace) or External
- Fill in application name, user support email, and developer contact
- Add scopes:
email,profile,openid
Create OAuth Credentials
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application as application type
- Add authorized redirect URI:
https://your-domain.test/auth/google/callback - Click Create
NetBird API Configuration
Settings for NetBird API integration:| Variable | Required | Description |
|---|---|---|
NETBIRD_API_URL | Yes | NetBird API endpoint URL |
NETBIRD_API_TOKEN | Yes | API access token with network management permissions |
NETBIRD_NETWORK_ID | Yes | ID of the NetBird network to manage resources in |
NETBIRD_NETWORK_NAME | No | Display name of your NetBird network |
NETBIRD_ADMIN_EMAIL | Yes | Email address of the admin user (receives admin privileges) |
NETBIRD_EGRESS_IP | Yes | Egress IP address displayed to users for reference |
NETBIRD_RESOURCE_GROUP_NAME | Yes | Name of the NetBird group where resources are assigned |
NETBIRD_USER_GROUP_NAME | Yes | Name of the NetBird group containing users who can access resources |
NetBird API Setup
Log in to NetBird Dashboard
Navigate to NetBird Dashboard and sign in to your account.
Create API Token
- Go to Settings > Access Tokens
- Click Create Access Token
- Give it a descriptive name (e.g., “Selfservice API”)
- Select appropriate permissions (network management required)
- Copy the generated token immediately (it won’t be shown again)
Find Network ID
- Navigate to your network in the NetBird dashboard
- The Network ID is visible in the URL or network settings
- Copy it to
NETBIRD_NETWORK_IDin your.envfile
Create Required Groups
Create two groups in NetBird:User Group (e.g., “Employees”):
- Contains users who will access VPN resources
- Add your team members to this group
- Resources created through Selfservice are assigned here
- Should have access policies allowing the User Group to connect
Security Configuration
Security and access control settings:| Variable | Required | Description |
|---|---|---|
NETBIRD_ALLOWED_DOMAIN | Strongly Recommended | Email domain allowed to sign in (e.g., example.com) |
BCRYPT_ROUNDS | No | Number of bcrypt hashing rounds (default: 12) |
Session & Cache Configuration
Session and caching behavior:| Variable | Default | Description |
|---|---|---|
SESSION_DRIVER | database | Session storage driver |
SESSION_LIFETIME | 120 | Session lifetime in minutes |
CACHE_STORE | database | Cache storage driver |
QUEUE_CONNECTION | database | Queue driver for background jobs |
Logging Configuration
Application logging settings:| Variable | Default | Description |
|---|---|---|
LOG_CHANNEL | stack | Logging channel |
LOG_STACK | single | Stack configuration |
LOG_LEVEL | debug | Minimum log level |
Mail Configuration
Email delivery settings (optional, for notifications):By default, emails are logged rather than sent. Configure a real mail driver (SMTP, Mailgun, etc.) if you need email notifications.
Configuration Best Practices
Production Checklist
Production Checklist
Before deploying to production:
- Set
APP_ENV=production - Set
APP_DEBUG=false - Configure
APP_URLwith your production domain - Use MySQL/MariaDB instead of SQLite
- Set
NETBIRD_ALLOWED_DOMAINto restrict access - Generate a strong
APP_KEY - Use HTTPS for
APP_URLandGOOGLE_REDIRECT_URI - Set appropriate
LOG_LEVEL(warning or error) - Secure your
.envfile permissions (chmod 600) - Never commit
.envto version control
Security Hardening
Security Hardening
Enhance security with these measures:
- Domain Restriction: Always set
NETBIRD_ALLOWED_DOMAIN - API Token Security: Rotate
NETBIRD_API_TOKENregularly - Admin Access: Limit
NETBIRD_ADMIN_EMAILto trusted users only - File Permissions: Ensure
.envis readable only by the application user - HTTPS: Always use HTTPS in production
- Database Security: Use strong database passwords and restrict network access
- Session Security: Set
SESSION_ENCRYPT=trueif handling sensitive data
Performance Optimization
Performance Optimization
For better performance:
- Use Redis for
CACHE_STOREandSESSION_DRIVERin production - Configure
QUEUE_CONNECTION=rediswith a dedicated queue worker - Enable OPcache in PHP configuration
- Use
composer install --optimize-autoloader --no-devin production - Run
php artisan config:cacheandphp artisan route:cache
Development vs Production
Development vs Production
Key differences between environments:
| Setting | Development | Production |
|---|---|---|
APP_ENV | local | production |
APP_DEBUG | true | false |
DB_CONNECTION | sqlite | mysql |
LOG_LEVEL | debug | error |
CACHE_STORE | database | redis |
SESSION_DRIVER | database | redis |
Verifying Configuration
After configuring your environment variables, verify the setup:Troubleshooting
OAuth Redirect Mismatch
OAuth Redirect Mismatch
If you see “redirect_uri_mismatch” error:
- Verify
GOOGLE_REDIRECT_URIexactly matches Google Cloud Console - Check protocol (http vs https)
- Ensure port numbers match if using non-standard ports
- Clear browser cache and cookies
NetBird API Errors
NetBird API Errors
If NetBird API calls fail:
- Verify
NETBIRD_API_TOKENis valid and not expired - Check token has appropriate permissions
- Confirm
NETBIRD_NETWORK_IDis correct - Test API connectivity:
curl -H "Authorization: Bearer $NETBIRD_API_TOKEN" $NETBIRD_API_URL/api/networks
Domain Restriction Not Working
Domain Restriction Not Working
If users from other domains can sign in:
- Verify
NETBIRD_ALLOWED_DOMAINis set in.env - Clear configuration cache:
php artisan config:clear - Check for typos in the domain name
- Ensure no trailing spaces in the value
Next Steps
With configuration complete, you’re ready to:First Login
Sign in with your Google account and start using NetBird Selfservice
User Guide
Learn how to create and manage VPN resources