Skip to main content
This guide walks you through setting up your local development environment to work with the ServITech Backend API.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js & NPM - Required for frontend asset compilation
  • Git - For version control
  • A code editor - VS Code, PHPStorm, or your preferred IDE
  • MySQL (optional) - If not using SQLite

Installing PHP and Composer

The ServITech Backend requires PHP 8.2 or higher and Composer for dependency management.
1

Install PHP and Composer

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

Verify Installation

Confirm PHP and Composer are installed correctly:
php --version
composer --version
You should see PHP 8.2+ and Composer version information.

Cloning 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

Environment Configuration

1

Create Environment File

Copy the example environment file:
cp .env.example .env
On Windows without cp, manually create a .env file and copy the contents from .env.example.
2

Generate Application Key

Generate the Laravel application encryption key:
php artisan key:generate
This automatically updates the APP_KEY in your .env file.
3

Generate JWT Secret

Generate the JWT authentication secret:
php artisan jwt:secret
This adds the JWT_SECRET to your .env file for token-based authentication.

Database Configuration

The application supports both SQLite (default) and MySQL.

Key Environment Variables

Here are the most important variables to configure in your .env file:

Application Settings

.env
APP_NAME=ServITech
APP_VERSION=1.0.0
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000

APP_LOCALE=es
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=es_ES

Performance Settings

.env
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
  • PHP_CLI_SERVER_WORKERS - Number of worker processes for the development server
  • BCRYPT_ROUNDS - Password hashing cost (higher = more secure but slower)

Session Configuration

.env
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false

Queue and Cache

.env
QUEUE_CONNECTION=database
CACHE_STORE=database

Mail Configuration

.env
MAIL_MAILER=log
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
In development, emails are logged to storage/logs/laravel.log by default. Configure SMTP settings for production.

API Documentation

.env
SCRAMBLE_API_ROUTE=/docs/api
This configures the route where Scramble-generated API documentation will be available.

Installing Dependencies

Install both PHP and Node.js dependencies:
composer install
npm install
If composer install fails, try running composer update to resolve dependency conflicts.

Troubleshooting

PHP Extension Missing

Error: extension not found Solution: Install required PHP extensions:
sudo apt-get install php8.2-xml php8.2-mbstring php8.2-curl php8.2-mysql php8.2-sqlite3

Composer Memory Limit

Error: Allowed memory size exhausted Solution: Increase PHP memory limit:
php -d memory_limit=-1 $(which composer) install

Permission Issues (Linux/macOS)

Error: Permission denied when writing to storage/logs Solution: Set proper permissions:
chmod -R 775 storage bootstrap/cache
chown -R $USER:www-data storage bootstrap/cache

Node.js Version Issues

Error: Unsupported Node.js version Solution: Use a Node version manager (nvm):
# Install nvm (if not installed)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Install and use LTS version
nvm install --lts
nvm use --lts

Next Steps

Running Locally

Start the development server and all required services

Database Migrations

Set up your database schema and seed test data

Additional Resources

Build docs developers (and LLMs) love