This project provides a robust boilerplate for building Next.js applications with integrated user authentication. Utilizing modern technologies such as TypeScript, Tailwind CSS, and Prisma ORM, this template is designed to kick-start development and streamline the process of implementing secure, efficient authentication.
next.config.mjs
, .env
, and .env.local
for maintaining different settings across development, testing, and production environments.Ensure you have the following installed:
Clone the Repository
git clone https://github.com/jordanhughes421/nextjs-auth-boilerplate.git
cd nextjs-auth-boilerplate
Install Dependencies Using npm:
npm install
Or using yarn:
yarn
Set Up Environment Variables Rename the .env.example to .env and update the variables to suit your environment:
DATABASE_URL="your-database-url"
SECRET="your-secret-key"
Run Prisma Migrations (Optional) If you are using Prisma, set up your database schema:
npx prisma migrate dev
Start the Development Server or Database For Dev Server:
npm run dev
Or:
yarn dev
The application will be available at http://localhost:3000.
For Prisma Database Server:
npm run database
Or:
yarn database
The application will be available at http://localhost:5555.
Directory Structure
/app: Contains the core application features, including layout components and utility functions.
/api: Server-side API routes for handling authentication.
/dashboard: Components for the authenticated user's dashboard.
/prisma: Contains Prisma schema files for database modeling.
/public: Static files like images and the favicon.
/utils: Shared utility functions across the application.
/components: Shared component functions across the application.
Customizing
To customize this boilerplate for your own project:
Modify the Prisma schema in /prisma/schema.prisma to reflect your database models. Update the Tailwind configuration in tailwind.config.ts to match your design requirements. Extend or modify API routes in /app/api to suit your authentication flow.
Contributing
Contributions are welcome! Please fork the repository and submit pull requests with your features or fixes.
License
Distributed under the MIT License. See LICENSE for more information.