
Deploy unkey
Unkey - The Developer Platform for Modern APIs
Redis
Just deployed
/data
MySQL
Just deployed
/var/lib/mysql
unkeyed/unkey:v2.0.49
Just deployed
Deploy and Host Unkey on Railway
Unkey is an open-source API management platform that allows developers to secure their services with low-latency API key authentication. It provides out-of-the-box features such as rate limiting, usage tracking, and temporary keys, enabling you to build and scale your API infrastructure without creating a custom authentication layer from scratch.
About Hosting Unkey
Hosting Unkey involves deploying a high-performance Go-based backend alongside supporting data services.
Unkey is designed for speed (targeting <40ms key verification), and its architecture relies on:
- MySQL for persistent data (API configs, key metadata, encrypted hashes)
- Redis for real-time state management and rate-limiting counters
Earlier versions depended on third-party providers like PlanetScale. The modern Unkey stack is now fully self-hostable, meaning you can run the API and Dashboard entirely using open-source databases.
Railway simplifies this process by:
- Provisioning databases automatically
- Injecting environment variables securely
- Connecting services via a private internal network
Common Use Cases
SaaS API Authentication
Issue and manage unique API keys for customers with built-in revocation and rotation.
AI / LLM Usage Guardrails
Apply per-user rate limits and usage caps to prevent runaway AI costs.
Microservices Gateway
Secure internal service-to-service communication using short-lived or metadata-tagged keys.
Dependencies for Unkey Hosting
Required Services
-
MySQL
- Stores API configurations
- Key metadata
- Encrypted key hashes
-
Redis
- High-speed rate limiting
- Temporary counters
- Session and state data
Deployment Dependencies
- Unkey GitHub Repository
- Official Unkey Documentation
- Railway MySQL Documentation
Railway Implementation Details
MySQL Connection String
When configuring Unkey on Railway, ensure the database URL uses the Go MySQL driver format:
${{MySQL.MYSQLUSER}}:${{MySQL.MYSQLPASSWORD}}@tcp(${{MySQL.MYSQLHOST}}:${{MySQL.MYSQLPORT}})/${{MySQL.MYSQLDATABASE}}?parseTime=true
Set this value to:
UNKEY_DATABASE_PRIMARY
Redis Connection String
Use the following format for Redis:
redis://default:${{Redis.REDISPASSWORD}}@${{Redis.REDISHOST}}:${{Redis.REDISPORT}}
Set this value to:
UNKEY_REDIS_URL
Root Key Generation
Generate a secure root key directly in Railway using its random generator:
UNKEY_ROOT_KEY=${{random.hex(32)}}
This key is required to bootstrap and administer Unkey securely.
Why Deploy Unkey on Railway?
Railway is a single platform for deploying full infrastructure stacks.
Benefits include:
- Zero-config database provisioning
- Secure internal networking
- Automatic environment variable injection
- Vertical and horizontal scaling
- One-click deployments for services and databases
By deploying Unkey on Railway, you can support a production-grade API authentication layer with minimal operational overhead.
Host your servers, databases, APIs, and AI workloads—all in one place.
Summary
- ✅ Fully self-hosted Unkey stack
- ✅ MySQL + Redis architecture
- ✅ Railway-managed infrastructure
- ✅ Secure, scalable, low-latency API auth
Perfect for SaaS platforms, AI products, and internal microservices.
Template Content