An opinionated application starter kit to built on NextJS tailored to Laravel Sanctum API. The authentication is mainly focused on using Laravel's backend API which utilizes CRSF token for secure authentication and sessions.
- Laravel Sanctum compatible
- Authentication
- Roles & Permissions
- Data Tables
- Dark Mode
- SWR Requests
The following are preinstalled and ready out of the box for quick application scaffolding.
Create an .env
file and place your API url.
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
First, 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.
Build and run your NextJS app.
npm run build && npm run start
Strict mode is set by default.
npm run type-check
# or
npm run tc
In order for authentication to work out of the box, some assumptions need to be made. The following is how we assume your User model is set up. Jx checks for the role Admin
behind the scenes and is what is checked for /admin/
dashboard.
{
"id": 1,
"name": "Justin",
"email": "hello@example.com",
"avatar": "https://www.gravatar.com/avatar/xx?d=blank",
"enabled": true,
"email_verified": true,
"created_at": "2022-01-01T00:00:00.000000Z",
"roles": [
{
"id": 1,
"name": "User"
},
{
"id": 2,
"name": "Admin"
}
]
}