https://github.com/amarmuric04/auth_template
๐ A secure, production-ready auth starter with passwordless login (OTP) using custom JWT, plus OAuth via NextAuth (Google & GitHub). Built on Next.js with Prisma ORM and Supabase as the backend. Includes a modern UI, full responsiveness, and a built-in AI chatbot integration โ ready to drop into any SaaS or app project.
https://github.com/amarmuric04/auth_template
ai-chatbot auth fullstack jwt nextauth nextjs oauth otp passwordless postgresql prisma secure-login supabase
Last synced: 3 months ago
JSON representation
๐ A secure, production-ready auth starter with passwordless login (OTP) using custom JWT, plus OAuth via NextAuth (Google & GitHub). Built on Next.js with Prisma ORM and Supabase as the backend. Includes a modern UI, full responsiveness, and a built-in AI chatbot integration โ ready to drop into any SaaS or app project.
- Host: GitHub
- URL: https://github.com/amarmuric04/auth_template
- Owner: AmarMuric04
- License: mit
- Created: 2025-05-01T04:12:36.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-10T15:27:36.000Z (about 1 year ago)
- Last Synced: 2025-05-18T17:17:26.422Z (about 1 year ago)
- Topics: ai-chatbot, auth, fullstack, jwt, nextauth, nextjs, oauth, otp, passwordless, postgresql, prisma, secure-login, supabase
- Language: TypeScript
- Homepage: https://auth-starting-template.vercel.app
- Size: 1.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Full Auth Template โ Custom JWT + OTP + OAuth (Next.js + Prisma + Supabase)
A modern and secure **authentication template** built with **Next.js**, featuring:
- ๐ **Custom credentials auth** using **passwordless OTP** (no passwords stored!)
- ๐ **OAuth support** with **GitHub** and **Google** (via NextAuth)
- โ๏ธ **Custom JWT-based system** for credentials auth
- ๐ง A custom-built **AI chatbot** integrated and ready to go
- ๐จ Fully responsive, modern UI
- ๐งฉ **Supabase** PostgreSQL database with **Prisma ORM**
Designed for scalability and security, this starter gives you everything you need to bootstrap a real-world auth system.
---
## ๐ Features
- โ
Passwordless authentication via OTP codes (email-based)
- ๐ OAuth support with GitHub and Google via NextAuth
- ๐ Custom credentials login with stateless JWT handling
- ๐ง Integrated AI chatbot (drop-in use or extendable)
- ๐ฑ Fully responsive and mobile-friendly
- ๐ฝ PostgreSQL + Supabase backend with Prisma ORM
- ๐งฐ Built with **Next.js App Router** and modular component design
---
## ๐งฑ Tech Stack
| Layer | Tech |
|--------------|-----------------|
| Frontend | Next.js |
| Backend | Next.js (API) |
| Auth (OAuth) | NextAuth |
| Auth (OTP) | Custom JWT + OTP |
| DB | PostgreSQL via Supabase |
| ORM | Prisma |
| AI Chatbot | Custom-built (plug-and-play) |
---
## ๐ง Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/amarmuric04/auth-template.git
cd auth-template
```
### 2. Install Dependencies
```bash
npm install
# or
yarn
```
### 3. Configure Environment Variables
Copy `.env.example` to `.env.local`:
```env
DATABASE_URL=postgresql://user:password@host:port/dbname
# JWT Secrets
JWT_SECRET=your_jwt_secret
# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role
# NextAuth (for OAuth)
NEXTAUTH_SECRET=nextauth_secret_here
NEXTAUTH_URL=http://localhost:3000
GITHUB_ID=your_github_id
GITHUB_SECRET=your_github_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
```
### 4. Set Up the Database
```bash
npx prisma generate
npx prisma db push
```
> โ
Schema already included for user, OTP verification, sessions, and chatbot data.
### 5. Seed the Database (Optional)
Use mock data or your own:
```bash
npm run seed
```
### 6. Start the App
```bash
npm run dev
# or
yarn dev
```
Open [http://localhost:3000](http://localhost:3000)
---
## ๐งฌ How Authentication Works
### ๐ OTP-based Credentials (Passwordless)
- Users login with email
- An OTP code is emailed (or mocked in dev)
- OTP is verified and a **JWT** is issued
- Stateless auth: sessions are stored client-side via JWT
### ๐งท OAuth Login
- Handles GitHub and Google using **NextAuth**
- Session strategy can be configured (JWT or DB-based)
---
## ๐ค AI Chatbot
A smart, extendable chatbot built directly into the UI.
- Custom hook/API integration
- Chat log stored in Supabase
- UI is mobile-ready and responsive
- Great for onboarding or user help center
---
## ๐ Project Structure
``
/app โ Next.js App Router pages
/components โ UI and shared components
/lib โ Utilities (auth, jwt, helpers)
/prisma โ Prisma schema and client
/pages/api/auth โ Custom API for OTP + NextAuth
/styles โ Global CSS / Tailwind
/chatbot โ AI bot logic and UI
``
---
## ๐ Security Notes
- Passwordless auth = more secure and lower friction
- OTP expires after X minutes (configurable)
- JWT is signed with server-only secret
- OAuth tokens never touch your DB directly
- Fully stateless login path with fallback to OAuth
---
## ๐งช Testing
Coming soon:
- Jest for unit tests
- Playwright for E2E
- Auth flow test harness
---
## ๐ฆ Deployment
- One-click deploy to **Vercel**
- Add env variables in Vercel dashboard
- Works with Docker (optional)
---
## ๐ License
MIT
---
Built for modern apps that need secure, scalable, and flexible authentication + AI support.