Skip to content

Latest commit

 

History

History
299 lines (242 loc) · 10.1 KB

README.md

File metadata and controls

299 lines (242 loc) · 10.1 KB

Laravel Logo

Build Status MIT

LaraNext

Table of Contents

About LaraNext - The React+ShadCN-UI Starter Kit

Laranext is a React+Shadcn starter kit for building Laravel applications. It merges the ideas portrayed in the Laravel Inertia.js, React Inertia, and Nextjs projects into a single starter kit.

This kit is designed to be a lightweight and easy-to-use solution for building beautiful, modern, fast, robust and responsive web applications with Laravel and React.

Want a vuejs version? We've got a Kick-Starter Campaign over at Kofi to help with a few development costs.

Features

  • CI-CD via Github Actions
  • ShadCN-UI React Library
  • Laravel 11 + Postgre (Neon)
  • React 18 + zustand
  • Social Login
  • Live-Chat
  • SEO mgmt
  • Admin Dashboard
  • Server Load Info + Application monitoring

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

Getting Started

Prerequisites

  • PHP 8.3+
  • Node.js 20+
  • Composer 2
  • Postgres

For testing purposes, you may also use sqlite. But we highly encourage Postgres.

Neon DB is a serverless platform designed to help you build reliable and scalable applications faster using Postgres.

Installation

  1. Clone the repository into your Sites directory
git clone https://github.com/syntaxlexx/laranext.git
  1. Copy the .env.example file to .env and update the values accordingly.
cp .env.example .env
  1. Install the dependencies (both for PHP and Node.js)
composer install
pnpm install
  1. Generate the application key
php artisan key:generate
  1. Run the database migrations
php artisan migrate
  1. Seed the database
php artisan db:seed
  1. Refresh IDE metadata files and generate typescript types
composer ide-helper
composer generate-types
  1. Start the development server
npm run dev
  1. Visit the application at http://laranext.test

    • If you prefer to serve the application, you can run the following command:
php artisan serve

Remember to update the .env file with the correct URL values.

Running tests

The starter-kit uses Pest for testing.

php artisan test

# run tests in parallel
php artisan test --parallel

Developer Notes

Todo List

  • Landing page
  • Demo pages for layout stuff
  • Models -> typescript generator
  • Blog
  • Post + Comments
  • Live-chat - Laravel Reverb + Echo
  • Auth pages
    • Login
    • Register
    • Reset password
    • Social Login
  • Admin
    • Dashboard
    • Posts mgmt
    • Comments mgmt
    • Users mgmt
    • Profile mgmt
    • Settings - Update .env
    • Settings - Update SEO metadata
    • Server info - Laravel Pulse
  • Dashboard for Users
    • Liked Posts
    • Bookmarks
    • Posts mgmt
    • Comments
    • Profile mgmt

Common Configuration files + Scripts

Supervisor

Install supervisor to automatically manage your background processes

sudo nano /etc/supervisor/conf.d/laranext-worker.conf

Update script

[program:laranext-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/laranext/artisan queue:work redis --queue=laranext --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=sudouser
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/laranext/storage/logs/worker.log
stopwaitsecs=3600

Supervisor management

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start "laranext-worker:*"
sudo supervisorctl status

Laravel Pulse

Laravel Pulse is excellent in monitoring background processes. Remember to use the Redis driver.

sudo nano /etc/supervisor/conf.d/laranext-pulse.conf

Update Script

[program:laranext-pulse]
process_name=%(program_name)s
command=php /var/www/laranext/artisan pulse:work
autostart=true
autorestart=true
user=sudouser
redirect_stderr=true
stdout_logfile=/var/www/laranext/storage/logs/pulse.log
stopwaitsecs=3600

Then remember to run:

sudo supervisorctl reread
sudo supervisorctl update
supervisorctl start laranext-pulse
sudo supervisorctl status

Laravel Reverb

Laravel Reverb is a first-party WebSocket server for Laravel applications, bringing real-time communication between client and server directly to your fingertips.

Ensure you set the REVERB_* values accordingly in your .env file.

Read More on it here on how to get started.

Laravel Horizon

Laravel Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues.

Ensure you set the QUEUE_CONNECTION as redis in your .env file.

Scheduler

Auto-run commands. The commands are run in a cronjob

crontab -e

Enter the following script

# Scheduler
* * * * * cd /var/www/laranext && php artisan schedule:run >> /dev/null 2>&1

Slack Notifications

Create a Slack App here Bot Scopes required

  • incoming webhooks
  • chat:write
  • channels:read
  • groups:read

Also remember to go to the slack itself, create a bot-github channel, and run this command from chat /install Select the app to install

Common Laravel Commands

  • php artisan about -> view info about your app
  • php artisan schedule:list -> view scheduled commands
  • php artisan horizon:clear -> delete all jobs from your application's default queue
  • php artisan horizon:clear --queue=emails -> delete all jobs from specific queue
  • php artisan scout:flush "App\Models\Todo" -> delete all scout indexed data
  • php artisan scout:import "App\Models\Todo" -> recreate all scout data
php artisan scout:flush "App\Models\Todo" && php artisan scout:import "App\Models\Todo"

Contributing

Thank you for considering contributing to the Laranext Starter Kit! We welcome contributions from the community.

Credits

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to SyntaxLexx via [email protected]. All security vulnerabilities will be promptly addressed.

License

  • The Laravel framework is open-sourced software licensed under the MIT license.

  • The LaraNext Starter Kit is open-sourced software licensed under the MIT license.