21
25 Comments

I am building my perfect SaaS boilerplate using Next.js, Firebase Auth, Express.js and TypeORM - and it's Open Source

Building the perfect SaaS boilerplate

Hey all 👋🏼,

last week I asked you about the perfect boilerplate to bootstrap a SaaS application without getting much traction.

I guess most of the stuff out there is locked behind a paywall or doesn't fit my specific needs 🥲.

That's why I've decided to start a series on Medium on how I am coming up with my own boilerplate using Next.js, Firebase Auth, Express.js and PostgreSQL and the TypeORM ORM.

You can find the final code for part 1 of the journey (client side) on this branch of the repo. If you look more closely, I actually took the liberty of going ahead and almost finished the project, but it needs further polishing and documentation.

I will write up the second (and possibly third) episodes in the coming weeks - stay tuned!

Care to say thanks? Follow me on twitter 😁.

P.S.: inputs and recommendations on how to improve the project are more than welcome.

posted to Icon for group Developers
Developers
on February 8, 2021
  1. 4

    From my experience of building https://usegravity.app - there is a market for open-source boilerplates, with a few buts:

    1. it's mostly hobbyists that use them; businesses pay for these boilerplates because they want peace of mind when their entire business is hinged on a third-party foundation, this is related to point #2 below:

    2. maintaining a product like this is a huge amount of work, and requires customer service/support, which is unsustainable with a free or cheap business model

    1. 1

      Hey @kylegawley 👋🏼. Thank you for sharing your perspective. From the looks of it—your (awesome) product is much more solid and feature rich than what I am building at the moment.

      My target audience are fellow indie makers 🚂.

      I see my boilerplate as something to get started real quick on MVP development. Sure enough, I plan to do maintenance and bug fixing (mostly because I myself rely on it for my projects), but I din't see myself getting into the business of addressing client-specific needs (especially for businesses).

    2. 1

      This comment was deleted 5 years ago.

  2. 2

    Hi Francesco (wow! another Italian Indie Hacker 🤙)

    Honestly, I don't find the concept of "boilerplate" attractive and useful. They need constant updates and, in most cases, they are too (and unnecessarily) opinionated.

    In my opinion, there are too many dependencies and moving parts in your boilerplate that could create maintenance problems in the future and perhaps the stack you have chosen is not an ideal starting point to quickly build an MVP for a SaaS product.

    I don't even like parts of your stack. I prefer Prisma over TypeORM (which IMHO forces you to write non-idiomatic JS code) and Fastify over Express (which lacks modularity and TypeScript support).

    To me can be more useful to have a collection of libraries/modules (aka toolkit) with your code to include in my own projects instead of an entire boilerplate.

  3. 2

    You should build a "Pro" version of this for money. It will probably be the only sustainable way to work on it In the long term. This also means, it will be better in the long run for those who want to only use the OSS (free) version.

    1. 2

      Hey @rob_race! Thank you for the recommendation. My goal (to which I believe I am 90% of the way to) is to ship something usable with < 30 mins of required set up time (provided you have some knowledge of the technologies you are working with).

      A couple of questions, if you care to elaborate:

      • What would you recommend to include in the "Pro" version? Payments? Email / password sign-ups (i.e., custom login flows?)? DEM?
      • How much would you price it?
      • How would you sell it? On what platform?
      1. 1

        30 minutes is... kind of a while?

        I confess, I'm biased, I prioritized project start-up time with Nodewood, a paid JavaScript boilerplate (so not exactly your target audience, but still, close enough to comment), and it's like 4 minutes, including download and installation.

        Now, I have built a CLI tool to make a lot of this stuff easier, but you could definitely get it down lower with like, setting up your repo as a Template repo and including a docker-compose file. Template, clone, run docker command, and a user could theoretically be set up and working in 10m, easy.

        (Yeah, I know I'm working against myself here, but honestly, I feel this space is big enough to support a fair amount of boilerplates, and as @kylegawley mentioned up-thread, I think trying to do this for free, long-term is pretty unsustainable. If you do go pro, I definitely wish you the best of luck! And heck, I'm happy to wish you luck in the meantime, as well.)

        1. 1

          Ahaha @DanHulton no worries - I am not looking to compete with you on this one 😅. Thank you very much for the insights and the openness. I do appreciate the work you’re doing with Nodewood and I look forward to having some spare cash to try it out for myself.

          I do have some CLI magic on my local env - I just don’t want to over complicate the boilerplate (from a technical standpoint, not from a UX perspective).

          Anyway, I think 30 mins are fair enough if you consider the creation of the Firebase project and the familiarisation with the initial code base. Definitely 1/10 of the time it would take to write it up from scratch 😖

      2. 1
        • Yeah! Those! Any specific feature that you think would take you more than....let's say 4 hours to set up, would probably be a good candidate. (i.e. User Team invites, payments, notifications system, any CLI tools that make it easier to build quickly)
        • Really depends on when you decide to offer the pro and how much difference there is between OSS and Pro. You can probably easily start $99+ (and this can be for either lifetime or yearly access) and go up as you keep adding features. The sell here is that you are saving a dev hours of time, that they normally charge $25/hr, $50/hr, etc.
        • Most times I see this sort of tool sold with any payment processor and then the seller grants access to a private repo somewhere (that way git can be used to push updates).
        1. 1

          Great! Thank you for the insights.

          As a matter of facts you are tempting me to give it a go 😅. I'll add it to the list of things to try in 2021.

          For now I'll be happy to share the OSS version with the community and maybe have a couple of good souls who are willing to offer me a coffee.

  4. 1

    Why not just use NextJS's own backend system instead of Express?

  5. 1

    Great work! I think it is the perfect moment to monetize bootstrap with the help of some marketing: https://bedrock.mxstbr.com/

  6. 1

    That is a great idea Francesco! (great to see another Italian IndieHacker btw 💪)
    We kind of did the same thing, but not open source it.
    During the years working at the company I co-founded with @SeaOfDreams we've built different products for internal use.
    At some point we decided that we wanted to try to build our first Saas (that we actually never shipped due to a series of things) so i collected different "modules" i've built for other projects and glued them together to build a Saas boilerplate for future projects (it is like a blank canvas with basic Saas functionalities e.g. auth, invoicing, multi-language support, admin functionalities etc.)

    This allowed us to build our latest product Splitstack in about a month of work (Planning to Ship it next week 😄)

    1. 1

      Thanks for sharing! Good luck on your launch ⭐️

  7. 1

    Being on a similar path at the moment, I'm a bit curious about the rationale behind your technical choices. Why Express with Next? Did you hit a wall that forced you to switch the engine or is it just a matter of taste?

    Did you take a look at NextAuth? It seems like a great option to handle authentication, and it supports various providers.

    1. 2

      Ciao @dSebastien.

      First, let me say that I love to work JavaScript (TypeScript) full-stack. Indeed, it has some drawbacks on the BE, but I am happy with the overall experience and so

      I have not looked into NextAuth—it looks promising though!

      1. 1

        I feel like we could share some notes as we go ;-)
        Personally, I've kept the default back-end engine of Next, in the hope to be able to deploy everything through Vercel or Serverless and gain time. Express doesn't necessarily prevents that, but I don't see the point of switching (so far).

        Instead of TypeORM, I've chosen Prisma, which I'm really glad about so far. The tooling is top-notch and it's quite straightforward to get started, generate TS code based on the schema, seed the database, handle DB migrations, etc.

  8. 1

    Thanks Francesco for both the repo and the articles! I'll follow all of them as well as your Twitter :)

    1. 1

      Glad to hear you're coming along for the ride 🔥

  9. 1

    Good god I wish I knew about TypeOrm before committing to Sequelize in my new project. This looks so much better ;_;

    1. 1

      @Glench I have been there. On one of the projects I worked on last year (I will not plug it in here since it's mostly decommissioned) I hit my head against the wall while trying to use TypeScript in Sequelize. It's just not there yet (it's not as clean as I'd like it to be).

      If you can take some time to swap TypeORM in for Sequelize out, do so. You'll not regret it.

  10. 1

    Hey Francesco,

    I think this is a great idea and I would definitely use this if I was learning how to build an app, but not in prod.

    Some gripes I have with this concept:

    1. i don't see any reason to use NextJs to build a saas app (unless for the marketing site / landing page)
    2. with more backends moving to the cloud (ie AWS), the PostgreSQL and Express portion of this boilerplate will have diminishing returns.
    1. 1

      Here is my 2 cents experience I had with building a SaaS app:

      1. Just launched my SaaS app with Next JS and all frontend are built in React with Next JS. Not only for the marketing site / landing page but also for the dashboard.

      I built everything in Next JS static mode: cheap, fast, highly scalable and secure. So I can host anywhere, no need to have a dynamic server for the frontend.

      1. Definitively with AWS lambda and API gateway, it can be replaced by Express. For most use case, PostgreSQL can be replaced by DynamoDB. Especially, as a solo developer, it'll make your life easier and you have less things to worry: no need to manage server, no docker or no Kubernetes. One good thing, your cost will based on your traffic.

      Here is my learning after building Nextless NextJS SaaS Boilerplate.

    2. 1

      Hey @ryanmargono. Thank you for the constructive criticism. Both are valid points

      1. Next.js is an opinionated framework and - while I agree it’s best suited for SEO friendly scenarios - it can also be used in other contexts quite easily.
      2. Well you could package the boilerplate in a Docker container and run it on the cloud either as a whole app or by breaking down the individual microservices (perhaps even connecting to a managed database). If you are talking serverless functions I guess you’re right. But I don’t see that blowing express out of the water any time soon
  11. 1

    Great stuff - good luck and keep up the good work!

    1. 1

      Thank you Mike 🙏🏼

Trending on Indie Hackers
I spent $0 on marketing and got 1,200 website visitors - Here's my exact playbook User Avatar 58 comments Veo 3.1 vs Sora 2: AI Video Generation in 2025 🎬🤖 User Avatar 28 comments Codenhack Beta — Full Access + Referral User Avatar 21 comments I built eSIMKitStore — helping travelers stay online with instant QR-based eSIMs 🌍 User Avatar 20 comments 🚀 Get Your Brand Featured on FaceSeek User Avatar 18 comments Day 6 - Slow days as a solo founder User Avatar 16 comments