---
title: "Deploy NestJS API (Redis)"
description: "Secure, blank NestJS API with rate limiting and auto-ban on Redis"
category: "Starters"
url: https://railway.com/deploy/nestjs-api-redis
---

# Deploy NestJS API (Redis)

Secure, blank NestJS API with rate limiting and auto-ban on Redis

**[Deploy NestJS API (Redis) on Railway](https://railway.com/template/nestjs-api-redis)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/nestjs-api-redis/manifest.json

- **Creator:** Yassinos's Projects
- **Category:** Starters

## Template content

### nestjs-api-railway-template https://devicons.railway.app/nest

- **Source:** Yassinos-coder/nestjs-api-railway-template
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# 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](https://github.com/yassinos-coder/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 unless `SWAGGER_ENABLED=true`)
- A `/health` endpoint used for Railway healthchecks
- A `demo` folder 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](https://nestjs.com) (Node.js 22.12 or newer)
- [Redis](https://redis.io), deployed by this template
- [nestjs-shield](https://github.com/yassinos-coder/nestjs-shield)
- Source repository: [Yassinos-coder/nestjs-api-railway-template](https://github.com/Yassinos-coder/nestjs-api-railway-template)
- Optional: a Postgres database such as [Supabase](https://supabase.com) or [Neon](https://neon.tech), set through `DATABASE_URL`



### Deployment Dependencies

- [NestJS](https://nestjs.com) (Node.js 22.12 or newer)
- [Redis](https://redis.io), deployed by this template
- [nestjs-shield](https://github.com/yassinos-coder/nestjs-shield)
- Source repository: [Yassinos-coder/nestjs-api-railway-template](https://github.com/Yassinos-coder/nestjs-api-railway-template)
- Optional: a Postgres database such as [Supabase](https://supabase.com) or [Neon](https://neon.tech), 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.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [Next.js + Prisma + PostgreSQL Starter](https://railway.com/deploy/nextjs-prisma-postgres) — Deploy a Next.js app with Prisma ORM and PostgreSQL in one click.
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway

Open this page in a browser: https://railway.com/deploy/nestjs-api-redis
