B2B SaaS: Full Lifecycle Automation via API
deslunes
HOBBYOP

4 months ago

Hi guys. We're considering Railway for a multi-tenant B2B SaaS.

Our model is 1 Project per tenant (containing a Bun.js service + Postgres service) for strong isolation. We need to automate the entire tenant lifecycle via API (GraphQL or REST).

Are the following API-driven actions fully supported?

  • Create a new Project (for the tenant).

  • Deploy Services into it from a GitHub template (to push updates to all tenants easily).

  • Inject tenant-specific ENV vars.

  • Auto-assign a custom subdomain (tenant.ourdomain.com) to the Bun.js service.

  • Suspend/Pause the Bunjs service within a Project of a specific tenant (to stop costs but retain data) and reactivate them later if he doesn't pay the bills.

This full API automation is a critical requirement for us, since we have a "master platform" where all our tenants can create their tenant, pay for it, so we orchestrate the tenant creation, deletion, pausing from there. Thanks!

$10 Bounty

7 Replies

deslunes
HOBBYOP

4 months ago

feel free to ping me if you answer me 🙂


https://docs.railway.com/guides/public-api

It doesn't seem like you're able to create a project via API. However, you're able to create services from the API (but only from Github repos or Docker images it seems). You can set env variables through the API though.

Another thing you can check out is deploying via Github Actions (https://blog.railway.com/p/github-actions).


deslunes
HOBBYOP

4 months ago

From my understanding of the Railway platform, a service is either a database or a deployment (of a github repo or a dockerfile). By creating services of the same github repo for each tenants, I would be able to provide an isolated server, but they would run on the same neighbor, right ?

It means that tenants could suffer from noisy neighbors, which doesn't feel nice at all. We might have hundreds of tenants later, so I'm not sure it's a good idea to proceed that way.

If we subscribe to railway with the enterprise plan, would it be possible to access features like creating projects via API ?


4 months ago

You can create projects via the public API on any plan, but your own isolated VM would be an additional cost on top of enterprise.


deslunes
HOBBYOP

4 months ago

You can create projects via the public API on any plan
I can't see it on the docs :/ Do you have a link please ?

but your own isolated VM would be an additional cost on top of enterprise
I don't really get this part of the message do you mean :

  1. It will be more expensive to run tenants on isolated VMs rather than as services of the same project
    or

  2. The enterprise plan is costly

Please specify what you mean, but I'm glad to hear it's possible with Railway, as I love the concept of the whole platform 😄


4 months ago

> I can't see it on the docs :/ Do you have a link please ?
You can check out our graphql playground here -

> I don't really get this part of the message do you mean
You can either run your workloads on shared hosts with all other Railway users, or you can buy your own dedicated machine(s) from us to run all your workloads on, to isolate CPU and memory from other Railway users.


deslunes
HOBBYOP

4 months ago

thanks a lot !


Loading...