Skip to content
A Laravel-Nuxt starter project template.
Branch: master
Clone or download
Latest commit 22f5f74 May 10, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Update Laravel May 10, 2018
bootstrap Init Jan 9, 2018
client Move function May 10, 2018
config Update Laravel May 10, 2018
database Init Jan 9, 2018
public Init Jan 9, 2018
resources Handle exception Jan 10, 2018
routes Add option to disable SSR Jan 10, 2018
storage Init Jan 9, 2018
tests Apply fixes from StyleCI Jan 10, 2018
.editorconfig Init Jan 9, 2018
.env.example Add jwt ttl May 10, 2018
.eslintrc Update deps May 10, 2018
.gitattributes Update readme Jan 10, 2018
.gitignore Add option to disable SSR Jan 10, 2018
.travis.yml Remove php7 May 10, 2018
CHANGELOG.md Add release notes May 10, 2018
LICENSE Init Jan 9, 2018
README.md Update README.md May 10, 2018
artisan Init Jan 9, 2018
composer.json Update Laravel May 10, 2018
composer.lock Update Laravel May 10, 2018
package.json Update deps May 10, 2018
phpunit.xml Add jwt secret Jan 10, 2018
server.php Init Jan 9, 2018
yarn.lock Update deps May 10, 2018

README.md

Laravel-Nuxt

Build Status Total Downloads Latest Stable Version

A Laravel-Nuxt starter project template.

Features

  • Laravel 5.6
  • Nuxt 1.4
  • VueI18n
  • SSR or SPA
  • Authentication with JWT
  • Socialite integration
  • Bootstrap 4 + Font Awesome 5
  • Login, register, password reset and profile pages

Installation

  • composer create-project --prefer-dist cretueusebiu/laravel-nuxt
  • Edit .env to set your database connection details and APP_URL (the url to your Laravel application)
  • (When installed via git clone or download, run php artisan key:generate and php artisan jwt:secret)
  • php artisan migrate
  • yarn / npm install

Usage

Development

npm run dev

Production with SSR

npm run build
npm run start

Nginx Proxy

For Nginx you can add a proxy using the follwing location block:

server {
    location / {
        proxy_pass http://HOST:PORT;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Where HOST is the ip address of your server and PORT is the port you're running the application (3000 by default).

Process Manager

In production you need a process manager to keep the Node server alive forever:

# install pm2 process manager
npm install -g pm2

# startup script
pm2 startup

# start process
pm2 start npm --name "laravel-nuxt" -- run start

# save process list
pm2 save

# list all processes
pm2 l

After each deploy you'll need to restart the process:

pm2 restart laravel-nuxt 

Production without SSR

If you don't want server side rendering you can use the mode option:

  • Uncomment mode: 'spa' and '~plugins/nuxt-client-init' in client/nuxt.config.js
  • Uncomment // ->prefix('api') in app/Providers/RouteServiceProvider.php
  • Set APP_URL=http://example.com/api and CLIENT_URL=http://example.com in your .env
  • Run npm run build

Make sure to read the Nuxt docs.

Notes

  • This project uses router-module, so you have to add the routes manually in client/router.js.
  • If you want to separate this in two projects (client and server api), move package.json into client/ and remove config path option from the scripts section. Also make sure to add the env variables in client/.env.

Changelog

Please see CHANGELOG for more information what has changed recently.

You can’t perform that action at this time.