Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/manchenkoff/breeze-api

Laravel Breeze API template application based on Sail
https://github.com/manchenkoff/breeze-api

api authentication breeze docker laravel sail sanctum

Last synced: about 2 months ago
JSON representation

Laravel Breeze API template application based on Sail

Awesome Lists containing this project

README

        

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:

- [Breeze Next](https://github.com/laravel/breeze-next/) (React/Next)
- [Breeze Nuxt](https://github.com/manchenkoff/breeze-nuxt) (Vue/Nuxt)

## Prerequisites

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

- [Git](https://git-scm.com/)
- [Docker](https://docker.com/)
- [Taskfile](https://taskfile.dev/)

## Features

- Laravel 11
- Breeze API with Sanctum
- Laravel Pint code formatter
- Larastan static analysis rules
- IDE helper for Laravel (Stubs generation)

## Installation

1. Clone the repository:

```bash
git clone https://github.com/manchenkoff/breeze-api
```

2. Build the project and install dependencies:

```bash
task build
```

3. Start the project:

```bash
task start
```

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

## Development

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

```bash
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:

```dotenv
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.

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