Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 6 min read How-to mediumAdept

Building a NestJS App on Railway

A NestJS app can run on Railway as a Dockerized service from a GitHub repo, with Redis for caching, Postgres via TypeORM, and in-process cron jobs. The walkthrough supplies a Node 20 Dockerfile, an async CacheModule factory using cache-manager-redis-store with a one-week TTL, and a TypeOrmModule config. Each piece reads its connection details from Railway reference variables such as ${{Redis.REDISHOST}} and ${{Postgres.PGHOST}}. For the fastest path, a one-click Railway template provisions the same stack, and ejecting from it afterward puts the repo under your own GitHub account.

Assumes: Node.js and npmDocker basicsNestJS modules

Related posts

  • Migrating From Heroku To Railway

    Railway mediumAdept

    Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services. Railway reads the repo's Procfile and turns each named process (e.g. web, worker) into its own service, which takes the place of Heroku's dyno process model. It injects DATABASE_URL and REDIS_URL automatically, so any imported Heroku copies of those variables must be deleted or they will override Railway's. The guide also covers `railway run` for running commands like migrations against cloud variables, `railway up` for CLI deploys, and having apps listen on 0.0.0.0:$PORT so Railway can expose them.

  • Build a serverless API using Cloudflare Workers, Drizzle ORM, and Neon

    Neon mediumAdept

    A step-by-step setup for a serverless TypeScript API on Cloudflare Workers that uses Hono for routing, Drizzle ORM for schema definition and migrations, and Neon serverless Postgres for storage. It scaffolds a Worker with create-cloudflare, defines a products table in TypeScript, and uses drizzle-kit to generate SQL migrations. Migrations run through a postgres.js script capped at a single connection so they execute in order. The Worker queries Neon over HTTP via @neondatabase/serverless, is deployed with wrangler, and gets its DATABASE_URL from Cloudflare's Neon integration instead of manually configured secrets.

  • A database for every preview environment using Neon, GitHub Actions, and Vercel

    Neon mediumAdept

    Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases. Branches are isolated, are created in about a second regardless of database size, and bill only for unique data. A GitHub Actions pipeline creates a Neon branch per PR, runs Prisma migrations against it, deploys a Vercel preview wired to that branch, and comments the URLs on the PR. Merging applies migrations to the primary branch, deploys to production and deletes the preview branch.

  • Building a SaaS application on Railway

    Railway mediumAdept

    A step-by-step tutorial for building a job board SaaS MVP with Remix, PostgreSQL via Drizzle ORM, Clerk authentication and shadcn/ui, then deploying it to Railway. It covers the data model, routes for job seekers and hiring managers, resume uploads stored on disk, and a resource route for downloads. Deployment steps include a custom start command that runs migrations, attaching a persistent volume for resumes, provisioning Postgres with reference variables, and fronting the app with a Cloudflare custom domain for DDoS protection and caching.

  • One-Second Deploys? We Didn’t Believe It Either

    Railway easyNovice

    Railway Functions, now generally available, deploy single-file TypeScript code onto Railway's container compute in about a second, without a package.json, Git repo, IaC or container build. The pipeline parses source into an AST to infer dependencies and generates package.json on the fly, with versions pinnable directly in import specifiers. Dependencies are installed with `bun install`, which installs fastify in 500ms compared with over 6s for npm, pnpm and yarn without a lockfile. Bun then runs the TypeScript directly with no transpile or bundle step. Functions share Services' features such as volumes and variables.

The quest for software engineering knowledge.

Look:
Layout: