This project is a basic Laravel API backend configured for local development with Laravel Herd. It is intended to be used alongside a frontend hosted on a sibling subdomain of the same top-level domain.
- Backend (this app):
http://skeleton-api.test - Frontend:
http://applicatie.skeleton-api.test:3000 - Top-level Domain:
skeleton-api.test
Both apps are served locally via Herd using .test domains.
(ssh)
git clone git@bitbucket.org:encore-nl/skeleton-api.gitcomposer installcp .env.example .envUpdate the following variables in .env to reflect your subdomain setup:
APP_ENV=local
DB_DATABASE=skeleton
DB_USERNAME=...
DB_PASSWORD=...
# CORS
FRONTEND_URL=http://applicatie.skeleton-api.test:3000
# This value determines the domain and subdomains the session cookie is available to
SESSION_DOMAIN=skeleton-api.test
# Requests from the following domains / hosts will receive stateful API authentication cookies.
SANCTUM_STATEFUL_DOMAINS=applicatie.skeleton-api.test:3000| Variable | Description |
|---|---|
FRONTEND_URL |
Full URL to your frontend subdomain. Used in CORS and redirects. |
SESSION_DOMAIN |
Shared domain for Laravel cookies. |
SANCTUM_STATEFUL_DOMAINS |
List of frontend domains allowed to make stateful API requests (used by Sanctum for cookie-based auth). |
php artisan key:generatephp artisan migratephp artisan test| Issue | Fix |
|---|---|
| CORS errors | Double-check FRONTEND_URL and config/cors.php |
| CSRF mismatch | Ensure frontend sends X-XSRF-TOKEN and fetches sanctum/csrf-cookie first |
| Session not persisting | Verify SESSION_DOMAIN and cookies |
| 401 Unauthorized | Check Sanctum stateful domains and credentials headers |
php artisan route:list # List all API routes
php artisan migrate:fresh # Reset and re-run all migrations
php artisan db:seed # Seed the database
php artisan tinker # Interactively test application logicBelow is a table with processes that should run. Make sure to configure these in K8s.
| Command | .env key | Interval | Enviroment |
|---|