Giter VIP home page Giter VIP logo

laravel-vite's Introduction

Laravel Vite

Combine the power of Laravel and Vite alongside Vue 3 and Tailwind CSS.

Application Stack

  • PHP 8.1
  • MySQL 8.0
  • Laravel 9.x
  • Vite 2
  • Vue 3
  • Tailwind CSS 3

Setup Dev Environment

We will be running Laravel in a Docker development environment using Laravel Sail. Although running PHP directly on your computer (host) is not a requirement, we still need it to install Sail for the first time.

If you're on macOS, you can install PHP using Homebrew:

brew install php

Clone this repo:

git clone [email protected]:mislam/laravel-vite.git my-awesome-project
cd my-awesome-project

Install Sail:

composer require laravel/sail --dev

Add a new line in your ~/.bashrc or ~/.bash_profile to create an alias (shortcut) to the sail command :

alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'

Make a copy of the local .env file and generate encryption key:

cp .env.local.example .env
php artisan key:generate

Start all of the Docker containers defined in docker-compose.yml:

sail up -d

Run database migrations:

sail php artisan migrate

Install NPM dependencies and run Vite's dev server:

npm install
npm run dev

Now head over to your browser and open http://localhost.

Deployment

VPS Server

You can use Laravel Forge to deploy the application on a VPS server, such as: DigitalOcean Droplets or Amazon EC2.

Cloud

If you have scalibility in mind, go with Laravel Vapor. It uses AWS Lambda to deploy and auto-scale in a serverless platform.

Front-End Assets

Run the deploy script on production environment:

npm run deploy

This will store production-ready assets inside public/dist directory. If you want to fine-tune this process, you can create a script to publish the assets to Amazon S3 or DigitalOcean Spaces, and serve them via CDN, such as: CloudFlare or Amazon CloudFront.

Extra

Generate Favicons

If you ever need to update the favicon, save it as artworks/favicon/master.png with a resolution of 1024x1024 pixel, and run:

npm run favicon:generate

This will generate new favicon assets under resources/favicon.

laravel-vite's People

Contributors

mislam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.