A NextJS + TailwindCSS 3 Dashboard Admin For Laravel Breeze

Overview

Windmill with Laravel Breeze as Backend API

Introduction

This repository is an implementing of the Laravel Breeze application / authentication starter kit frontend in Next.js. All of the authentication boilerplate is already written for you - powered by Laravel Sanctum, allowing you to quickly begin pairing your beautiful Next.js frontend with a powerful Laravel backend.

Official Documentation

Installation

First, create a Next.js compatible Laravel backend by installing Laravel Breeze into a fresh Laravel application and installing Breeze's API scaffolding:

# Create the Laravel application...
laravel new next-backend

cd next-backend

# Install Breeze and dependencies...
composer require laravel/breeze

php artisan breeze:install api

Next,

  • Ensure that your application's APP_URL and FRONTEND_URL environment variables are set to http://localhost:8000 and http://localhost:3000/example, respectively.

  • In app/Providers/RouteServiceProvider.php, update : public const HOME = '/';

  • In app/Http/Middleware/Authenticate.php, update :

protected function redirectTo($request)
{
    if (! $request->expectsJson()) {
        return config('app.frontend_url').'/login?next_to='.urlencode($request->url());
    }
}
  • In app/Http/Middleware/RedirectIfAuthenticated.php, update :
public function handle(Request $request, Closure $next, ...$guards)
{
    $guards = empty($guards) ? [null] : $guards;

    foreach ($guards as $guard) {
        if (Auth::guard($guard)->check()) {
            return redirect(config('app.frontend_url').RouteServiceProvider::HOME);
        }
    }

    return $next($request);
}
  • In config/cors.php, update :
<?php

$frontedUrl = env('FRONTEND_URL', '*');

if ($frontedUrl !== '*') {
    $parsed = parse_url($frontedUrl);
    $frontedUrl = sprintf(
        '%s://%s%s',
        $parsed['scheme'],
        $parsed['host'],
        isset($parsed['port']) ? ':' . $parsed['port'] : ''
    );
}

return [

    /*
    |--------------------------------------------------------------------------
    | Cross-Origin Resource Sharing (CORS) Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure your settings for cross-origin resource sharing
    | or "CORS". This determines what cross-origin operations may execute
    | in web browsers. You are free to adjust these settings as needed.
    |
    | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
    |
    */

    'paths' => ['*'],

    'allowed_methods' => ['*'],

    'allowed_origins' => [$frontedUrl],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => true,

];

After defining the appropriate environment variables and update several codes above, you may serve the Laravel application using the serve Artisan command:

# Serve the application...
php artisan serve

Next, clone this repository and install its dependencies with yarn install or npm install. Then, copy the .env.example file to .env.local and supply the URL of your backend:

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000

Finally, run the application via yarn dev or npm run dev. The application will be available at http://localhost:3000:

yarn dev

# or

npm run dev

Note: Currently, we recommend using localhost during local development of your backend and frontend to avoid CORS "Same-Origin" issues.

Authentication Hook

This Next.js application contains a custom useAuth React hook, designed to abstract all authentication logic away from your pages. In addition, the hook can be used to access the currently authenticated user:

const ExamplePage = () => {
    const { logout, user } = useAuth({ middleware: 'auth' })

    return (
        <>
            <p>{user?.name}</p>

            <button onClick={logout}>Sign out</button>
        </>
    )
}

export default ExamplePage

Note: You will need to use optional chaining (user?.name instead of user.name) when accessing properties on the user object to account for Next.js's initial server-side render.

About Windmill

Windmill Dashboard Next.js Typescript

Windmill Dashboard React

See the Original Project by @estevanmaito

This is not a template. This is a complete application, built on top of React, with all tiny details taken care of so you just need to bring the data to feed it.

Accessibility is a priority in my projects and I think it should be in yours too, so this was developed listening to real screen readers, focus traps and keyboard navigation are available everywhere.

📦 Features

  • 🦮 Throughly accessible (developed using screen readers)
  • 🌗 Dark theme enabled (load even different images based on theme)
  • 🧩 Multiple (custom) components
  • Code splitting
  • Tailwind CSS
  • Windmill React UI Documentation
  • Heroicons
  • Chart.js

📚 Docs

General components

Windmill Dashboard React is built on top of Windmill React UI.

See Windmill React UI Documentation

Example Boilerplate

All components and containers are saved in folder example

Routing

Change default redirecting when hit the / or home in file next.config.js

  async redirects() {
    return [
      {
        source: '/',
        destination: '/example/login',
        permanent: false,
      },
    ]
  }

