The Open Source Next.js SaaS boilerplate for Enterprise SaaS app development.
Please star β the repo if you want us to continue developing and improving the SaaS Starter Kit! π
Video - BoxyHQ's SaaS Starter Kit: Your Ultimate Enterprise-Compliant Boilerplate
Blog - Enterprise-ready Saas Starter Kit
Next.js-based SaaS starter kit saves you months of development by starting you off with all the features that are the same in every product, so you can focus on what makes your app unique.
- Next.js
This is a React framework that provides features such as server-side rendering and static site generation. It's used for building the user interface of your application. The main configuration for Next.js can be found in
next.config.js. - Tailwind CSS
This is a utility-first CSS framework for rapidly building custom user interfaces. It's used for styling the application. The configuration for Tailwind CSS can be found in
postcss.config.js. - Postgres This is a powerful, open source object-relational database system. It's used for storing application data. The connection to Postgres is likely managed through Prisma.
- React This is a JavaScript library for building user interfaces. It's used for creating the interactive elements of your application. The React components are located in the components directory.
- Prisma This is an open-source database toolkit. It's used for object-relational mapping, which simplifies the process of writing database queries. Prisma configuration and schema can be found in the prisma directory.
- TypeScript
This is a typed superset of JavaScript that compiles to plain JavaScript. It's used to make the code more robust and maintainable. TypeScript definitions and configurations can be found in files like
next-env.d.tsandi18next.d.ts. - SAML Jackson (Provides SAML SSO, Directory Sync) This is a service for handling SAML SSO (Single Sign-On). It's used to allow users to sign in with a single ID and password to any of several related systems i.e (using a single set of credentials). The implementation of SAML Jackson is primarily located within the files associated with authentication.
- Svix (Provides Webhook Orchestration) This is a service for handling webhooks. It's used to emit events on user/team CRUD operations, which can then be caught and handled by other parts of the application or external services. The integration of Svix is distributed throughout the codebase, primarily in areas where Create, Read, Update, and Delete (CRUD) operations are executed.
- Retraced (Provides Audit Logs Service) This is a service for audit logging and data visibility. It helps track user activities within the application i.e (who did what and when in the application). The usage of Retraced would be dispersed throughout the codebase, likely in the files where important actions are performed.
- Stripe (Provides Payments) This is a service for handling payments. It's used to process payments for the application. The integration of Stripe is likely found in the files associated with billing and subscriptions.
- Playwright (Provides E2E tests) This is a Node.js library for automating browsers. It's used to run end-to-end tests on the application. The Playwright configuration and tests can be found in the tests directory.
- Docker (Provides Docker Compose) This is a platform for developing, shipping, and running applications. It's used to containerize the application and its dependencies. The Docker configuration can be found in the Dockerfile and docker-compose.yml.
- Clerk (Provides Authentication) This is a complete authentication solution for modern applications. It's used to handle user authentication, authorization, and user management. The Clerk configuration can be found in the environment variables and middleware.ts file.
Please follow these simple steps to get a local copy up and running.
- Node.js (Version: >=18.x)
- PostgreSQL
- NPM
- Docker compose
- Fork the repository
- Clone the repository by using this command:
git clone https://github.com/<your_github_username>/saas-starter-kit.gitcd saas-starter-kitnpm installDuplicate .env.example to .env.
cp .env.example .envTo make the process of installing dependencies easier, we offer a docker-compose.yml with a Postgres container.
docker-compose up -dnpx prisma db pushIn a development environment:
npm run devPrisma Studio is a visual editor for the data in your database.
npx prisma studioWe are using Playwright to execute E2E tests. Add all tests inside the /tests folder.
Update playwright.config.ts to change the playwright configuration.
npm run playwright:updatenpm run test:e2eNote: HTML test report is generated inside the report folder. Currently supported browsers for test execution chromium and firefox
To get started you only need to configure the database by following the steps above. For more advanced features, you can configure the following:
- Create a Clerk account at clerk.com
- Create a new application
- Configure authentication methods:
- Email/Password
- OAuth providers (GitHub, Google)
- Magic Links
- Enable Organizations for multi-tenancy
- Configure webhook endpoint:
https://your-domain.com/api/webhooks/clerk - Set the following environment variables:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
CLERK_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/auth/login
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/auth/join
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard- Create an account on Svix
- The authenticaton token and add
SVIX_API_KEYto the.envfile.
- Create an account on Stripe
- Add the Stripe API secret key to the
.envfile asSTRIPE_SECRET_KEY. - Create a webhook in the Stripe dashboard. The URL is your app hostname plus
/api/webhooks/stripe. If you want to set this up locally you will need to use the Stripe CLI forwarder. - Once created, add the signing secret to the
.envfile asSTRIPE_WEBHOOK_SECRET.
- Create an account on Google reCAPTCHA. This will create a Google Cloud account if you don't have one.
- From the Key Details in the Google Cloud Console, add the reCAPTCHA ID to the
.envfile asRECAPTCHA_SITE_KEY. - Click Key Details > Integration then click Use legacy key to get the secret key and add it to the
.envfile asRECAPTCHA_SECRET_KEY.
- Create an account on Sentry, skip the onboarding and create a new Next.js project.
- At the bottom of the page, get the DSN and add it to the
.envfile asSENTRY_DSN. The other variables are optional.
- ποΈ Multi-tenancy: Each user can be part of multiple teams
- π Authentication: Secure authentication with Clerk (Email/Password, OAuth, Magic Links, SAML SSO)
- π₯ Team Management: Create teams, invite members, manage roles
- π’ Enterprise Features: SAML SSO, Directory Sync (SCIM), Audit Logs, Webhooks
- π³ Billing: Stripe integration for subscriptions and payments
- π API Support: REST API with API key authentication
- π Internationalization: Multi-language support
- π¨ UI Components: Beautiful UI with Tailwind CSS and DaisyUI
- π± Responsive: Mobile-friendly design
- π Security: CSRF protection, rate limiting, security headers
- π§ Email Notifications: Transactional emails with SMTP support
- π Two-Factor Authentication: Built-in 2FA support via Clerk
- π― Feature Flags: Control feature access per team
- π Analytics: Mixpanel integration for product analytics
- π Logging: Structured logging with correlation IDs
- π§ͺ Testing: Unit tests with Jest, E2E tests with Playwright
- π³ Docker Support: Ready for containerized deployments
- π¦ Health Checks: Built-in health monitoring endpoints
- Billing & subscriptions
- Unit and integration tests
Thanks for taking the time to contribute! Contributions make the open-source community a fantastic place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Please try to create bug reports that are:
- Reproducible. Include steps to reproduce the problem.
- Specific. Include as much detail as possible: which version, what environment, etc.
- Unique. Do not duplicate existing opened issues.
- Scoped to a Single Bug. One bug per report.
- Discord (For live discussion with the Open-Source Community and BoxyHQ team)
- Twitter / LinkedIn (Follow us)
- Youtube (Watch community events and tutorials)
- GitHub Issues (Contributions, report issues, and product ideas)
Made with contrib.rocks.
- Next.js - React framework for production
- Clerk - Authentication and user management
- Tailwind CSS - Utility-first CSS framework
- Prisma - Next-generation ORM
- TypeScript - JavaScript with types
- PostgreSQL - Open source relational database
- Stripe - Payment processing
- React Email - Email templates with React
- Playwright - End-to-end testing
