Railway

Deploy newapi

new-api (AI) railway template

Deploy newapi

newapi-railway-template

dielect/newapi-railway-template

Just deployed

/var/lib/postgresql/data

Just deployed

/data

Deploy and Host newapi on Railway

newapi is an open-source API management and distribution platform that supports multiple AI model providers (OpenAI, Azure, Anthropic, etc.). It provides a unified API gateway with features like token management, quota control, usage tracking, and multi-tenant support, making it ideal for teams and organizations managing access to various LLM services.

About Hosting newapi

Hosting newapi requires a web server to run the Go-based backend along with a React frontend, and a persistent data store for configuration, user accounts, tokens, and usage logs. The Railway template streamlines this by bundling newapi with PostgreSQL for primary data storage and Redis for caching and rate limiting—all pre-configured and wired together. Railway handles database provisioning, networking between services, environment variable injection, and automatic builds from the Docker image. This means you can go from template deployment to a fully functional API management platform in minutes, without manually configuring any infrastructure.

Common Use Cases

  • Unified API Gateway for LLMs: Aggregate multiple AI providers (OpenAI, Claude, Gemini, etc.) behind a single endpoint, allowing consumers to switch models without changing integration code.
  • Team & Organization Token Management: Issue individual API tokens to team members or departments with per-token rate limits, quota caps, and usage tracking for cost control.
  • API Redistribution & Reselling: Operate a managed API service where you distribute access to upstream AI models to end users with custom pricing, balance management, and usage analytics.

Dependencies for newapi Hosting

  • PostgreSQL: Primary database for storing users, tokens, channels, logs, and configuration data — provisioned automatically by the Railway template.
  • Redis: Handles caching, rate limiting, and improved performance under high concurrency — provisioned automatically by the Railway template.

Deployment Dependencies

Implementation Details

The Railway template automatically provisions PostgreSQL and Redis alongside the newapi service. All environment variables are pre-wired using Railway's reference variables:

# PostgreSQL connection (auto-configured via Railway reference variables)
SQL_DSN=postgres://${{Postgres.PGUSER}}:${{Postgres.PGPASSWORD}}@${{Postgres.PGHOST}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}

# Redis connection (auto-configured via Railway reference variables)
REDIS_CONN_STRING=redis://default:${{Redis.REDISPASSWORD}}@${{Redis.REDISHOST}}:${{Redis.REDISPORT}}

# Session secret (auto-generated by the template)
SESSION_SECRET=your-random-secret-key

# Server port (Railway sets PORT automatically)
PORT=3000

After deployment, access the web dashboard at your Railway-provided domain. The default admin credentials are username: root and password: 123456change these immediately upon first login.

Why Deploy newapi 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 newapi 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

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
View Template
openui
Deploy OpenUI: AI-powered UI generation with GitHub OAuth and OpenAI API.

zexd
View Template
firecrawl
firecrawl api server + worker without auth, works with dify

Rama