A modern e-commerce application built with Next.js 15, TypeScript, TailwindCSS, Better Auth, Neon PostgreSQL, Drizzle ORM, and Zustand.
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: TailwindCSS
- Authentication: Better Auth
- Database: Neon PostgreSQL
- ORM: Drizzle ORM
- State Management: Zustand
- Linting: ESLint
- ✅ Modern Next.js 15 with App Router
- ✅ TypeScript for type safety
- ✅ TailwindCSS for styling
- ✅ Better Auth for authentication (email/password + OAuth)
- ✅ Neon PostgreSQL database
- ✅ Drizzle ORM for type-safe database queries
- ✅ Zustand for state management
- ✅ ESLint for code quality
- ✅ Database schema for users, products, orders, and cart
npm install
Copy the example environment file and fill in your credentials:
cp .env.example .env
Fill in the following variables in your .env
file:
# Database
DATABASE_URL="postgresql://username:password@host:port/database"
# Better Auth
BETTER_AUTH_SECRET="your-secret-key-here"
BETTER_AUTH_URL="http://localhost:3000"
# GitHub OAuth (optional)
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
# Google OAuth (optional)
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
Create your database tables:
npm run db:push
Or generate and run migrations:
npm run db:generate
npm run db:migrate
npm run dev
Open http://localhost:3000 to see your application.
src/
├── app/
│ ├── api/auth/[...all]/route.ts # Better Auth API routes
│ └── page.tsx # Homepage
├── lib/
│ ├── auth/
│ │ └── index.ts # Better Auth configuration
│ └── db/
│ ├── index.ts # Database connection
│ └── schema.ts # Database schema
└── store/
├── auth.ts # Authentication state
└── cart.ts # Shopping cart state
The application includes the following tables:
- users: User accounts and profiles
- sessions: User sessions for Better Auth
- accounts: OAuth accounts and credentials
- verifications: Email verification tokens
- products: Product catalog
- orders: Customer orders
- order_items: Individual items in orders
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLintnpm run db:generate
- Generate database migrationsnpm run db:migrate
- Run database migrationsnpm run db:push
- Push schema changes to databasenpm run db:studio
- Open Drizzle Studio
The app uses Better Auth with support for:
- Email/password authentication
- GitHub OAuth (optional)
- Google OAuth (optional)
- Session management
- Email verification
Zustand stores are configured for:
- Authentication: User login state and profile
- Shopping Cart: Cart items, quantities, and totals
- Set up your Neon PostgreSQL database
- Configure your OAuth providers (optional)
- Customize the UI and add your branding
- Implement product management
- Add payment processing
- Deploy to your preferred platform
This app can be deployed to:
- Vercel (recommended for Next.js)
- Netlify
- Railway
- Any platform supporting Node.js
Make sure to set your environment variables in your deployment platform.