Deploy NestJS API (Redis)

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

Deploy NestJS API (Redis)

Just deployed

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 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

Deployment Dependencies

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.

VariablePurpose
DATABASE_URLOptional Postgres connection string
DATABASE_SSLtrue for hosts that require SSL, such as Supabase
CORS_ORIGINSOptional comma-separated list of allowed frontend origins
SWAGGER_ENABLEDSet 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

More templates in this category

View Template
open-excalidraw
Self-hostable collaborative drawing built on Excalidraw

Prateek Mohanty
5
View Template
NEW
Next.js + Prisma + PostgreSQL Starter
Deploy a Next.js app with Prisma ORM and PostgreSQL in one click.

blueorange
0
View Template
caring-vibrancy
Deploy and Host caring-vibrancy with Railway

5