Skip to content
/ jx Public

An opinionated application starter kit built on NextJS tailored for Laravel's Sanctum API.

Notifications You must be signed in to change notification settings

jstnmthw/jx

Repository files navigation

Jx - Starter kit for NextJS apps.

ts ts

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.

Features

  • Laravel Sanctum compatible
  • Authentication
  • Roles & Permissions
  • Data Tables
  • Dark Mode
  • SWR Requests

Packages Included

The following are preinstalled and ready out of the box for quick application scaffolding.

Getting Started

Create an .env file and place your API url.

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000

Development

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.

Production

Build and run your NextJS app.

npm run build && npm run start

TypeScript

Strict mode is set by default.

npm run type-check
# or
npm run tc

Documentation

User Model

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"
    }
  ]
}

About

An opinionated application starter kit built on NextJS tailored for Laravel's Sanctum API.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published