Prerequisites
Before running the application locally, ensure you have:✓ Completed the Environment Setup
✓ Installed all PHP and Node.js dependencies
✓ Configured your
.env file with database credentials✓ Run database migrations (see Database Migrations)
Starting the Development Server
The ServITech Backend uses a convenient Composer script that starts all necessary services concurrently.Quick Start
- Laravel Development Server - PHP application server on
http://localhost:8000 - Queue Worker - Processes background jobs from the database queue
- Vite Dev Server - Hot module replacement for frontend assets
The development server runs on port 8000 by default. Access the API at
http://localhost:8000.Service Details
PHP Artisan Serve
Runs the Laravel development server:- Host:
127.0.0.1 - Port:
8000 - Workers:
4(configured viaPHP_CLI_SERVER_WORKERSin.env)
Queue Worker
Processes background jobs such as sending emails or processing large tasks:- Connection:
database(jobs stored in thejobstable) - Max Tries:
1- Jobs fail after one attempt - Timeout: Default Laravel timeout applies
Vite Development Server
Compiles and hot-reloads frontend assets:Running Services Individually
If you need to run services separately (for debugging or resource constraints):- Server Only
- Server + Queue
- All Services (Manual)
http://localhost:8000Accessing the Application
Once the server is running, you can access:API Endpoints
/api by convention.
API Documentation
Interactive API documentation powered by Scramble:The documentation route is configured via
SCRAMBLE_API_ROUTE in your .env file.- All available endpoints organized by resource
- Request/response examples
- Authentication requirements
- Validation rules
Key API Sections
- Authentication -
/api/auth/*- Login, register, password reset - Users -
/api/user/*- User profile management - Articles -
/api/articles/*- Technology and anime product management - Categories -
/api/categories/*- Product category management - Support Requests -
/api/support/*- Technical support ticket system - Repair Requests -
/api/repairs/*- Device repair management (admin)
Seeding the Database
For development and testing, seed the database with sample data:DatabaseSeeder.php:
- UserSeeder - Creates test users with different roles
- CategorySeeder - Adds product categories
- SubcategorySeeder - Adds product subcategories
- ArticleSeeder - Generates sample products
Fresh Migration with Seed
Reset the database and seed in one command:Development Workflow
A typical development workflow:Test Changes
- Use the API documentation at
/docs/apito test endpoints - Or use tools like Postman, Insomnia, or cURL
Stopping the Server
To stop all services started bycomposer run dev:
- Press
Ctrl+Cin the terminal - This gracefully shuts down all three services
Troubleshooting
Port Already in Use
Error:Address already in use
Solution: Kill the existing process or use a different port:
Queue Jobs Not Processing
Issue: Background jobs remain injobs table
Solution: Ensure the queue worker is running:
Changes Not Reflecting
Issue: Code changes don’t appear in the browser Solution: Clear Laravel’s cache:Database Connection Failed
Error:SQLSTATE[HY000] [2002] Connection refused
Solution for SQLite:
Storage Permission Denied
Error:The stream or file "storage/logs/laravel.log" could not be opened
Solution (Linux/macOS):
JWT Secret Missing
Error:The JWT secret is not set
Solution:
Environment-Specific Configuration
Local Development
.env
Performance Testing
.env
Next Steps
Database Migrations
Learn about managing database schema and seeders
Testing
Write and run tests for your API endpoints