Building a SaaS in Railway’s Way



This content originally appeared on DEV Community and was authored by r4k3labs

Discovering Railway.com

I have been working as a contractual developer for quite a bit now. And Every time I have to recommend a small business owner a deployment platform that is easy to handle for a small team and might not accidentally bankrupt them in the process, I feel bad.

Because I have seen, the big guns like AWS or Azure are surely powerful with endless options for scaling and security. But for small businesses the pricing is a nightmare, unpredictable bills that skyrocket with usage, plus the setup is a maze. They would have to spend hours just provisioning resources, managing infra . Small businesses deserve better than this enterprise-level price tags.

Then there’s Vercel, which I’ve used for quick frontend deploys. It’s slick for static sites and Next.js apps, with edge functions that make things zippy. But small businesses needs more than just hosting. They wants persistent databases with backup , constant running server for some cron jobs etc. Vercel shines in specific cases, but it falls short on full-stack needs without bolting on extras, which adds complexity and cost.

This dilemma used to hit me for every project. Do I recommend something affordable but limited, risking client frustration? Or go premium and watch their eyes glaze over at the invoice? It was exhausting , then I came to know about railway.com

Railway.com: One Platform to rule them all

Railway is a deployment platform designed to streamline the software development life-cycle, starting with instant deployments and effortless scale, extending to CI/CD integrations and built-in observability.

What does it mean basically , you can just point railway to the source of whatever you can think of and railway can handle the rest.

To get things running smoothly without much issues , when you are starting a project, railway provide hassle free defaults. Even if it has some great options for fine tuning perf optimisations .

Every project, every service comes with their own config management, environment management and Observability.

It feels like a breath of fresh air for certain use cases.

My experience of building a SAAS(or something like it ) with it

Although I have been working indirectly with railway for a quite some time, I have not yet used it for my own personal projects.

Two,Three days back while scrolling twitter I came across a post about a Hackathon happening at railway and since I was free this weekend , I decided that finally it’s time for an app I have been thinking for a quite bit time to build for one of my friend.

He has been complaining about how hard it is manage his photography studio with existing solutions since non of them caters to his specific needs.

Tech stack

I decided to use what I know, Nothing fancy for this first version.
Next.Js for backend and frontend, Postgres for database, Drizzle to manage the query and relations and Better-auth for authentication

Although Initially I started with turbo repo, it felt too much for the initial version, Since it’s been a minute for me to work with turbo repo, I was wasting a lot of time with configs and setting up caching server etc instead of working on features. so decided to let go of it completely and started with simple create next app.

Features

  • Owners can create organisations, invite members and control their access on different types of resources. Thanks to better-auth providing all these out of the box

  • Owners and admins can create bookings, shoots, deliverables etc . They can assign crews to different tasks , review their work

  • They can view details of the bookings, keep track of payments and update the status of various resources as well

  • They can manage expense and handle clients as well

Surely it does not have all the functionalities that we can expect from a studio management solutions. But I am proud of what I could achieve with in these two, three days . (Thanks to T3 chat and Perplexity)

Experience with deploying the app

Railway does things little bit differently from other platform providers, Like converting everything to an OCI compliant image, does not matter whatever you provide.

I have had some issues with pnpm workspaces in the beginning, but going thorough documentation I was able to solve them quickly.

Except this I had some issues with configuring the template as well, They took a lot of time otherwise I would not have to write this blog in a hurry just before 10 minutes from the deadline of submission.

If You are interested to deploy a standalone app with better-auth and drizzle you could use my template as well.

Deploy on Railway

If you are interested to check out my submission for hackathon. You can check out here StudioAPP


This content originally appeared on DEV Community and was authored by r4k3labs