Backend Setup - shibotsu/obs-clone GitHub Wiki

Backend Setup

Requirements

  • PHP 8+
  • Laravel
  • SQLite
  • DBeaver
  • Laravel Sanctum
  • JWT dependency
  • Git
  • Composer
  • XAMPP or Herd

Installation

Before installing Laravel project, first you need to clone the github repository. After that you need to fetch all branches from repository, and make one local branch that will track remote backend branch. When you are on the backend branch pull all the changes from github.

git clone https://github.com/shibotsu/obs-clone.git
git fetch --all
git checkout -b backend origin/backend
git pull

Setting up Laravel project

Setting up Laravel project isn't hard and here are the few steps to follow. First you need to be in correct directory to run these commands, so be sure that you are in your project's directory and then run following commands in your terminal.

composer install
cp .env.example .env
php artisan key:generate
php artisan migrate

After creating the database.sqlite file, go to DBeaver and make a new database connection and put there the path to your database.sqlite. When the new connection is made, it will automatically set up important variables in your .env file. If you have done everything correctly, and composer installed everything you should have Laravel Sanctum and JWT dependencies automatically installed. The last step is to set up a secret key for JWT and to make storage links and then you can finally run the server for this Laravel project.

php artisan storage:link
php artisan jwt:secret
php artisan serve

Common issues

If you are following these steps there shouldn't be any issues, but there can be issues with running the server. You can get error which looks like this.

Failed to listen on 127.0.0.1:8000 (reason: ?)

If you get this error, you need to find php.ini file on your app for hosting and change variables_order to "GPCS".

variables_order = "GPCS"

For more information you can visit: https://stackoverflow.com/questions/78583889/php-artisan-serve-failed-to-listen-on-127-0-0-18000-reason. If you have any more problems with setting up the project you should visit Laravel documentation: https://laravel.com/docs/12.x.