Building a SaaS application on Railway
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.
Related posts
- Scaling a SaaS application on Railway
Railway mediumAdeptA Remix and PostgreSQL job board on Railway is scaled up with a staging environment tied to a `stage` branch, automatic vertical scaling, and horizontal replicas. Replicas cannot be added while the service uses a persistent volume, so file uploads move to a self-hosted, S3-compatible MinIO bucket and resume downloads are served through pre-signed URLs. Costs are cut by caching job detail pages for an hour at Cloudflare using a Remix `Cache-Control` header plus a Cloudflare cache rule, sleeping the staging app when idle, and using private networking to avoid egress fees.
- Deploy Authorizer on Railway
Railway mediumAdeptAuthorizer, an open-source self-hosted alternative to Auth0, can be deployed on Railway with a one-click template that provisions PostgreSQL and Redis automatically and wires up DATABASE_URL and REDIS_URL. Deployment needs only ADMIN_SECRET and JWT_SECRET, plus OAuth client credentials if social logins are wanted. A React integration follows: install @authorizerdev/authorizer-react, wrap the app in AuthorizerProvider pointed at the Railway endpoint, and use the Authorizer component and useAuthorizer hook for login flows and user state.
- Deploy a Dart App on Railway, Part 1
Railway mediumAdeptA Flutter + Serverpod trivia app is deployed to Railway with a Railway-hosted PostgreSQL database, using the Railway CLI and a custom multi-stage Dockerfile that compiles the Dart server and bundles a Flutter web build into Serverpod's static webserver. Database credentials are wired in through Railway variable references, and migrations are applied in production mode. Because Railway exposes only one port per domain, a Caddy reverse proxy template routes traffic between Serverpod's API port (8080) and web port (8082). A curl request to the example hello endpoint confirms the deployment works.
- Next.js authentication using Clerk, Drizzle ORM, and Neon
Neon mediumAdept
Clerk can handle authentication for a Next.js 14 App Router app while Drizzle ORM and Neon's serverless HTTP driver store non-PII data keyed by the Clerk user ID. The walkthrough defines a Drizzle schema, generates and pushes migrations with Drizzle Kit, and protects routes with Clerk's authMiddleware and ClerkProvider/UserButton. It then implements Server Actions that use currentUser() to insert and delete a per-user row. PII stays in Clerk's compliant infrastructure, and only the user ID is referenced in Postgres.
- Building a NestJS App on Railway
Railway mediumAdeptA 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.