A modern, full-stack SAAS starter template built with Turborepo, featuring Next.js, Better Auth, Prisma, and Shadcn UI. This monorepo template provides a solid foundation for building scalable SAAS applications.
- Monorepo Architecture: Built with Turborepo for optimal development experience
- Modern Stack:
- Next.js for the frontend
- Better Auth for authentication
- Prisma for database management
- Shadcn UI for beautiful, accessible components
- Type Safety: Full TypeScript support
- Code Quality: ESLint and Prettier for consistent code style
- Package Management: PNPM for efficient dependency management
saas-turbo/
├── apps/
│ ├── app/ # Main application
│ ├── studio/ # Admin dashboard
│ └── web/ # Marketing website
├── packages/ # Shared packages and configurations
└── ...
- Node.js >= 20
- PNPM >= 10.4.1
-
Clone the repository
git clone cd saas-turbo -
Install dependencies
pnpm install
-
Set up environment variables
- Copy
.env.exampleto.envin each app directory - Fill in the required environment variables
- Copy
-
Start the development server
pnpm dev
pnpm dev- Start development serverpnpm build- Build all applications and packagespnpm lint- Run ESLintpnpm format- Format code with Prettier
-
packages/auth
- Exports:
@repo/auth/clientwhich is a better auth client exportingsignIn,signOut,signUp,useSession,resetPassword,forgetPassword@repo/auth/serverwhich exportsbetter-authinstance to be used in the server component.@repo/auth/actionswhich has augmented functions which check for the users in the database and return either the error message in case the form data is violated.
- Setup the env variables in the respective app directory and then run
pnpm run auth:db:generateto generate User and Account Schema in your database@repo/db, make sure you migrate the database after that. - exports
better-auth/clientandbetter-auth/server clientexports functionssignIn, signOut, signUp, useSession, resetPassword, forgetPassword- The
apps/app/lib/actions.tsfile exports two functions to signin, signup the user from the FormData. - Reset Password: in
auth/setver.ts, for email and password login, reset link is sent using the sendsendResetPasswordEmaildefined in the@repo/email
- Exports:
-
packages/db
- exprots prisma client as prisma