Developers October 19, 2020

How do you deal with all the "boilerplate" SaaS functionality?

Justin @Harrjm

I feel like I keep hitting the same wall. I can get the basic functionality of my web app finished in like 2 weeks (the actual selling point of my app). But then I get stuck for months fleshing out the basic boilerplate of any SaaS app, the authentication, email verification, forgot my password, subscriptions (upgrading, downgrading, cancelling, webhooks, etc.), support, transactional emails, etc.

How do you do it? Have you just done it once and keep reusing the same code? Are you using services to handle it all for you? Do you reroll it everytime you make a new product?

For me it'd be nice if there was a backend as a service that handled most of it for you but then it seems your too tightly coupled to that backend and can't introduce your own business logic. (I run on the MERN stack for the most part btw).

  1. 6

    As someone who has thought about this deeply (first by building several of my own SaaS projects, and then in creating my own SaaS boilerplate for Django in https://www.saaspegasus.com/) I'll provide my thoughts.

    You have a handful of options, all have pros and cons.

    1. Roll your own. This is the the most commonly chosen option, the de-facto choice if you don't act deliberately, and the one it sounds like you're doing. There are several benefits to rolling your own: you gain familiarity with the tech, you know your way around the codebase, and you can set things up exactly how you want. There are also substantial drawbacks: the first - as you've noted - is the time it takes to do. The second is that you may set things up in a non-standard / non-optimal way because you are doing it for the first itme.

    2. Microservices. There are SaaS options for most of these functions. Stripe checkout+hosted billing provides a reasonable UX around billing and subscriptions and is getting better all the time. Auth0 can handle user identity and authentication. The benefits of these are that you get well-supported off-the-shelf options that are likely to be reliable and architected well. The downsides are that you still have to manage integration with your own code, which can get a bit unwieldy with a lot of external service dependencies. Also, some of them cost money, which can add up.

    3. Use a boilerplate. Others in the thread have linked many of these so I won't bother listing them all out. The benefits of these are that you get something up and running fast, and have the flexibility of it being code in your framework of choice that you own. Also, the boilerplate developer is likely to have thought through these problems harder than you have so you get more functionality and likely a more thought-out starting point. The downside is that you're working in someone else's code, so you have to learn/adapt to how they have chosen to do things.

    I see value and tradeoffs in all of these options. For me, I started rolling my own and eventually did it enough times that I decided to make my own boilerplate for the framework I use (Python/Django). If I were starting a solo-project on a different tech stack that I'm not as familiar with I probably would use a boilerplate - partially for the speed, and also partially to see how an "expert" in that framework decided to set something up. If I didn't have a devops background I'd also look much more closely at microservices, since then you don't have to manage running a lot of the backing infrastructure on your own.

    Hope that helps get you thinking about how to proceed!

  2. 5

    Just build it once and use forever. Or start using somebody's else.

    That's why I created a SaaS boilerplate, https://www.saasforge.dev/
    It has now two versions: open-source https://github.com/saasforge/open-source-saas-boilerpate (>500 stars) and a commercial one with Stripe and admin dashboard.

    I use it all the time for my own and my clients' projects.

    I don't have any problems with rerolling it. It takes around 0,5 hours to roll out on AWS Elastic Beanstalk.

    All the updates are pulling using Git chaining (described here https://www.saasforge.dev/blog/how-to-customize-your-saas-and-still-get-all-updates)

  3. 4

    Ruby on Rails developer of 10+ years here.

    Authentication / email confirmation / forgot password:
    https://github.com/heartcombo/devise
    (it is the de facto standard in the Rails world)

    Subscriptions upgrades / downgrades / pro-rating etc:
    I just let Stripe billing portal handle all of this. My users log into Stripe via a session token I generate, they can manage all their card details / invoices / upgrades from there, and my Rails app just listens to webhooks from Stripe.

    Support - not sure what you mean by this one

    Transactional emails - this comes out of the box with Rails, you just add callbacks to transactions you want to notify users of, and then Rails fires an email using an SMTP server of your choice. I use Mailgun.

    Personally I don't see any of these things as an issue to get stuck on. But I only know the Rails ecosystem, can't speak for other languages / frameworks.

  4. 2

    After some research, I decided to use AWS Amplify (https://aws.amazon.com/amplify/) for my project, which does a pretty good job of setting up auth with Amazon Cognito. It handles all of the auth workflows pretty well out of the box, and you can customize them as needed.

    There's definitely a bit of a learning curve with it, especially if you haven't worked with other AWS services before, but I feel like I could set up the infrastructure for any future project extremely quickly.

    There are surely some shortcomings, as it seems relatively new, but I'm happy with it so far for the most part. Especially because it handles setting up infrastructure, auth, and deployments pretty well.

  5. 2

    In case anyone is reading from Rails-land, I've had a great experience with https://jumpstartrails.com/.

    In my current project it saved me hours of boilerplate and let me completely bypass the normally tedious tweaking to get things like Tailwind, Stimulus, and Webpacker configured and working properly together. Well worth the investment, IMO.

    1. 1

      Inspired by bullettrain + jumpstart I've created saas.corsego.com. what do you think?

  6. 2

    What's your budget to buy the boilerplate if you don't want to build it? Every month I see new options offering SaaS boilerplate options. A few of them are on this website. Divjoy has commented. There's saaspegasus (@czue) too: https://www.saaspegasus.com/. also, there was a startup in the news last week that raised some VC money to offer this as a service.

    What backend language and framework do you want to use? Do a search for django SaaS boilerplate or django SaaS skeleton. Or use whatever tech you want included.

    This is a one-time problem for each company, so the solutions are very visible casually. Google for them and you'll find them. They won't be perfect but they will save you a lot of time.

    1. 1

      @hostedmetrics, do you have a link to the company that raised money to offer this as a service?

            1. 1

              @hostedmetrics, yeah, I'd put Laravel Spark on that list too: https://spark.laravel.com/.

              Part of the beauty (or trouble?) with so many options in the Node world is that it can support lots of different boilerplates, paid or open source.

            2. 1

              This is awesome! They all look cool but Mernkit looks perfect, my ideal stack and it's the cheapest, plus it offers a monthly plan. I'm definitely going to give this a shot at some point, thanks!

  7. 2

    The subscription model I've set up for apps is usually a bit difference so that is usually more customized. But with Ruby on Rails most of the above are 80% complete by just adding the right gems. I'm still partying in the RoR land because it's rapid and allows me to build what I want to build quickly and not waste time with things that are ridiculously common and have been built a million times before.

    1. 1

      Yeah I've heard RoR and Laravel both do great jobs of having stuff like that prepackaged. In Node land it seems like theres almost too many boilerplate ways of doing it with no real 'right way', and they're already outdated by the time you find them.

      1. 2

        It's what I love most about RoR. Having programmed for so long and having so many options in any particular language the convention over configuration approach makes me smile all the time. There is usually "the way" in Rails and most people follow that. You could probably jump into anyone's random RoR project and be productive pretty quick because they would be using and doing things the same way you did. Once you know it, it's just so rapid. No way I could crank out a new idea or an entire MVP in a long weekend with anything else - and that's usually what I do for my side projects. Inspiration strikes and I need to just knock it out and not be messing around with doing things that have been done a million times before.

      2. 1

        @Harrjm, you’re right that this is the case in Node—which can be both amazing and frustrating. There’s almost always a package for anything you need to do, and usually more than one. That’s amazing because there’s such a rich ecosystem; however, it can mean you spend more time integrating that ecosystem than you would in RoR or Laravel. You can pick an opinionated framework inside of the JS ecosystem to help limit things, but I haven’t seen those be as elegantly put together as RoR or Laravel.

  8. 2

    My frustrations around this is exactly why I built divjoy.com. Pick your stack and then generate a codebase with all the common UI and boilerplate you need. Don't yet support Mongo, but it's on the todo list :)

    1. 2

      I’ve been considering divjoy for a new product idea. Have you considered integrating tailwind as the CSS provider? Or how easy do you think it would be to migrate from what you provide to Tailwind?

      1. 2

        I'll be adding Tailwind, although it's a few months out (working on Material UI now). I've had a good number of customers migrate to Tailwind. It definitely takes some work, but you're likely still saving time considering Divjoy gives you a lot of JS logic around auth, payments, component state, serverless functions, etc.

        Here's a discount if you want to grab it: https://divjoy.com/?promo=indiehackers

    2. 2

      Yeah I've seen divjoy on here a few times and it looks great! My only hangup on it so far has been the firebase backend, I've gotten stuck a few times trying to manage their permissions and building out cloud functions to handle the logic, it just seems a little too restricting for me. But I'll definitely be checking it out once Mongo is supported!

      1. 1

        Yeah totally understand that. The Firebase rules system can be a bit cumbersome, depending on the complexity of your app. Looking forward to getting Mongo in with a more classic REST API setup.

  9. 1

    I use Django to develop my projects and it is awesome. All the authentication etc. is built in and its so quick to develop new projects.

    Transactional email like payment receipts and inquiries I just let them be sent by whatever service I'm using, like stripe or paypal.

  10. 1

    I'm starting a new venture saasitive.com where I will show how to build SaaS products from scratch with Django and React. The tutorials will show how to build step by step your own boilerplate, which you can customize. I dont like the solutions where you buy ready boilerplate because it comes with a lot of things that developer can find hard to understand and many things that can be unneeded.

  11. 1

    This is a really good question. I plan on doing it once and reusing the same code, but I do wish there was a solution to this problem.

Recommended Posts