The API of Nuxt3 SSR Example with Authorization

The web app is here. Online demo is here.

Features

  • Auth via Laravel Sanctum
  • Laravel Socialite (github)
  • 100% test coverage

Installation

composer install
cp .env.example .env
php artisan key:generate
php artisan migrate

Deploy

Don't forget to add the Nuxt3 Front-end Server IPs to TRUSTED_PROXIES in .env

Nginx config

# before (Laravel default configs)
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

# after
proxy_set_header X-Forwarded-For-Nuxt $remote_addr;
location ~* ^/(api|broadcasting|storage)/ {
    try_files $uri $uri/ /index.php?$query_string;
}
location / {
    proxy_pass http://127.0.0.1:3000; # Nuxt3 Front-end Server
}