saas-starter-kit
🔥 Enterprise SaaS Starter Kit - Kickstart your enterprise app development with the Next.js SaaS boilerplate 🚀
Top Related Projects
Clone, deploy, and fully customize a SaaS subscription application with Next.js.
The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
💼 An enterprise-grade Next.js boilerplate for high-performance, maintainable apps. Packed with features like Tailwind CSS, TypeScript, ESLint, Prettier, testing tools, and more to accelerate your development.
Quick Overview
BoxyHQ's SaaS Starter Kit is an open-source project that provides a foundation for building modern SaaS applications. It combines Next.js, Tailwind CSS, and TypeScript to offer a robust starting point for developers, including features like authentication, billing, and team management out of the box.
Pros
- Comprehensive starter kit with essential SaaS features pre-implemented
- Built with modern, popular technologies (Next.js, Tailwind CSS, TypeScript)
- Includes enterprise-ready features like SAML SSO and audit logs
- Active community and regular updates
Cons
- May have a steeper learning curve for developers unfamiliar with the tech stack
- Opinionated architecture might not fit all project requirements
- Some features may be overkill for simpler SaaS applications
- Requires customization to fit specific business needs
Code Examples
Here are a few code examples from the SaaS Starter Kit:
- API route for user creation:
import { createUser } from '@/lib/api/user';
import { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req;
switch (method) {
case 'POST':
return await createUser(req, res);
default:
res.setHeader('Allow', ['POST']);
res.status(405).end(`Method ${method} Not Allowed`);
}
}
- React component for displaying team members:
import { TeamMember } from '@/components/team';
import { useTeam } from '@/hooks/useTeam';
export default function TeamMembers() {
const { members, isLoading } = useTeam();
if (isLoading) {
return <div>Loading...</div>;
}
return (
<div>
{members.map((member) => (
<TeamMember key={member.id} member={member} />
))}
</div>
);
}
- Database schema for the User model:
import { Prisma } from '@prisma/client';
const userSchema = Prisma.validator<Prisma.UserArgs>()({
select: {
id: true,
name: true,
email: true,
emailVerified: true,
image: true,
createdAt: true,
updatedAt: true,
},
});
export type User = Prisma.UserGetPayload<typeof userSchema>;
Getting Started
To get started with the SaaS Starter Kit:
-
Clone the repository:
git clone https://github.com/boxyhq/saas-starter-kit.git cd saas-starter-kit
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env.local
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser to see the application running.
Competitor Comparisons
Clone, deploy, and fully customize a SaaS subscription application with Next.js.
Pros of nextjs-subscription-payments
- Simpler setup focused specifically on subscription payments
- Integrates directly with Stripe for payment processing
- Includes example products and pricing tiers out-of-the-box
Cons of nextjs-subscription-payments
- Less comprehensive feature set compared to saas-starter-kit
- Lacks built-in authentication and user management systems
- No support for team/organization structures
Code Comparison
saas-starter-kit (API route for creating a team):
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req });
if (!session) return res.status(401).json({ message: 'Unauthorized' });
const { name } = req.body;
const team = await createTeam(session.user.id, name);
return res.status(200).json(team);
}
nextjs-subscription-payments (API route for creating a checkout session):
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === 'POST') {
const { price, quantity = 1, metadata = {} } = req.body;
try {
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
billing_address_collection: 'required',
line_items: [{ price, quantity }],
mode: 'subscription',
allow_promotion_codes: true,
subscription_data: { metadata },
success_url: `${getURL()}/account`,
cancel_url: `${getURL()}/`
});
return res.status(200).json({ sessionId: session.id });
} catch (err) {
return res.status(500).json({ error: { statusCode: 500, message: err.message } });
}
} else {
res.setHeader('Allow', 'POST');
res.status(405).end('Method Not Allowed');
}
}
The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
Pros of Supabase
- More comprehensive backend solution with built-in authentication, storage, and real-time subscriptions
- Larger community and ecosystem, providing better support and resources
- Offers a hosted solution, reducing infrastructure management overhead
Cons of Supabase
- Less flexible for custom backend implementations compared to SaaS Starter Kit
- Steeper learning curve due to its broader feature set
- Potential vendor lock-in with the hosted solution
Code Comparison
SaaS Starter Kit (Next.js API route):
export default async function handler(req, res) {
const { method } = req;
switch (method) {
case 'GET':
// Handle GET request
case 'POST':
// Handle POST request
}
}
Supabase (Client-side query):
const { data, error } = await supabase
.from('table_name')
.select('column1, column2')
.eq('column3', 'value')
.order('column1', { ascending: true });
Both repositories offer starter kits for building SaaS applications, but they differ in their approach. SaaS Starter Kit provides a more customizable foundation for building full-stack applications with Next.js, while Supabase offers a comprehensive backend-as-a-service solution with additional features like real-time subscriptions and storage. The choice between them depends on the specific needs of the project and the desired level of control over the backend infrastructure.
Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
Pros of saas
- More comprehensive and feature-rich, including features like team collaboration and billing integration
- Actively maintained with recent updates and contributions
- Includes a mobile app component for iOS and Android
Cons of saas
- More complex setup and configuration due to its extensive feature set
- Steeper learning curve for developers new to the stack
- Potentially overkill for simpler SaaS projects
Code Comparison
saas (server-side rendering with React):
import React from 'react';
import Head from 'next/head';
import Header from '../components/Header';
import Footer from '../components/Footer';
const Layout = ({ children, title }) => (
<div>
<Head><title>{title}</title></Head>
<Header />
{children}
<Footer />
</div>
);
saas-starter-kit (client-side rendering with React):
import React from 'react';
import { Helmet } from 'react-helmet';
import Header from '../components/Header';
import Footer from '../components/Footer';
const Layout = ({ children, title }) => (
<>
<Helmet><title>{title}</title></Helmet>
<Header />
<main>{children}</main>
<Footer />
</>
);
Both projects use React for the frontend, but saas employs server-side rendering with Next.js, while saas-starter-kit uses client-side rendering. The layout components are structurally similar, with minor differences in implementation and styling approaches.
💼 An enterprise-grade Next.js boilerplate for high-performance, maintainable apps. Packed with features like Tailwind CSS, TypeScript, ESLint, Prettier, testing tools, and more to accelerate your development.
Pros of next-enterprise
- More comprehensive testing setup with Playwright and Cypress
- Includes internationalization (i18n) support out of the box
- Offers a more opinionated and feature-rich development environment
Cons of next-enterprise
- Less focus on SaaS-specific features like billing and user management
- May be more complex for beginners due to its extensive feature set
- Lacks built-in authentication solutions compared to saas-starter-kit
Code Comparison
saas-starter-kit:
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
export default function ProtectedPage() {
const { data: session, status } = useSession();
const router = useRouter();
next-enterprise:
import { useTranslations } from 'next-intl';
import { NextSeo } from 'next-seo';
export default function HomePage() {
const t = useTranslations('Index');
return (
The code snippets highlight the different focus areas of each project. saas-starter-kit emphasizes authentication and session management, while next-enterprise showcases internationalization and SEO features.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
â Enterprise SaaS Starter Kit
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! ð
ð Additional Resources
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.
ð ï¸ Built With
- 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.ts and i18next.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.
- NextAuth.js (Provides Authentication) This is a complete open-source authentication solution for Next.js applications. It's used to handle user authentication and authorization. The NextAuth.js configuration and providers can be found in the pages/api/auth/[...nextauth].ts file.
ð Deployment
⨠Getting Started
Please follow these simple steps to get a local copy up and running.
Prerequisites
- Node.js (Version: >=18.x)
- PostgreSQL
- NPM
- Docker compose
Development
1. Setup
- Fork the repository
- Clone the repository by using this command:
git clone https://github.com/<your_github_username>/saas-starter-kit.git
2. Go to the project folder
cd saas-starter-kit
3. Install dependencies
npm install
4. Set up your .env file
Duplicate .env.example
to .env
.
cp .env.example .env
5. Create a database (Optional)
To make the process of installing dependencies easier, we offer a docker-compose.yml
with a Postgres container.
docker-compose up -d
6. Set up database schema
npx prisma db push
7. Start the server
In a development environment:
npm run dev
8. Start the Prisma Studio
Prisma Studio is a visual editor for the data in your database.
npx prisma studio
9. Testing
We are using Playwright to execute E2E tests. Add all tests inside the /tests
folder.
Update playwright.config.ts
to change the playwright configuration.
Install Playwright dependencies
npm run playwright:update
Run E2E tests
npm run test:e2e
Note: HTML test report is generated inside the report
folder. Currently supported browsers for test execution chromium
and firefox
Fully customizable boilerplate out of the box, see images below ððð
ð¥ Features
- Create account
- Sign in with Email and Password
- Sign in with Magic Link
- Sign in with SAML SSO
- Sign in with Google [Setting up Google OAuth]
- Sign in with GitHub [Creating a Github OAuth App]
- Directory Sync (SCIM)
- Update account
- Create team
- Delete team
- Invite users to the team
- Manage team members
- Update team settings
- Webhooks & Events
- Internationalization
- Audit logs
- Roles and Permissions
- Dark mode
- Email notifications
- E2E tests
- Docker compose
- Prisma Studio
- Update member role
- Directory Sync Events
- Avatar Upload
- SAML SSO
- Audit Log
- Webhook
- Payments
- Security Headers
â¡ï¸ Coming Soon
- Billing & subscriptions
- Unit and integration tests
⨠Contributing
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.
𤩠Community
- 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)
ð Contributors
Made with contrib.rocks.
ð¡ï¸ License
Top Related Projects
Clone, deploy, and fully customize a SaaS subscription application with Next.js.
The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
💼 An enterprise-grade Next.js boilerplate for high-performance, maintainable apps. Packed with features like Tailwind CSS, TypeScript, ESLint, Prettier, testing tools, and more to accelerate your development.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot