This repository contains a Laravel 10 with JWT authentication boilerplate using the tymon/jwt-auth package, inspired by the Laravel Breeze package (API stack).
We created a dedicated frontend using Next.js, Tailwind CSS and NextAuth. You can find the repository here.
- JWT authentication (login, register, password reset, email verification)
- Profile updating
- Password changing
- Tests (using Pest)
- Laravel Telescope (disabled by default)
Note: the application does not have a
package.json
since this project purely a REST API that will not use any JavaScript or asset builders such as Vite.
cp .env .env.example
composer install
php artisan jwt:secret
(generate a secret key that will be used to sign your tokens)php artisan migrate:fresh --seed
In order to authenticate, you have to log in using valid credentials. User data and an access token will be returned. You can use this access token to do subsequent requests to the API.
The access token has a TTL of 1 hour until it expires. The access token should be refreshed within this time window to avoid becoming unauthenticated.
The access token can be refreshed for two weeks. After that, the user has to log in again.
This boilerplate comes with Laravel Telescope installed. You can access the
Telescope dashboard at the /telescope
URL (prefixed with your local URL).
This boilerplate comes with Pest as its testing framework. In order to run the tests,
run ./vendor/bin/pest
.
Feel free to open a pull request if you want to contribute to this project. All contributions / suggestions are welcome ✨
This project is open-sourced software licensed under the MIT license.