Admin panel for managing Traefik dynamic configurations with authentication support, including shared links and SSO integration.
Can be used standalone but built in mind with Headscale and other VPN to expose internally hosted servcices to the outside world. Enabling functionality in some ways similar to Tailscale Funnel but for Headscale. Inspired by the approach of Pangolin.
- Dynamic Traefik Configuration: Automatically generates Traefik configurations from database
- Service Management: Full CRUD operations for proxy services
- Multiple Authentication Methods:
- No authentication
- Shared links with expiry
- SSO integration with group/user authorization
- Session Management: Memory-cached sessions with admin oversight
- Real-time Updates: Live configuration updates for Traefik
- Modern UI: Built with Next.js 15, TypeScript, and shadcn/ui
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Admin Panel │────▶│ PostgreSQL │ │ Traefik │
│ (Next.js) │ │ Database │ │ Reverse │
└─────────────────┘ └─────────────────┘ │ Proxy │
└─────────────────┘
│
┌───────────────────────────┘
▼
┌─────────────────┐
│ Target Services │
│ (HTTP/HTTPS) │
└─────────────────┘
git clone <repository-url>
cd traefik-proxy-admin
pnpm install
# Start PostgreSQL with Docker Compose
docker-compose up -d
# Generate and run database migrations
pnpm db:generate
pnpm db:push
cp .env.example .env
# Edit .env with your configuration
pnpm dev
The admin panel will be available at http://localhost:3000
- Service configuration (name, subdomain, target IP/port)
- Authentication method (none, shared_link, sso)
- Enable/disable status
- SSO user/group authorization
- One-time or expiring shared links
- Session duration configuration
- Usage tracking
- Active user sessions
- Memory-cached for performance
- Automatic cleanup of expired sessions
- Application-wide configuration
- SSO provider settings
- Global domain and certificate configuration
- Global middleware settings
GET /api/traefik/config
- Dynamic Traefik configuration
GET /api/services
- List all servicesPOST /api/services
- Create new servicePUT /api/services/[id]
- Update serviceDELETE /api/services/[id]
- Delete servicePOST /api/services/share-link
- Generate shared link
GET /api/auth/verify
- Forward-auth endpoint for TraefikPOST /api/auth/shared-link
- Authenticate with shared linkGET /api/auth/sso/login
- Initiate SSO loginGET /api/auth/sso/callback
- SSO callback handler
GET /api/sessions
- List active sessionsDELETE /api/sessions
- Delete all sessionsDELETE /api/sessions/[id]
- Delete specific session
GET /api/config
- Get global Traefik configurationPUT /api/config
- Update global configuration
The admin panel now supports configurable global settings that affect all services:
- Base Domain: Set the root domain (e.g.,
exposed.example.com
) - Services become accessible as
{subdomain}.{baseDomain}
- Supports wildcard certificates for privacy (no service names in CT logs)
- Cert Resolver: Configurable Traefik certificate resolver name
- Supports DNS challenge mode for wildcard certificates
- Example:
letsencrypt-dns
for*.exposed.example.com
- Global Middlewares: Applied to all services automatically
- Per-Service Middlewares: Additional middlewares per service
- Order: Global → Auth (if enabled) → HTTPS redirect → Service-specific
Configure Traefik to use this service as a configuration provider:
# traefik.yml
providers:
http:
endpoints:
- "http://localhost:3000/api/traefik/config"
pollInterval: "10s"
# Forward authentication
api:
dashboard: true
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
# Configure your certificate resolver for wildcard certificates
certificatesResolvers:
letsencrypt-dns: # Match this name in admin panel
acme:
email: [email protected]
storage: acme.json
dnsChallenge:
provider: cloudflare # Your DNS provider
delayBeforeCheck: 10
{
"baseDomain": "exposed.example.com",
"certResolver": "letsencrypt-dns",
"globalMiddlewares": ["compression", "security-headers", "rate-limit"]
}
This configuration will:
- Make services accessible as
{service}.exposed.example.com
- Use wildcard certificate
*.exposed.example.com
- Apply compression, security headers, and rate limiting to all services
Services are publicly accessible without any authentication.
- Generate time-limited, one-use links
- Configurable session duration
- Automatic session creation upon link usage
- Configurable OAuth2/OIDC providers
- Group and user-based authorization
- Automatic session management
SSO settings are managed through the admin panel and stored in the app_config
table:
{
"enabled": true,
"idpUrl": "https://your-idp.com",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"redirectUri": "http://localhost:3000/api/auth/sso/callback",
"scopes": ["openid", "profile", "groups"]
}
- Sessions are stored in PostgreSQL and cached in memory for performance
- Automatic cleanup of expired sessions
- Admin interface for viewing and managing active sessions
- Real-time session validation for Traefik forward-auth
# Generate new migration
pnpm db:generate
# Push schema changes
pnpm db:push
# View database in Drizzle Studio
pnpm db:studio
src/
├── components/ui/ # shadcn/ui components
├── db/ # Database schema and connection
├── lib/ # Utility functions
│ ├── traefik-config.ts # Traefik configuration generation
│ ├── session-manager.ts # Session management with memory cache
│ ├── shared-links.ts # Shared link utilities
│ ├── sso-config.ts # SSO configuration and handlers
│ └── utils.ts # General utilities
app/
├── api/ # API routes
│ ├── services/ # Service CRUD operations
│ ├── sessions/ # Session management
│ ├── traefik/ # Traefik configuration endpoint
│ └── auth/ # Authentication endpoints
├── sessions/ # Session management UI
├── auth/ # Authentication pages
└── page.tsx # Main admin panel
- All authentication tokens are stored securely with httpOnly cookies
- CSRF protection through state parameters in SSO flows
- Session tokens are cryptographically secure random values
- Forward-auth validation prevents unauthorized access
- Automatic session cleanup prevents token accumulation
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
[Add your license here]