Skip to content

Local Setup ​

Overview ​

This page collects what the repository itself says about running the Backend-API: the README, composer.json, package.json, phpunit.xml, .env.example and the config files. The README is short (clone, composer install, edit config, php artisan serve), so the steps below fill in the artisan commands the code depends on, such as Passport keys, the queue worker and the scheduler.

Requirements ​

RequirementSource
PHP ^8.2.0composer.json
Composercomposer.json
MySQLDB_CONNECTION in .env.example; queue, Passport and failed jobs use the MySQL connections mysql_queue and mysql_primary
Node and npm (only for the Laravel Mix assets)package.json, webpack.mix.js
Typesense (search)config/scout.php, HealthController
ffmpeg / ffprobeconfig/video-thumbnail.php (FFMPEG, FFPROBE)
Redis (optional)Only if CACHE_DRIVER, QUEUE_CONNECTION or BROADCAST_DRIVER is set to redis

Steps ​

1. Install dependencies ​

bash
git clone https://github.com/Collage-Inc/Backend-API.git
cd Backend-API
composer install

composer.json scripts that run automatically:

ScriptRuns
post-autoload-dumpIlluminate\Foundation\ComposerScripts::postAutoloadDump, then php artisan package:discover --ansi
post-update-cmdphp artisan vendor:publish --tag=laravel-assets --ansi --force
post-root-package-installCopies .env.example to .env if .env does not exist
post-create-project-cmdphp artisan key:generate --ansi

2. Create .env ​

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

Fill in the variables listed under Environment variables. Never commit .env; it is in .gitignore.

3. Database ​

bash
php artisan migrate
php artisan db:seed

There are 153 migrations in database/migrations. DatabaseSeeder calls, in order: RoleSeeder, CreateSuperUser, CreateSupportUser, ModulesSeeder, PermissionsSeeder, TimezoneGroupSeeder, TimezoneSeeder, DamNotificationGroupSeeder, DamNotificationSeeder, DamUserNotificationSeeder, DamSubscriptionPlanSeeder. DamSubscriptionAddonSeeder exists but is not called by DatabaseSeeder.

4. Passport ​

Every login calls $user->createToken(...) (personal access tokens) and the api, dam-api, external-api and external-user guards all use the passport driver, so Passport needs its key pair and a personal access client:

bash
php artisan passport:keys
php artisan passport:client --personal

