Deploy OpenShortURL
Open-source URL shortener with analytics, custom slugs, QR codes & API
frontend
supra126/open-short-url
Just deployed
Postgres
railwayapp-templates/postgres-ssl:17
Just deployed
/var/lib/postgresql/data
Redis
redis:8.2.2
Just deployed
/data
backend
supra126/open-short-url
Just deployed
Deploy and Host OpenShortURL on Railway
OpenShortURL is a modern, self-hosted URL shortener with advanced analytics and security features. Built with NestJS and Next.js, it provides custom slugs, password protection, UTM tracking, two-factor authentication, link bundles for organization, bot detection and filtering, comprehensive click analytics, QR code generation, and AI-powered features including a built-in chat assistant (supporting Anthropic Claude, OpenAI GPT, Google Gemini) and Model Context Protocol (MCP) integration for managing URLs through external AI tools like Claude Desktop.
About Hosting OpenShortURL
Deploying OpenShortURL on Railway provides a complete URL shortening solution with minimal configuration. The platform includes a NestJS backend API, Next.js frontend dashboard, PostgreSQL database, and Redis for caching. It features a built-in AI chat assistant for managing URLs through natural conversation (optional, requires AI provider API key), link bundles for organizing URLs into collections, automatic bot detection and filtering, Cloudflare Turnstile integration, JWT-based authentication with httpOnly cookies, and real-time analytics including geolocation tracking, device detection, browser analysis, and referrer statistics. The entire stack deploys automatically with Railway's infrastructure.
Common Use Cases
- Track marketing campaign performance with UTM parameters and detailed click analytics
- Create branded short links with custom slugs for social media and content sharing
- Secure internal link sharing with password protection and two-factor authentication
- Organize URLs into bundles/collections for better campaign and project management
- Filter bot traffic from analytics to get accurate human interaction metrics
- Manage URLs through conversational AI directly in the web interface using the built-in chat assistant
- Integrate with external AI assistants (Claude Desktop, Cursor, Windsurf) using natural language via MCP integration
Dependencies for OpenShortURL Hosting
- PostgreSQL database for storing URLs, users, bundles, and analytics data
- Redis (optional) for caching, session management, and rate limiting
- Node.js 18+ runtime environment
- Cloudflare Turnstile (optional) for bot protection
- AI Provider API Key (optional) for built-in chat assistant:
- Anthropic API key for Claude models
- OpenAI API key for GPT models
- Google API key for Gemini models
Deployment Dependencies
- OpenShortURL GitHub Repository
- NestJS Framework Documentation
- Next.js Framework Documentation
- Prisma ORM Documentation
Implementation Details
Required Environment Variables:
DATABASE_URL=postgresql://user:password@host:5432/database
JWT_SECRET=your-jwt-secret-key
SHORT_URL_DOMAIN=https://your-domain.com
Optional AI Chat Assistant Variables:
AI_PROVIDER=anthropic # Options: anthropic, openai, google
AI_MODEL=claude-3-5-sonnet-20241022
ANTHROPIC_API_KEY=sk-ant-your-api-key-here
# OR
AI_PROVIDER=openai
AI_MODEL=gpt-4o
OPENAI_API_KEY=sk-your-api-key-here
# OR
AI_PROVIDER=google
AI_MODEL=gemini-2.0-flash-exp
GOOGLE_API_KEY=your-api-key-here
Post-Deployment:
npx prisma migrate deploy
Why Deploy OpenShortURL on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying OpenShortURL on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content