Admin Development Setup
Set up the Portr admin dashboard for local development, so you can run and contribute to the team management interface on your machine.
The admin dashboard is built using Go (Fiber) for the backend and React for the frontend. The admin server is integrated into the main portrd binary.
Requirements
- Go (1.25+) - Go programming language
- Bun (1.1+)
- PostgreSQL (16+) or SQLite (3.0+)
Frontend Setup
Navigate to the admin frontend directory
Install frontend dependencies
Start the frontend development server
This starts the React development server with hot reloading enabled.
Backend Setup
Configure environment variables
Create a new .env file in the repo root. The admin server uses the following environment variables:
Start the admin server
This starts the admin server at http://localhost:8000. The server will automatically run database migrations if PORTR_AUTO_MIGRATE=true is set.
Alternative: Start both tunnel and admin servers
To start both the tunnel server and admin server together:
Development Workflow
File Structure
Available Commands
Frontend Commands
Portrd Server Commands
Go Development Commands
Configuration
For detailed configuration options, check out the server config file.
The admin server needs to be running before you can test tunnel connections, as it manages authentication and tunnel coordination.
Database Management
Database Support
The admin server supports both PostgreSQL and SQLite databases:
- PostgreSQL: Recommended for production deployments
- SQLite: Great for development and single-user setups
Running Migrations
Migrations are automatically run when you start the server if PORTR_AUTO_MIGRATE=true is set. To run them manually:
Migration Files
Migration files are located in the migrations/ directory and are managed using goose.
Database Connection
Configure your database connection using the PORTR_DB_URL environment variable:
For SQLite deployments, the server image can replicate the database to S3-compatible storage with Litestream. See SQLite Backups.
Troubleshooting
Common Issues
Port conflicts: Make sure ports 8000 (admin), 8001 (proxy), and 2222 (SSH) aren't being used by another service.
Database connection errors: Verify your database instance is running and the connection string is correct. For PostgreSQL, ensure the database exists and credentials are valid.
Go build errors: Ensure Go 1.25+ is installed and go mod tidy has been run to download dependencies.
Frontend build errors: Ensure Bun is installed and the lockfile is up to date. Try reinstalling dependencies with bun install --frozen-lockfile.
Migration errors: Ensure the database user has permissions to create/alter tables. For PostgreSQL, the user should have superuser privileges during initial setup.
Environment variable issues: Make sure the .env file is in the repo root and all required variables are set.
Development Tips
Hot reloading: Use PORTR_ADMIN_USE_VITE=true for frontend hot reloading during development.
Debug mode: Set PORTR_ADMIN_DEBUG=true to enable detailed logging.
Database debugging: Check the database logs for connection issues. For SQLite, ensure the database file path is writable.
API debugging: The admin server provides a health check endpoint at /api/v1/healthcheck.
Local Development
Set up the full Portr stack for local development and contribution, including the admin dashboard, tunnel server, and client CLI.
Tunnel Server Development Setup
Set up the Portr tunnel server for local development, so you can run and contribute to the SSH-based tunneling backend on your machine.