Skip to content

Saas Template usign Next.js + Shadcn/ui + Postgresql + Drizzle + Stripe + BetterAuth + Tailwind CSS

Notifications You must be signed in to change notification settings

CianCode/Saas-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Saas Template Banner

A modern, production-ready full-stack web application template

Built with Next.js 15, TypeScript, Tailwind CSS, Drizzle ORM, PostgreSQL, BetterAuth, and ShadCN UI


🧰 Tech Stack

Next.js React TypeScript Tailwind CSS Shadcn/UI PostgreSQL Drizzle Docker BetterAuth


✨ Features

πŸ” Authentication & Authorization
  • Secure Login/Registration: Email and password authentication with validation
  • Email Verification: OTP-based email confirmation system
  • Role-Based Access Control: Admin, user, and guest role management
  • Password Reset: Secure password reset flow with email verification
  • Session Management: JWT-based session handling
🎨 User Interface
  • Modern Design System: Beautiful, accessible components with ShadCN UI
  • Responsive Design: Mobile-first approach with Tailwind CSS
  • Dark/Light Mode: Theme switching with persistent user preferences
  • Loading States: Skeleton loaders and progress indicators
  • Form Validation: Real-time validation with helpful error messages
πŸ› οΈ Developer Experience
  • Type Safety: Full TypeScript coverage with strict mode
  • Database Management: Type-safe queries with Drizzle ORM
  • Code Quality: ESLint, Prettier, and pre-commit hooks
  • Hot Reload: Instant feedback during development
  • API Documentation: Auto-generated API docs
πŸš€ Performance & Production
  • Optimized Builds: Next.js optimizations for production
  • Database Pooling: Connection pooling for better performance
  • Caching Strategy: Built-in caching for API routes and pages
  • Docker Ready: Production-ready containerization
  • Health Checks: Built-in health monitoring endpoints

πŸš€ Getting Started

Prerequisites

Installation

1. Clone the Repository

git clone https://github.com/CianCode/Saas-Template.git
cd Saas-Template

2. Install Dependencies

pnpm install
# or
npm install

3. Environment Setup

cp .env.example .env

Update .env with your configuration:

4. Start PostgreSQL

docker compose up -d
# Wait 10–15 seconds for database to be ready

5. Set Up the Database Schema

# Push schema
pnpm db:push

# Or run migrations
pnpm db:migrate

6. Seed the Database (optional)

pnpm db:seed

7. Start Development Server

pnpm dev

Open http://localhost:3000 to see your app.


πŸ“ Project Structure

Saas-Template/
β”œβ”€β”€ app/                        # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/                 # Authentication pages
β”‚   β”œβ”€β”€ api/                    # API routes
β”‚   β”œβ”€β”€ dashboard/              # Protected pages
β”‚   β”œβ”€β”€ globals.css             # Global styles
β”‚   β”œβ”€β”€ layout.tsx              # Root layout
β”‚   └── page.tsx                # Home page
β”œβ”€β”€ components/                 # Reusable components
β”œβ”€β”€ lib/                        # Utilities (auth, db, validations)
β”œβ”€β”€ db/                         # Drizzle schema, migrations, seeds
β”œβ”€β”€ hooks/                       # Custom hooks
β”œβ”€β”€ types/                       # TypeScript types
β”œβ”€β”€ public/                      # Static assets
β”œβ”€β”€ docker-compose.yml           # Docker config
β”œβ”€β”€ drizzle.config.ts            # Drizzle ORM config
β”œβ”€β”€ next.config.js               # Next.js config
β”œβ”€β”€ tailwind.config.ts           # Tailwind CSS config
└── tsconfig.json                # TypeScript config

πŸ“š Available Scripts

πŸ—οΈ Development

pnpm dev           # Start development server
pnpm dev:debug     # Start dev server in debug mode
pnpm dev:clean     # Clean & start fresh dev server

πŸ“¦ Build & Production

pnpm build         # Build app for production
pnpm start         # Start production server

🧹 Linting

pnpm lint          # Run linter
pnpm lint:fix      # Lint & auto-fix issues
pnpm lint:strict   # Lint in strict mode (no warnings)

πŸ—„οΈ Database

pnpm db:generate   # Generate Drizzle migrations
pnpm db:push       # Push schema to DB
pnpm db:migrate    # Run migrations
pnpm db:studio     # Open Drizzle Studio
pnpm db:seed       # Seed DB with initial data
pnpm db:reset      # Reset DB & seed fresh data

🎨 ShadCN UI

pnpm ui:add        # Add a new component
pnpm ui:update     # Update components

🀝 Contributing

See CONTRIBUTING.md.

  1. Fork the repository
  2. Create feature branch
  3. Add changes & tests
  4. Commit & push
  5. Open Pull Request

πŸ“„ License

MIT License β€” see LICENSE


πŸ™ Acknowledgments


🌟 Show Your Support

  • ⭐ Star the repo
  • 🍴 Fork it
  • πŸ“’ Share with others
  • πŸ› Report bugs or suggest improvements

Built with ❀️ by CianCode

Happy coding! πŸš€

About

Saas Template usign Next.js + Shadcn/ui + Postgresql + Drizzle + Stripe + BetterAuth + Tailwind CSS

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published