Loading repository data…
Loading repository data…
sinanptm / repository
Full-stack clean architecture, authentication template with Next.js, NodeJs, TypeScript. Features email/OTP, OAuth, RBAC, JWT security, and clean architecture for easy customization and scaling.
A production-ready authentication system built with clean architecture principles and modern technologies
This comprehensive full-stack authentication template is designed with clean architecture principles, providing a solid foundation for building scalable web applications with robust user authentication and authorization systems.
📚 Documentation: https://clean-auth-template.vercel.app 🛠️ CLI Tool: https://npmjs.com/package/clean-auth
The template demonstrates modern web development practices with a focus on security, scalability, and maintainability. It includes comprehensive authentication flows, role-based access control, and production-ready deployment configurations.
The fastest way to get started is using our CLI tool:
Install the CLI
npm install -g clean-auth
Create a New Project
# OR Use npx (Without Installing Globally)
# Run commands without installing the CLI globally
npx clean-auth init my-auth-project --i
cd my-auth-project
Configure Authentication
clean-auth config [options]
Start Development
pnpm dev
If you prefer to set up the project manually without using CLI:
Clone the repository
git clone https://github.com/sinanptm/fullstack-clean-auth-template.git
cd fullstack-clean-auth-template
Install dependencies
pnpm install
Start Development
pnpm dev
The clean-auth CLI provides powerful commands to scaffold and manage your authentication project:
init - Initialize ProjectCreate a new full-stack authentication project with clean architecture.
clean-auth init <project-name> [options]
Options:
-i, --install - Automatically install dependencies after project creationExamples:
clean-auth init my-auth-project
clean-auth init my-auth-project --install
config - Configure AuthenticationSet up environment variables and authentication configuration interactively.
clean-auth config [options]
Options:
-s, --skip - Skip interactive prompts and use default valuesExamples:
clean-auth config
clean-auth config --skip
clean - Clean Project StructureRemove unnecessary parts of your project structure to customize it for your needs.
clean-auth clean [options]
Options:
-s, --server - Remove entire server directory and update root configurations-w, --web - Remove entire web directory and update root configurations-o, --opensource - Remove open source files (LICENSE, CONTRIBUTING.md, README.md)Examples:
clean-auth clean --server
clean-auth clean --web --opensource
help - Show All CommandsDisplay a list of all available commands.
clean-auth help
User Registration
Forgot Password Modal
Password Reset Email
OTP Verification
OTP Email Verification
User Profile Dashboard
Admin Login
Admin Dashboard
| Workflow | Trigger | Purpose |
|---|---|---|
| CI/CD Pipeline | Push to main/develop, PRs | Build, test, and quality checks |
| Security Audit | Weekly schedule, Push/PR | Vulnerability scanning |
| Update Dependencies | Weekly schedule, Manual | Automated dependency updates |
| Method | Endpoint | Description | Body |
|---|---|---|---|
POST | /api/auth/signup | User registration | { email, password, name } |
POST | /api/auth/signin | Email/password login | { email, password } |
POST | /api/auth/verify-otp | Verify OTP code | { email, otp } |
POST | /api/auth/oauth-2 | OAuth authentication | { firebaseToken } |
POST | /api/auth/forgot-password | Request password reset | { email } |
POST | /api/auth/reset-password | Reset password with OTP | { email, otp, newPassword } |
POST | /api/auth/refresh | Refresh access token | { refreshToken } |
POST | /api/auth/logout | User logout | - |
👤 User Endpoints
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET | /api/user/profile | Get user profile | ✅ User |
PUT | /api/user/profile | Update user profile | ✅ User |
👑 Admin Endpoints
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST | /api/admin/signin | Admin login | - |
GET | /api/admin/users | List all users | ✅ Admin |
GET | /api/admin/users/:id | Get specific user | ✅ Admin |
PUT | /api/admin/users/:id | Update user | ✅ Admin |
DELETE | /api/admin/users/:id | Delete user | ✅ Admin |
GET | /api/admin/analytics | System analytics | ✅ Admin |