Skip to main content
Get the ServITech Backend API up and running in your local environment quickly.

Prerequisites

Before starting, ensure you have these installed:
  • PHP 8.2 or higher
  • Composer (PHP dependency manager)
  • Node.js and NPM (for frontend assets)
  • MySQL or SQLite (for the database)

Installation Steps

1

Install PHP and Composer

First, install PHP 8.4 and Composer using the appropriate command for your operating system:
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.4)"
After installation, restart your terminal for the changes to take effect.
2

Clone the repository

Clone the ServITech Backend repository and navigate to the project directory:
git clone https://github.com/MOSHE9647/ServITech-Backend.git
cd ServITech-Backend
3

Install dependencies

Install both PHP and Node.js dependencies:
composer install
npm install
This will install all required packages including:
  • Laravel 12 framework
  • JWT authentication (tymon/jwt-auth)
  • Scramble API documentation (dedoc/scramble)
  • Spatie Laravel Permission
4

Configure environment

Create your environment configuration file:
cp .env.example .env
By default, the API is configured to use SQLite for simplicity. To use MySQL instead, edit your .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=servitechdb
DB_USERNAME=root
DB_PASSWORD=
For development, SQLite is recommended as it requires no additional setup.
5

Generate application key

Generate the Laravel application encryption key:
php artisan key:generate
This command will set the APP_KEY value in your .env file automatically.
6

Generate JWT secret

Generate the JWT authentication secret:
php artisan jwt:secret
This will add the JWT secret to your .env file for token generation and validation.
7

Run database migrations

Set up the database schema by running migrations:
php artisan migrate
This creates all necessary tables for users, articles, categories, support requests, and repair requests.
8

Start the development server

Launch the development server with all services:
composer run dev
This command starts:
  • PHP development server on http://localhost:8000
  • Queue worker for background jobs
  • Vite development server for asset compilation
The server will automatically reload when you make changes to your code.

Verify Installation

Once the server is running, verify your installation:
  1. Check API health: Open your browser and navigate to:
    http://localhost:8000
    
  2. Access API documentation: View the auto-generated API documentation at:
    http://localhost:8000/docs/api
    
  3. Test authentication endpoint: Try the login endpoint:
    curl -X POST http://localhost:8000/api/auth/login \
      -H "Content-Type: application/json" \
      -d '{"email":"[email protected]","password":"password"}'
    
The API documentation is powered by Scramble and includes interactive examples for all endpoints.

What’s Next?

Installation Guide

Detailed installation instructions and troubleshooting

API Reference

Explore all available endpoints and examples

Authentication

Learn about JWT authentication flow

Environment Setup

Advanced configuration options

Common Issues

If you encounter errors during installation:
  • Port already in use: Change the port with php artisan serve --port=8080
  • Database connection failed: Verify your database credentials in .env
  • Permission denied: Ensure storage and cache directories are writable: chmod -R 775 storage bootstrap/cache

Build docs developers (and LLMs) love