clerk-auth-system Tailwind Templates

Clerk Auth System

Secure Authentication Made Simple. A modern, production-ready authentication boilerplate built with Next.js 14, Clerk, and Tailwind CSS.

ClerkAuth - Next.js Authentication Boilerplate

Secure Authentication Made Simple

A modern, production-ready authentication boilerplate built with Next.js 14, Clerk, and Tailwind CSS.

ClerkAuth Preview

Features

  • Built with Next.js 14 App Router
  • Secure authentication with Clerk
  • Sleek UI with Tailwind CSS
  • Fully responsive design
  • Protected routes with middleware
  • Fast page transitions
  • Dashboard layout with sidebar navigation for authenticated users
  • Dark mode ready
  • SEO optimized
  • Performance monitoring with Vercel Speed Insights

Quick Start

Prerequisites

  • Node.js 18.18.0 or later
  • npm or yarn
  • A Clerk account (free)

Environment Variables

Create a .env.local file in the root directory with your Clerk credentials:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxxxx
CLERK_SECRET_KEY=sk_test_xxxxxxx

You can get these keys from your Clerk Dashboard.

Installation

  1. Clone the repository:
git clone https://github.com/DanielDallas/clerk-auth-system.git
cd clerk-auth-system
  1. Install dependencies:
npm install
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 in your browser.

šŸ“ Project Structure

clerk-auth-system/
ā”œā”€ā”€ app/                     # Next.js 14 App Router
│   ā”œā”€ā”€ dashboard/          # Protected dashboard routes
│   │   ā”œā”€ā”€ layout.tsx     # Dashboard layout with sidebar
│   │   ā”œā”€ā”€ page.tsx       # Main dashboard page
│   │   ā”œā”€ā”€ users/        # User management
│   │   ā”œā”€ā”€ settings/     # Settings page
│   │   └── help/         # Help & documentation
│   ā”œā”€ā”€ sign-in/          # Sign in page
│   ā”œā”€ā”€ sign-up/          # Sign up page
│   ā”œā”€ā”€ layout.tsx        # Root layout
│   └── page.tsx          # Home page
ā”œā”€ā”€ components/            # React components
ā”œā”€ā”€ lib/                   # Utility functions
ā”œā”€ā”€ public/               # Static files
ā”œā”€ā”€ styles/              # Global styles
ā”œā”€ā”€ middleware.ts        # Clerk authentication middleware
└── tailwind.config.js   # Tailwind configuration

Authentication Flow

  1. Users can sign up or sign in using Clerk's pre-built components
  2. Protected routes are handled by middleware
  3. Unauthorized access redirects to the sign-in page
  4. After authentication, users are redirected to the dashboard
  5. Session management is handled automatically by Clerk

Customization

Styling

The project uses Tailwind CSS for styling. You can customize the theme in tailwind.config.js:

theme: {
  extend: {
    colors: {
      primary: {
        DEFAULT: "#232363",
        // Add more color variations
      },
    },
    // Add more theme customizations
  },
}

Clerk Theme

You can customize Clerk's UI components using the appearance prop:

<SignIn
  appearance={{
    elements: {
      rootBox: "mx-auto",
      card: "shadow-lg",
      // Add more custom styles
    },
  }}
/>

Performance

  • Built with React Server Components
  • Optimized image loading
  • Efficient route handling
  • Minimal client-side JavaScript
  • Performance monitoring with Vercel Speed Insights

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Contact

Daniel Dallas - LinkedIn - @thedanieldallas

Project Link: https://github.com/danieldallas/clerk-auth-system

Top categories

Loading Svelte Themes