Skip to content

avosalmon/laravel-static-blog

Repository files navigation

It is great to build your site as a static site like JAMstack, however, you need to learn how to use static site generator such as Next.js or Gatsby.js as well as headless CMS.

If you are familiar with Laravel, you can build your Laravel app as a static site and deploy it to CDN like Netlify without writing a single line of JavaScript.

This repository is a sample blog app powered by Laravel which is deployed as a static site here.

Tech stack

Setup

Copy env file.

cp .env.example .env

Start docker containers.

$ sail up -d

Install dependencies.

$ sail composer install
$ sail npm install

Migrate database tables.

$ sail artisan migrate

By default, this app uses the s3 disk. So, add your AWS credentials as environment variables listed here.

If you want to use the public disk, create a symbolic link with the command below.

$ sail artisan storage:link

Build assets.

$ sail npm run dev

Now you can access the app at http://localhost. Admin panel is powered by Wink and accessible at http://localhost/wink.

Deploy the entire site as a static site to Netlify

You can export the entire site (excluding the admin panel) as a static site using spatie/laravel-export and deploy to Netlify. It's blazing fast and scalable 🚀.

In order to deploy your site to Netlify, you need to create a site on Netlify and add the NETLIFY_SITE_ID and NETLIFY_AUTH_TOKEN environment variables.

Once you've added thoese environment variables, run the command below.

$ sail artisan export

This command will build production assets, export the entire site into the dist folder, and then deploy the dist folder to Netlify. See config/export.php for more details.

About

A sample blog app powered by Laravel which is built as a static site and deployed to Netlify.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published