Sidebar routes

To configure sidebar menus, see file (routes/sidebar.tsx).

These are the routes that will show in the sidebar. They expect three properties:

  • path: the destination;
  • name: the name to be shown;
  • icon: an icon to illustrate the item

Item that are used as dropdowns, like the Pages option, don't need a path, but expect a routes array of objects with path and name:

// sidebar.js
{
  path: '/example/tables',
  icon: 'TablesIcon',
  name: 'Tables',
},
{
  icon: 'PagesIcon', // <-- this is used as a submenu, so no path
  name: 'Pages',
  routes: [
    // submenu
    {
      path: '/example/login',
      name: 'Login', // <-- these don't have icons
    },
    {
      path: '/example/create-account',
      name: 'Create account',
    },

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, install dependencies :

npm install
# or
yarn install

then, you can run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.ts.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

You might also like...

Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

May 18, 2022

Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

May 3, 2022

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

E-commerce website using Laravel, Tailwindcss and Alpine.js

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Dec 12, 2022

A Simple Dashboard Chart in Laravel Nova using Chart JS

A Simple Dashboard Chart in Laravel Nova using Chart JS

A Simple Dashboard Chart in Laravel Nova using Chart JS. Starting create your own dashboard with Chart JS Integration can save your time and help you maintain consistency across standard elements such as Bar, Stacked, Line, Area, Doughnut and Pie Chart.

Jan 4, 2023

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin

:tada: A magical vue admin                                                                https://panjiachen.github.io/vue-element-admin

English | 简体中文 | 日本語 | Spanish SPONSORED BY 活动服务销售平台 客户消息直达工作群 Introduction vue-element-admin is a production-ready front-end solution for admin inter

Dec 31, 2022

🎉 基于 reactjs 开发的可视化项目实战【https://wuli-admin.gitee.io/react-wuli-admin/#/workspace/fullscreen】

react-visual-data 介绍 🎉 基于 reactjs 开发的可视化项目实战 亮点 大屏设计器:自由拖拽大屏 报表设计器:自适应排列布局 动态表单:schema 设计模式 vue版本尝鲜:vue版本尝鲜 issues,欢迎提交~ 调试 git clone https://githu

Dec 13, 2022

Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business. It contains reusable components, theme color, and design support along with dark theme support.

Dec 18, 2022

Advanced Opensource Status Page Solution for Everyone with Simple Admin Dashboard.

Advanced Opensource Status Page Solution for Everyone with Simple Admin Dashboard.

About UpStats There are many great Opensource, Hosted Solutions for Status Page, however, I didn't find one that really suit my needs so we created th

Jul 19, 2022

Starter Antd 4.0 Admin App Mern( Node.js / React / Redux / Ant Design ) Crud & Auth , Dashboard

Starter Antd 4.0 Admin App  Mern( Node.js / React / Redux / Ant Design ) Crud & Auth , Dashboard

Starter Antd Admin (Crud & auth) Mern App (Express.js / React / Redux / MongoDB) App built for DigitalOcean MongoDB Hackathon CRM Starter Mern Antd Ad

Jan 8, 2023

Carpatin is a React JS Admin Dashboard Template that focuses on the management flows of a back-office application. We leverage the Material-UI power of stylizing the components in a way that feels more professional.

Carpatin is a React JS Admin Dashboard Template that focuses on the management flows of a back-office application. We leverage the Material-UI power of stylizing the components in a way that feels more professional.

Carpatin Dashboard Free Carpatin is a React Js Admin Dashboard Template that focuses on the management flows of a back-office application. We leverage

Dec 12, 2022

Voler - The first Bootstrap 5 admin dashboard template

Voler - The first Bootstrap 5 admin dashboard template

HEAD Voler Voler is a Admin Dashboard Template that can help you develop faster. Made with Bootstrap 5 Alpha. No jQuery dependency. Installati

Dec 28, 2022

AMP: is a fast admin dashboard template based on FastAPI

AMP: is a fast admin dashboard template based on FastAPI

AMP: is a fast admin dashboard template based on FastAPI Introduction AMP: is a fast admin dashboard template based on FastAPI. The project uses its o

Jan 1, 2023

Portal - Free Bootstrap 5 Admin Dashboard Template For Developers

Portal - Free Bootstrap 5 Admin Dashboard Template For Developers

Theme Details & Demo Demo: https://themes.3rdwavemedia.com/bootstrap-templates/admin-dashboard/portal-free-bootstrap-admin-dashboard-template-for-deve

Dec 22, 2022

dashboard to help admin control their system users & employees

dashboard to help admin control their system users & employees

Reno Dashboard 📝 Table of Contents About getting started Demo screenshots 🚩 About dashboard to help admin control their system users & employees it

Nov 22, 2022

Soft UI Dashboard React - Free Dashboard using React and Material UI

Soft UI Dashboard React - Free Dashboard using React and Material UI

Soft UI Dashboard React Start your Development with an Innovative Admin Template for Material-UI and React. If you like the look & feel of the hottest

Dec 28, 2022

Vue-crypto-dashboard - Cryptocurrency Dashboard made with Vue

Vue-crypto-dashboard - Cryptocurrency Dashboard made with Vue

Vue Crypto Dashboard A Cryptocurrency Dashboard build with Vue JS, PWA enabled, Binance Websocket API for realtime price, amChart for displaying histo

Dec 14, 2022

Dashboard skeleton Simple and fast dashboard skeleton template

Dashboard skeleton Simple and fast dashboard skeleton template. Installation npm install --save dashboard-skeleton-compostrap Version 1x built on Boo

Aug 23, 2022
Comments
  • [Question] Explanation of setStatus

    [Question] Explanation of setStatus

    Hello Sorry to bother you, Could you please explain a little bit about setStatus and it's usage? It's almost setStatus(null) most of places and only in login:

      useEffect(() => {
        const reset = query && query.reset ? query.reset as string : ''
        if (reset.length > 0 && errors.length === 0) {
          setStatus(atob(reset))
        } else {
          setStatus(null)
        }
      }, [query, errors])
    
    

    Many Thanks in advance

    opened by sinar93 0
Owner
ROKET ID
ROKET ID
NextJS, TypeScript and Styled Components project boilerplate

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mateus 2 Sep 21, 2021
Next Boilerplate was created to be a template for starting NextJS projects with pre-configured settings like Linters, Test Setup, Storybook and Commit Hooks.

Next Boilerplate was created to be a template for starting NextJS projects with pre-configured settings like Linters, Test Setup, Storybook and Commit Hooks.

Claudio Orlandi 4 Feb 22, 2022
NextJS Starter Example for Running Zesty.io CMS

Zesty.io + NextJS Getting Started Node and NPM need to be installed. From your command line.

Zesty.io 9 Dec 8, 2022
NextJS BoilerPlate for Alpha version(Next.js + Styled Components + Customization + Theme)

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Super Ninja 8 Oct 24, 2022
A starter for nextjs that pulls in tailwindui, graphql

NextJS TypeScript TailwindUI GraphQL Boilerplate Demonstrates a NextJS application with TypeScript and TailwindUI with a ASP.Net Core GraphQL based AP

RDA Corporation 5 Nov 17, 2022
基于vue3.0-ts-Element集成的简洁/实用后台模板!《带预览地址》vue-admin;vue+admin;vue-element;vue+element;vue后台管理;vue3.0-admin;vue3.0-element。

一、基于vue3.0+ts+Element通用后台admin模板 二、在线预览地址:http://admin.yknba.cn/ 三、下载使用: 1、克隆代码 通过git将代码克隆到本地;或者使用下载安装包模式进行下载。 2、进入目录 进入项目的根目录:vue3.0-ts-admin 3、安装依

null 64 Dec 16, 2022
Admin dashboard template built with tailwindcss & vue-jsx.

K UI Admin Dashboard Template (Vue 3 & JSX) ⚠️ This template is not finished yet and still in design phase. We are building it in public. Live preview

Kamona-UI 4 Aug 14, 2022
Free Bootstrap 5 Admin and Dashboard Template that comes with all essential dashboard components, elements, charts, graph and application pages. Download now for free and use with personal or commercial projects.

PlainAdmin - Free Bootstrap 5 Dashboard Template PlainAdmin is a free and open-source Bootstrap 5 admin and dashboard template that comes with - all e

PlainAdmin 238 Dec 31, 2022
A PHP Laravel web application that uses most of Laravel technologies to build that gym system

A PHP Laravel web application that uses most of Laravel technologies to build that gym system.The System is based on rules. Admin, City Manager, Gym Manager. All Crud operations running using data tables.

Ashraf Eldawody 9 Dec 29, 2022
This is a Laravel admin using Stisla as a template.

Getting Strated Installation Clone the repository https://github.com/syahdham/stisla-laravel-base.git or [email protected]:syahdham/stisla-laravel-base.

Idhamsyah 52 Dec 26, 2022