Skip to content

Backend installation (Laravel)

The backend is a Laravel 13 API-only application. The document root for the web server is the public/ folder.

Step 1 — Upload or clone files

Place the backend folder on your server, e.g. /var/www/exchangepro-api.

Do not expose the project root directly; point the vhost to backend/public.

Step 2 — Install Composer dependencies

bash
cd /path/to/backend
composer install --no-dev --optimize-autoloader

For local development, omit --no-dev.

Step 3 — Environment file

bash
cp .env.example .env
php artisan key:generate

Edit .env — minimum variables:

ini
APP_NAME=ExchangePro
APP_ENV=production
APP_DEBUG=false
APP_URL=https://api.yourdomain.com

FRONTEND_URL=https://yourdomain.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=exchangepro
DB_USERNAME=your_user
DB_PASSWORD=your_password

SESSION_DRIVER=database
QUEUE_CONNECTION=database
CACHE_STORE=database

MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"

See Environment variables for full reference.

Step 4 — Database

Create an empty MySQL database, then:

bash
php artisan migrate --force

Optional demo users (local / preview only):

bash
php artisan db:seed

See Database setup → Demo accounts and backend/DEMO_CREDENTIALS.txt.

Optional: SQLite for local testing only — set DB_CONNECTION=sqlite and create database/database.sqlite.

Details: Database setup.

bash
php artisan storage:link

Uploaded assets in this project primarily use public/images/ and public/transaction-proofs/ created at runtime.

Step 6 — Permissions

bash
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache

Step 7 — Run locally (development)

bash
php artisan serve --host=0.0.0.0 --port=8000

API base: http://127.0.0.1:8000/api

Optional dev processes

The composer.json dev script can run server, queue, logs, and Vite together — for API-only backend you typically only need:

bash
php artisan serve
php artisan queue:listen   # if processing queued mail/jobs

Step 8 — Configure CORS & Sanctum

Before testing login from the frontend:

  1. Set FRONTEND_URL in .env (default CORS origin). Add CORS_ALLOWED_ORIGINS if you need multiple origins.
  2. Set SANCTUM_STATEFUL_DOMAINS in .env.

Full guide →

Step 9 — Verify API

bash
curl -s https://api.yourdomain.com/api/

Expected JSON:

json
{ "message": "ExchangePro API", "status": "ok" }

Health check (Laravel 11+):

bash
curl -s https://api.yourdomain.com/up

OAuth callback URLs

When enabling social login, register these redirect URIs with Google/Facebook:

text
{APP_URL}/api/auth/google/callback
{APP_URL}/api/auth/facebook/callback

Example: https://api.yourdomain.com/api/auth/google/callback

Production web server

Point Nginx/Apache to public/index.php. Example Nginx fragment:

nginx
root /var/www/exchangepro-api/public;
index index.php;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
}

Full deployment: Deployment.

Next step

Install the Nuxt frontend.

Need help? support@xorinlab.com · Website: xorinlab.com