manchenkoff / breeze-api

Laravel Breeze API template application based on Sail
MIT License
7 stars 3 forks source link
api authentication breeze docker laravel sail sanctum

Laravel Logo

Laravel Breeze API template

This repository is a template for Laravel projects based on Sail environment to integrate with the Sanctum authentication.

You can use this project to integrate with one of these frontend applications:

Prerequisites

To work with this project you will also need to install the following software:

Features

Installation

  1. Clone the repository:
git clone https://github.com/manchenkoff/breeze-api
  1. Build the project and install dependencies:
task build
  1. Start the project:
task start

Once the project is started, you can access it at http://localhost.

Development

To get more details about available commands in taskfile, run the following command:

task -a

To auto-format your code use task fmt command and also task lint to check the code quality by running Larastan checks.

Production

Environment

To make sure that Laravel Sanctum will work on your production instance, make sure that you defined properly the following environment variables:

APP_KEY=base64:your_key_here    # Generate a new key using `php artisan key:generate --show`
FRONTEND_URL=https://domain.com # Your frontend Nuxt application URL
SESSION_DOMAIN=.domain.com      # Your domain should start with a dot to support all subdomains like www.* or frontend.*

_💡 Keep in mind, that SESSION_DOMAIN is not applicable for localhost and should not be used during development with the value other than null._

Multiple apps

If you have multiple frontend applications (e.g. public and admin apps), you can define the SANCTUM_STATEFUL_DOMAINS environment variable to allow multiple domains to access the same session.

SANCTUM_STATEFUL_DOMAINS=domain.com,backoffice.domain.com,admin.domain.com