A modern, full-stack SaaS starter kit built with Next.js 15, Tailwind CSS, Drizzle ORM, and Auth.js. This template provides a solid foundation for building SaaS applications with authentication, database management, and modern development tooling. The UI is purposely left blank to allow you to build with your preferred library and components.
- Modern Tech Stack: Next.js 15, React 19, Tailwind CSS v4, Auth.js v5 and more
- Authentication: Auth.js v5 with Google OAuth and Magic Link email providers (Resend)
- Database: PostgreSQL with Drizzle ORM
- Code Quality: ESLint, Prettier, Husky pre-commit hooks
- Type Safety: Full TypeScript support
- Database Migrations: Automated with Drizzle Kit
- Flexible UI: No UI framework dependency - build with your preferred components
- Framework: Next.js
- Language: TypeScript
- Database: PostgreSQL
- ORM: Drizzle ORM
- Authentication: Auth.js
- Styling: Tailwind CSS
- Code Formatting: Prettier
- Linting: ESLint
- Git Hooks: Husky
Before you begin, ensure you have the following installed:
- Node.js (v20 or higher)
- PostgreSQL database
- Git
git clone https://github.com/stephenw310/saas-starter-kit.git
cd saas-starter-kitnpm installCopy the .env.example file to .env and update the values:
Run the database migrations:
npm run db:migratenpm run devVisit http://localhost:3000 to see your application running.
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run db:migrate- Generate and run database migrationsnpm run db:studio- Open Drizzle Studio for database management
This template supports multiple authentication methods:
- Create a project in Google Cloud Console
- Navigate to APIs & Services > Credentials
- Configure the OAuth consent screen
- Create OAuth 2.0 credentials (Web application)
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/googlefor development - Copy the client ID and secret
- Add to
.env
For more details, see the Auth.js OAuth Guide
- Sign up for Resend
- Get your API key from the dashboard
- Add it to your
.envfile - Update the sender domain in
src/lib/auth.ts(currently set to "no-reply@company.com") - Verify the sender domain in the Resend portal
The template uses the authentication schema provided by the @auth/drizzle-adapter package, which includes:
- users - Core user accounts and profile data
- accounts - OAuth provider account links
- sessions - Active user sessions
- verificationTokens - Email verification tokens for magic links
- authenticators - WebAuthn authenticators
src/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # React components
β βββ auth/ # Authentication components
βββ db/ # Database configuration
β βββ drizzle/ # Migration files
β βββ schema.ts # Database schema
βββ lib/ # Utility functions
β βββ auth.ts # Authentication configuration
βββ middleware.ts # Middleware
This template includes several development tools to ensure code quality:
- Pre-commit hooks: Automatic code formatting and linting with Husky
- Type checking: Full TypeScript support across the entire codebase
- Database migrations: Automated schema management with Drizzle Kit
- Code formatting: Prettier with Tailwind CSS plugin for consistent styling
- Linting: ESLint with Next.js and Prettier configurations
Make sure to set all required environment variables in your production environment:
DATABASE_URL- PostgreSQL connection URLAUTH_SECRET- Random string used to encrypt cookies and tokensAUTH_GOOGLE_ID- Google OAuth client IDAUTH_GOOGLE_SECRET- Google OAuth client secretRESEND_API_KEY- API key from Resend for email authentication
Important: Remember to update the authorized redirect URI in your Google Cloud Console to match your production domain:
https://your-domain.com/api/auth/callback/google
-
Install Docker on your machine.
-
Set
NEXTAUTH_URLin your.envfile to the URL of your Docker container. For example, if you are running the container on your local machine, you can set it tohttp://localhost:3000. -
Build your container:
docker build -t saas-starter-kit . -
Run your container:
docker run -p 3000:3000 saas-starter-kit
npm run build
npm run start-
Docker deployment configuration - Stripe payment integration
- Email templates
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT LICENSE.
If you have any questions or need help getting started, you can:
- Check the Next.js documentation
- Review the Auth.js documentation
- Open an issue
Happy coding! π