Deploy NestJS API (Redis)
Secure, blank NestJS API with rate limiting and auto-ban on Redis
nestjs-api-railway-template
Just deployed
Redis
Just deployed
/data
Deploy and Host NestJS API (Redis) on Railway
A secure, blank NestJS API starter that deploys the API and Redis in one click. It is designed for people who build with AI coding agents: it ships with an AGENTS.md that tells Claude Code, Codex, Cursor and other agents how the project works and how to extend it.
About Hosting NestJS API (Redis)
This template deploys two services: a NestJS 12 API and a Redis instance. Redis stores rate-limit counters and bans so they are shared and survive restarts. There is no database service, so you do not pay for one you do not use. To store data, add DATABASE_URL in the API's Variables (Supabase, Neon or any Postgres). Leave it empty to run without a database.
What is included:
- Rate limiting and auto-ban of abusive clients and vulnerability scanners (nestjs-shield), backed by Redis with an in-memory fallback if Redis is unreachable
- Input sanitization (HTML and script stripping) and strict validation on every request
- Helmet security headers, HTTP parameter pollution protection and gzip compression
- Environment variables validated at startup, so a bad config fails fast
- Structured JSON logs with authorization headers redacted
- Interactive API docs at
/docs(off in production unlessSWAGGER_ENABLED=true) - A
/healthendpoint used for Railway healthchecks - A
demofolder with working examples of every library, plus tests and linting with security rules
The template is blank on purpose: no login system, users or payments are built in. Clone the repository, open it with your coding agent and describe what you want to build.
Common Use Cases
- A backend API for a web or mobile app that uses Supabase for data and authentication
- A secure starting point for a SaaS, internal tool or MVP built with an AI coding agent
- A public API that needs protection against abuse, scrapers and brute-force attempts
- A webhook receiver or integration service that must stay online and rate limited
- A learning project that shows a clean controller, service and repository structure
Dependencies for NestJS API (Redis)
This template needs Node.js 22.12 or newer and a Redis instance, both provided automatically. A Postgres database is optional and brought by you.
Deployment Dependencies
- NestJS (Node.js 22.12 or newer)
- Redis, deployed by this template
- nestjs-shield
- Source repository: Yassinos-coder/nestjs-api-railway-template
- Optional: a Postgres database such as Supabase or Neon, set through
DATABASE_URL
Deployment Dependencies
- NestJS (Node.js 22.12 or newer)
- Redis, deployed by this template
- nestjs-shield
- Source repository: Yassinos-coder/nestjs-api-railway-template
- Optional: a Postgres database such as Supabase or Neon, set through
DATABASE_URL
Implementation Details
After deploying, check https:///health. It returns "database":"disabled" until you set DATABASE_URL. Open the repository's AGENTS.md and src/demo/README.md to see how to add your own features.
| Variable | Purpose |
|---|---|
DATABASE_URL | Optional Postgres connection string |
DATABASE_SSL | true for hosts that require SSL, such as Supabase |
CORS_ORIGINS | Optional comma-separated list of allowed frontend origins |
SWAGGER_ENABLED | Set to true to show /docs in production |
Why Deploy NestJS API (Redis) 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 NestJS API (Redis) 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
nestjs-api-railway-template
Yassinos-coder/nestjs-api-railway-templateRedis
redis:8.2