Web SaaS Starter Kit - Node.js, Express
Boilerplate for a web app with common features that every SaaS(Software as a Service) needs
Every time, I wanted to build a new web app, I used to code everything from scratch. Login, signup, session management, email notifications, and whatnot. Eventually, when I had found the right tools and code for everything, I kept that as a starter template for myself so I wouldn't need to solve the challenges that I had already solved.
Am I the only person who needs these features for a new project? Or does everyone needs the same features in their web-based SaaS tool? Why not open-source this and let everyone bootstrap their projects with this template!
I hope, this saves some time and helps you invest your time and energy in making system design and programming decisions that are unique to your SaaS web app. Start a project a little ahead of the starting line, where some common features are already implemented and well tested.
Features
- Signup and signin
- Session management
- Email notifications
- Reset password
- Feature flagging
- Single file to configure features(e.g. API keys, settings)
Made to last long
For most of these features, I have used other stable and well-maintained open-source projects. So you don't need to rely on me to keep this starter kit up-to-date(well, except updating once in a while, which I can certainly find time for).
Get started
- Clone this repo
- npm install
- Update the config for development (
config/development.env
) - For email templates, we use MJML. To update them, update the
views/email-templates/**/html.mjml
file and export it tohtml.ejs
in the same folder. For which you can either use editor plugins such as vscode-mjml or mjml javascript library - Make your changes to the code
npm start
Configuration
- Update them at config/development.js or config/production.js
- SITE_DOMAIN_URL
- SITE_TITLE
- REPO_URL
- SUPERTOKENS_CORE_URI
- SUPERTOKENS_CORE_API_KEY
Folder structure
app.js
at the root is the main file that spawns express serverviews
contains all the frontend html code. We use ejs here as templating langugage.views/email-templates
contains all the email templates written inmjml
and then exported toejs
services
contains all code that can be separated as an independent service. Controller and other services use thes services.public
contains all the frontend side assets including styles and javascript coderoutes
contains all the business logic for different routesconfig
contains the configurations. Change them for your usage.
Checklist for production deployment
- Update the config for production (
config/production.env
) - Make sure to run the server with NODE_ENV=production (e.g.
node app.js --prod
)
Made with awesome open-source projects