Authenticate expects the public key at storage/oauth-public.key (/storage/*.key is git-ignored). Keys can also be supplied through PASSPORT_PRIVATE_KEY / PASSPORT_PUBLIC_KEY, and the personal client through PASSPORT_PERSONAL_ACCESS_CLIENT_ID / PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET (config/passport.php). Passport tables live on PASSPORT_CONNECTION (default mysql_primary).

5. Storage ​

bash
php artisan storage:link

Several local disks write under public/upload/ (uploads, dealerships, leads, DamAssetOrder, DamDeleteImages, Inquiry, downloadAsset), which is git-ignored, so make sure that folder exists and is writable. BigQuery log spool files go to storage/app/bigquery-spool. SAML SP keys, if used, go to storage/keys/saml/ (see config/saml.php).

6. Search index ​

Scout settings are in config/scout.php (driver from SCOUT_DRIVER, Typesense client from TYPESENSE_*). To build or repair the index:

bash
php artisan scout:import-all
php artisan typesense:smart-sync --hours=24

typesense:smart-sync also accepts --workspace=, --chunk= and --dry-run. See Search.

7. Run the app ​

bash
php artisan serve

Check GET /health; it reports database, search, queue, worker, storage and cache.

8. Queue workers ​

With QUEUE_CONNECTION=sync jobs run inline. With database, run workers for the queue names the code dispatches to (high, medium, low, video-previews, default):

bash
php artisan queue:work --queue=high,medium,default,low,video-previews

The import pipeline uses its own connection; DispatchAssetJobs prints this worker command:

bash
php artisan queue:work database_migration --queue=migration --tries=1 --timeout=7200 --memory=10240

9. Scheduler ​

The schedule is in App\Console\Kernel::schedule() (see Architecture). Run it locally with:

bash
php artisan schedule:work

10. Frontend assets (optional) ​

package.json uses Laravel Mix to build resources/js/app.js and resources/css/app.css into public/:

ScriptCommand
dev / developmentmix
watchmix watch
watch-pollmix watch -- --watch-options-poll=1000
hotmix watch --hot
prod / productionmix --production

11. Tests ​

phpunit.xml sets APP_ENV=testing. The tests/ folder only holds the default Unit/ExampleTest.php and Feature/ExampleTest.php.

bash
vendor/bin/phpunit

API docs ​

darkaonline/l5-swagger is installed. config/l5-swagger.php serves the UI at api/documentation and stores generated docs in storage/api-docs.

bash
php artisan l5-swagger:generate

Environment variables ​

Names only. Values belong in your local .env or the deployment secrets store; never copy them into docs or commits.

Listed in .env.example ​

AreaVariables
AppAPP_NAME, APP_ENV, APP_KEY, APP_DEBUG, APP_URL
LoggingLOG_CHANNEL, LOG_DEPRECATIONS_CHANNEL, LOG_LEVEL
DatabaseDB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD
Database (commented, UAT/prod read/write split)DB_WRITE_HOST, DB_READ_HOST, DB_STICKY, QUEUE_DB_CONNECTION, QUEUE_FAILED_DB_CONNECTION
DriversBROADCAST_DRIVER, CACHE_DRIVER, FILESYSTEM_DISK, QUEUE_CONNECTION, SESSION_DRIVER, SESSION_LIFETIME
Memcached / RedisMEMCACHED_HOST, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT
MailMAIL_DRIVER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_ENCRYPTION, MAIL_FROM_NAME, MAIL_FROM_ADDRESS
Mail recipientsMAIL_TO_ADDRESS, MAIL_NOTIFICATION_ADDRESS, MAIL_ALERT_ADDRESS, MAIL_SALES_ADDRESS, MAIL_ADMIN_ADDRESS
AWSAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, AWS_BUCKET, AWS_USE_PATH_STYLE_ENDPOINT
PusherPUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_SECRET, PUSHER_APP_CLUSTER, MIX_PUSHER_APP_KEY, MIX_PUSHER_APP_CLUSTER
Media binariesFFMPEG, FFPROBE
Social loginGOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_CLIENT_REDIRECT, MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, MICROSOFT_CLIENT_REDIRECT, MICROSOFT_TENANT_ID
PasskeysWEBAUTHN_ID (registrable domain shared by frontend and API), WEBAUTHN_ORIGINS (comma-separated frontend origins)
Status pageSTATUS_PAGE_PASSWORD_HASH (bcrypt hash, wrapped in double quotes)
LimitsMAX_BULK_OPERATION_LIMIT
Enterprise SSO (commented)SAML_SP_ENTITY_ID_BASE, SAML_SP_CERT_PATH, SAML_SP_KEY_PATH, SAML_SIGN_REQUESTS, SSO_RECHECK_DAYS, SSO_TOKEN_TTL_DAYS, SSO_STALE_DAYS

Read by config but missing from .env.example ​

These are read with env() in config/ and are needed for the matching features.

AreaVariablesConfig file
FrontendsFRONTEND_URL, DAM_FRONTEND_URL, DAM_APP_NAME, CNAMEconstant.php
App extrasAPP_TIMEZONE, APP_HOST, ASSET_URL, EXPORT_URL, AWS_URLapp.php
SearchSCOUT_DRIVER, SCOUT_PREFIX, SCOUT_CONNECTION, TYPESENSE_API_KEY, TYPESENSE_HOST, TYPESENSE_PORT, TYPESENSE_PATH, TYPESENSE_PROTOCOL, TYPESENSE_CHUNK_SIZE, TYPESENSE_CONNECTION_TIMEOUT_SECONDS, TYPESENSE_HEALTHCHECK_INTERVAL_SECONDS, TYPESENSE_NUM_RETRIES, TYPESENSE_RETRY_INTERVAL_SECONDSscout.php
PassportPASSPORT_CONNECTION, PASSPORT_PRIVATE_KEY, PASSPORT_PUBLIC_KEY, PASSPORT_PERSONAL_ACCESS_CLIENT_ID, PASSPORT_PERSONAL_ACCESS_CLIENT_SECRETpassport.php
QueueQUEUE_RETRY_AFTER, QUEUE_FAILED_DRIVERqueue.php
PaymentsSTRIPE_KEY, STRIPE_SECRETdam.php
File previewsFILE_PREVIEWS_API_KEY, FILE_PREVIEWS_SECRETE_KEYconstant.php
DAM limitsSTORAGE_LIMIT, AUTO_TAG, TRIAL_DAYS, PERPAGEDATA, MOBILEPERPAGEDATAconstant.php
AWS extrasAWS_BUCKET2, AWS_URL2, AWS_DISTRIBUTION_ID, AWS_ENDPOINT, AWS_BACKUP_BUCKET, AWS_BACKUP_URLconstant.php, services.php
PushDAM_FCM_SERVER_KEYconstant.php
GoogleGOOGLE_KEY, VISION_CREDENTIALS_PATH, VISION_API_KEYconstant.php, vision.php
BigQuery logsBIGQUERY_LOG_ENABLED, BIGQUERY_PROJECT_ID, BIGQUERY_DATASET, BIGQUERY_KEY_FILE, BIGQUERY_LOG_MAX_BODY, BIGQUERY_LOG_MAX_REQUEST_DATAbigquerylog.php
Zip workerZIP_WORKER_URLservices.php
SlackSLACK_WEBHOOK_URL, SLACK_CHANNEL, SLACK_USERNAME, SLACK_ICONservices.php, backup.php
SSO extrasSSO_RECHECK_HOLD_MINUTES, SAML_METADATA_TIMEOUT, SAML_EXTRA_RETURN_ORIGINSsaml.php
Passkeys extraWEBAUTHN_NAMEwebauthn.php
Mail extrasMAIL_MAILER, SUPPORT_MAIL_ADDRESSmail.php, constant.php
BackupsDB_BACKUP_MAIL, BACKUP_ARCHIVE_PASSWORDbackup.php
IMAPIMAP_DEFAULT_ACCOUNT, IMAP_HOST, IMAP_PORT, IMAP_PROTOCOL, IMAP_ENCRYPTION, IMAP_VALIDATE_CERT, IMAP_USERNAME, IMAP_PASSWORD, IMAP_AUTHENTICATIONimap.php
Location lookupsLOCATION_TESTING, MAXMIND_USER_ID, MAXMIND_LICENSE_KEY, IPINFO_TOKEN, IPDATA_TOKEN, IP_API_TOKEN, IP2LOCATIONIO_TOKEN, KLOUDEND_TOKENlocation.php
Help desk / radarHELP_DESK_API, HELP_DESK_DOMAIN, HELP_DESK_PASS, RADAR_AUTH_KEYapp.php
BasecampBASECAMP_CLIENT_ID, BASECAMP_CLIENT_SECRET, BASECAMP_REDIRECT_URIservices.php
TelescopeTELESCOPE_ENABLED, TELESCOPE_PATH, TELESCOPE_DOMAIN, TELESCOPE_DRIVER, and the TELESCOPE_*_WATCHER flagstelescope.php
SwaggerL5_SWAGGER_GENERATE_ALWAYS, L5_SWAGGER_GENERATE_YAML_COPY, L5_SWAGGER_BASE_PATH, L5_SWAGGER_UI_ASSETS_PATH, L5_SWAGGER_OPERATIONS_SORT, L5_FORMAT_TO_USE_FOR_DOCSl5-swagger.php

Note that .env.example uses FILESYSTEM_DISK, but config/filesystems.php reads FILESYSTEM_DRIVER for the default disk. Likewise .env.example sets MAIL_DRIVER, but config/mail.php reads MAIL_MAILER for the default mailer.

See Configuration for what each config file controls.