A Laravel-Nuxt styled with TailwindCSS starter project template.
Inspired in cretueusebiu/laravel-nuxt
- Laravel 6
- Authentication with JWT
- Nuxt 2.10
- TailwindCSS
- VueTailwind Components
- VueI18n
- SSR or SPA
- Authentication with JWT
- Socialite integration
- Login, register, password reset and profile pages
git clone [email protected]:alfonsobries/laravel-nuxt-tailwind.git <name-of-your-project>
- Edit
.env
to set your database connection details - Install dependencies
composer update
andnpm install
(oryarn install
) - run
php artisan key:generate
andphp artisan jwt:secret
php artisan migrate
npm run dev
npm run build
npm run start
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).
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
If you don't want server side rendering you can use the mode option:
- Uncomment
mode: 'spa'
and'~plugins/nuxt-client-init'
inclient/nuxt.config.js
- Uncomment
// ->prefix('api')
inapp/Providers/RouteServiceProvider.php
- Set
APP_URL=http://example.com/api
andCLIENT_URL=http://example.com
in your.env
- Run
npm run build
Make sure to read the Nuxt docs.
- 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
intoclient/
and remove config path option from the scripts section. Also make sure to add the env variables inclient/.env
.
Please see CHANGELOG for more information what has changed recently.