A production-ready full-stack template with Next.js, Neon Postgres, Auth.js, Drizzle ORM, and optional Redis caching.
- Next.js 15 with App Router and React Server Components
- TypeScript for type safety
- Neon Postgres serverless database
- Drizzle ORM with type-safe queries
- Auth.js (NextAuth v5) with GitHub and Google OAuth
- Upstash Redis for caching (optional)
- Tailwind CSS for styling
- ESLint for code quality
- Optimized for Vercel deployment
Copy the example environment file:
cp .env.example .envFill in your environment variables:
DATABASE_URL- Your Neon Postgres connection stringAUTH_SECRET- Generate withopenssl rand -base64 32- OAuth credentials (GitHub and/or Google)
- Redis credentials (optional)
Push the database schema:
pnpm db:pushpnpm devOpen http://localhost:3000 to see your app.
pnpm db:generatepnpm db:migratepnpm db:pushpnpm db:studioThis template includes Auth.js with support for:
- GitHub OAuth
- Google OAuth
- Database sessions with Drizzle adapter
To add more providers, edit auth.config.ts.
GitHub:
- Go to GitHub Settings → Developer settings → OAuth Apps
- Create a new OAuth App
- Set callback URL:
http://localhost:3000/api/auth/callback/github - Add
GITHUB_IDandGITHUB_SECRETto.env
Google:
- Go to Google Cloud Console
- Create OAuth credentials
- Set callback URL:
http://localhost:3000/api/auth/callback/google - Add
GOOGLE_IDandGOOGLE_SECRETto.env
Redis is optional. If you don't configure it, the app will work without caching.
To enable Redis:
- Create an Upstash Redis database at upstash.com
- Add credentials to
.env:UPSTASH_REDIS_REST_URL=your-url UPSTASH_REDIS_REST_TOKEN=your-token
Use the helper function to check availability:
import { redis, isRedisAvailable } from "@/lib/redis";
if (isRedisAvailable()) {
await redis!.set("key", "value");
}├── app/ # Next.js app directory
│ ├── api/ # API routes
│ └── ... # Pages and layouts
├── lib/ # Shared utilities
│ ├── db/ # Database schema and connection
│ └── redis.ts # Redis client (optional)
├── auth.ts # Auth.js configuration
├── auth.config.ts # Auth.js provider config
├── middleware.ts # Auth middleware
└── drizzle.config.ts # Drizzle ORM configuration
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy
Vercel will automatically:
- Install dependencies
- Run the build
- Deploy to production
Make sure to add all variables from .env.example to your Vercel project settings.
Update AUTH_URL to your production URL.
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLintpnpm typecheck- Check TypeScript typespnpm test- Run testspnpm verify- Run all checks (lint + typecheck + test)pnpm db:generate- Generate database migrationspnpm db:migrate- Apply migrationspnpm db:push- Push schema to databasepnpm db:studio- Open Drizzle Studio
- Next.js - React framework
- TypeScript - Type safety
- Neon - Serverless Postgres
- Drizzle ORM - TypeScript ORM
- Auth.js - Authentication
- Upstash Redis - Serverless Redis
- Tailwind CSS - Styling
- Vercel - Deployment
MIT