Local Development Setup
Set up a complete local development environment for Viax using Laragon, which provides Apache, MySQL, and PHP in a single package.This guide focuses on Windows with Laragon. For macOS/Linux, use MAMP, XAMPP, or manual Apache/MySQL setup.
Why Local Development?
Faster Development
No network latency, instant response times for API calls
Offline Work
Develop without internet connection
Safe Testing
Test destructive operations without affecting production data
Full Control
Complete access to database, logs, and server configuration
Step 1: Install Laragon
Download Laragon
Visit Laragon Website
Go to laragon.org
Download Full Version
Download Laragon Full (includes Apache, MySQL, PHP, Redis, Memcached)File size: ~150 MB
Start Laragon
Start Services
Click “Start All” button (bottom-left)Services that will start:
- Apache (port 80)
- MySQL (port 3306)
Step 2: Set Up Backend
Copy Backend Files
- Using PowerShell
- Manual Copy
Verify Backend URL
Open browser and test:Step 3: Set Up Database
Create Database
- HeidiSQL (Recommended)
- phpMyAdmin
- Command Line
HeidiSQL is included with Laragon.
Import Database Schema
Locate SQL File
Find the database file in your Viax project:
basededatos.sqlorbasededatosfinal.sql
Import in HeidiSQL
- Select
viaxdatabase in left panel - File > Load SQL file
- Select your
.sqlfile - Click “Execute” (F9)
- Wait for import to complete
Configure Database Connection
File:C:\laragon\www\viax\backend\config\database.php
Laragon’s default MySQL password is
root. Some installations use empty password ''.Step 4: Install PHP Dependencies
Install Composer (if not included)
Laragon usually includes Composer. Verify:- Laragon > Menu > Tools > Quick add > Composer
- Or download from getcomposer.org
Install Backend Dependencies
- PHPMailer (email sending)
- JWT library (future authentication)
- Other PHP dependencies
Step 5: Configure Flutter for Local Backend
For Android Emulator
Android emulator mapslocalhost to 10.0.2.2:
For Physical Android Device
For iOS Simulator
iOS Simulator can uselocalhost:
Permanent Configuration (Development)
Edit.vscode/launch.json:
Step 6: Test the Setup
Test Backend Endpoints
- Health Check
- System Verification
- Test Login Endpoint
Test from Flutter App
Test Registration
- Open the app
- Tap “Crear cuenta” (Create account)
- Fill in registration form
- Submit
Development Workflow
Daily Workflow
Monitor Logs
- Flutter logs: In terminal where app is running
- Backend logs:
C:\laragon\www\viax\backend\logs\ - Apache logs:
C:\laragon\bin\apache\apache-X.X.X\logs\ - MySQL logs: Laragon > Menu > MySQL > Log file
Database Development
View Live Data:Backend Development
Enable Error Display: Add to top of PHP files during development:Troubleshooting
Laragon won't start
Laragon won't start
Port conflicts:
-
Check if port 80 is in use:
-
Stop conflicting service:
- Skype (uses port 80)
- IIS (Windows web server)
- Other web servers
-
Or change Apache port:
- Laragon > Menu > Apache > httpd.conf
- Change
Listen 80toListen 8080 - Restart Laragon
- Use
http://localhost:8080/viax/backend
Database connection failed
Database connection failed
Solutions:
- Verify MySQL is running (green icon in Laragon)
-
Check credentials:
-
Test connection manually:
-
Check database exists:
404 Not Found on backend URLs
404 Not Found on backend URLs
Check:
- Files are in correct location:
- Should be:
C:\laragon\www\viax\backend\ - Not:
C:\laragon\www\backend\
- Should be:
- Verify URL path:
- Correct:
http://localhost/viax/backend/health.php - Wrong:
http://localhost/backend/health.php
- Correct:
- Check file permissions (should auto-set by Laragon)
Composer not found
Composer not found
Install Composer:
- Laragon > Menu > Tools > Quick add > Composer
- Restart Laragon
- Verify:
composer --version
Flutter can't connect from emulator
Flutter can't connect from emulator
Android Emulator:
- Must use
10.0.2.2notlocalhost - Verify with:
- Must be on same WiFi network
- Use computer’s IP (not localhost)
- Disable Windows Firewall temporarily to test
Email sending not working
Email sending not working
PHPMailer Configuration:For local development, configure SMTP in backend:Or use Mailtrap.io for testing emails.
Advanced Configuration
Enable PHP Extensions
Virtual Hosts (Optional)
Create a pretty URL likeviax.local:
Performance Tips
Increase PHP Memory
In
php.ini:Enable OpCache
In
php.ini:MySQL Optimization
In HeidiSQL, run:
Disable Xdebug
Comment out in
php.ini:Useful Laragon Commands
Local Development Ready! You now have a complete local environment for Viax development with hot reload, database access, and full debugging capabilities.