A modern, full-stack Next.js 16 application with authentication, built with the latest technologies and best practices.
- Next.js 16 - Latest version with App Router
- TypeScript - Type-safe code
- Tailwind CSS v4 - Modern styling with utility-first CSS
- shadcn/ui - Beautiful, accessible UI components
- NextAuth.js v5 (Auth.js) - Secure authentication
- Prisma ORM - Type-safe database access
- SQLite - Lightweight database (easily swappable)
- bcryptjs - Secure password hashing
- Zod - Schema validation
- Lucide Icons - Beautiful icon set
- Node.js 18+ installed
- npm, yarn, or pnpm package manager
- Clone the repository:
git clone <repository-url>
cd next-js-new-auto- Install dependencies:
npm install- Set up environment variables:
The
.envfile should already contain:
DATABASE_URL="file:./dev.db"
AUTH_SECRET="your-generated-secret"
AUTH_URL="http://localhost:3000"- Initialize the database:
npx prisma migrate devStart the development server:
npm run devOpen http://localhost:3000 in your browser.
├── app/
│ ├── actions/ # Server actions
│ ├── api/ # API routes
│ ├── dashboard/ # Protected dashboard page
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/
│ ├── ui/ # shadcn/ui components
│ ├── login-form.tsx # Login form component
│ └── register-form.tsx # Register form component
├── lib/
│ ├── db.ts # Prisma client
│ └── utils.ts # Utility functions
├── prisma/
│ ├── migrations/ # Database migrations
│ └── schema.prisma # Database schema
├── auth.ts # NextAuth configuration
└── prisma.config.ts # Prisma configuration
- Registration: Users can create an account with name, email, and password
- Login: Users authenticate with email and password
- Protected Routes: Dashboard is only accessible to authenticated users
- Logout: Users can sign out securely
The application uses a simple User model:
model User {
id String @id @default(cuid())
email String @unique
name String?
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}The application uses:
- Tailwind CSS v4 with custom CSS variables
- Dark mode support
- shadcn/ui components for consistent design
- Responsive design for all screen sizes
# Development
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Prisma commands
npx prisma studio # Open Prisma Studio
npx prisma migrate dev # Create a migration
npx prisma generate # Generate Prisma Client- Push your code to GitHub
- Import your repository on Vercel
- Add environment variables in Vercel dashboard
- Deploy!
For deployment on other platforms, ensure you:
- Set environment variables properly
- Run
npm run buildto create a production build - Use SQLite or migrate to PostgreSQL/MySQL for production
- Passwords hashed with bcryptjs
- CSRF protection via NextAuth
- Secure session management
- Input validation with Zod
- Environment variables for sensitive data
This project is open source and available under the MIT License.
Contributions, issues, and feature requests are welcome!
For support, please open an issue in the GitHub repository.