2 min read
Moving paschi.dev from Vercel to Railway
App, database, file storage and a cron job, all moved to one platform in two days. What changed on the way, and what I'd do the same way again.
This site used to run on Vercel, with its database on Turso and images on Cloudflare R2. After moving REPPPS to Railway and liking it, I moved this one too. Now the app, the database, the file storage and a scheduled job live on one platform, defined in one file.
The setup in one file
Railway lets you describe the whole project as code. Mine fits on one screen:
- web: the Next.js app, built from a Dockerfile, with database migrations as a pre-deploy step and a health check.
- Postgres, with a volume and usage alerts.
- A private bucket for project images.
- cleanup: a cron service that runs once a day.
Everything runs in the EU (Amsterdam), because contact form messages are personal data. Pushes to main deploy automatically, but only after the CI checks on GitHub have passed.
What changed on the way
libSQL became Postgres. Turso was fine, but Postgres is what I use everywhere else, and Railway runs it next to the app on a private network. With Drizzle, the switch was mostly the schema and the driver. Migrations are generated and committed, never pushed straight to the database.
Next.js runs as a standalone server. output: "standalone" bundles exactly what the server needs, and a three-stage Dockerfile on node:24-alpine ships it. The image runs as the unprivileged node user.
Images come through the app. The bucket is private, so a small /media route reads from it and serves files with Cache-Control: public, max-age=31536000, immutable. Uploaded files get unique names, so "cache forever" is safe.
The cron job lost its endpoint. On Vercel, the daily cleanup was an HTTP route that a cron called, protected by a secret. On Railway it's a separate service that runs a script directly against the database and exits. Nothing to protect, because there's nothing exposed.
Rate limiting needed a new header. Behind Railway's edge, the client IP comes from X-Real-IP. More on that in a separate note.
What I'd do again
- Define the infrastructure in the repo. Reviewing a diff beats clicking through a dashboard.
- Gate deploys on CI. A red test should never reach production.
- Replace public cron endpoints with jobs that never listen on a port.
Takeaways
- One platform, one config file, one region: less to keep in your head.
- Private storage plus an immutable cache header is simple and fast.
- Scheduled jobs don't need HTTP endpoints.