BARE MACHINE TO SERVING APP
Setup runbook
Run these in order on a Linux machine you did not set up. Stop at the first check that fails and fix it before continuing.
Check the provided machine
Use the supplied repository and framework version if available. The practice app uses Laravel 11 and PHP 8.3; full-file bootstrap examples target Laravel 11/12. No npm, React or frontend build is needed.
pwd cat /etc/os-release php -v composer --version php -m # Required: PDO + pdo_sqlite, mbstring, XML/DOM, curl, openssl, fileinfo # In a supplied repo: cat composer.jsonDone when: PHP and Composer are present; the PHP version satisfies the supplied composer.json.
Only if tools are missing: Debian / Ubuntu
Skip if already installed. Requires sudo and network. Package names/default PHP differ by Linux distribution; request help if no sudo or PHP is below the project requirement.
sudo apt update sudo apt install -y php-cli php-sqlite3 php-mbstring php-xml php-curl php-zip unzip git composer php -v composer --versionDone when: The CLI PHP has pdo_sqlite and meets the project requirement.
Supplied repository: install its locked dependencies
Run only this branch when a starter repository is supplied. Do not overwrite an existing .env or regenerate an existing key.
cd /path/to/supplied-project composer install test -f .env || cp .env.example .env # Only if APP_KEY is empty: php artisan key:generate php artisan --versionDone when: Artisan boots. Continue with assembly, merging settings where the starter already has code.
No repository: create a fresh skeleton
Alternative to the previous step. Laravel 12 is an explicit compatible starting point for this Laravel 11-style practice code; use the assessment-required version if specified. Keep skeleton defaults and migrations. Do not copy the practice Composer advisory exception.
composer create-project laravel/laravel brokerage "^12.0" cd brokerage php artisan --versionDone when: A new Laravel project exists. No frontend build is needed for our plain Blade page.
Paste the application files
Open Assemble project. On a fresh skeleton use Copy all files in the terminal from the directory containing artisan. In a supplied app paste/merge individual files. Skip make:model etc: complete files are provided, including the orders migration.
test -f artisan && pwd # Next: open /assemble/ and copy the files. # Fresh project only, AFTER pasting .env.example: cp .env.example .env php artisan key:generate mkdir -p storage/framework/cache/data storage/framework/sessions storage/framework/views bootstrap/cache touch database/database.sqliteDone when: All application files are in place; exactly one create-orders migration exists.
Configure database and demo mode
Default: SQLite, file sessions/cache, fixed market fixtures. In a fresh .env copied above, DB_DATABASE is absent so Laravel uses database/database.sqlite. Remove an existing DB_DATABASE=:memory: or set an absolute file path. For required MySQL use the provided database and credentials instead.
# .env: DB_CONNECTION=sqlite, SESSION_DRIVER=file, CACHE_STORE=file # .env: EXCHANGE_DEMO=true php artisan config:clear php artisan migrate php artisan migrate:statusDone when: The orders migration is marked Ran. MySQL alternative: set DB_CONNECTION=mysql plus DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD before migrating.
Test, serve and submit an order
Tests use a separate in-memory SQLite database and fake HTTP. Browser submission also checks CSRF, which Laravel feature tests normally bypass.
php artisan test --filter=BrokerageTest # If Pint is installed: ./vendor/bin/pint --test php artisan serve --host=127.0.0.1 --port=8000Done when: Tests pass; browser shows quotes/depth and accepts a valid limit and market order. Use port 8010 if 8000 is occupied.
Switch to the actual API
First adapt the contract checklist. Leave credentials only in .env. Restart/clear config after changes. If no API is supplied, identify demo mode clearly.
# Edit .env: # EXCHANGE_DEMO=false # EXCHANGE_BASE_URL=provided-url # EXCHANGE_API_KEY=provided-key php artisan config:clear # Separate terminal: tail -f storage/logs/laravel.logDone when: Actual quotes and acceptance match the supplied contract; secrets never appear in the page or repository.