Skip to main content

Prerequisites

  • Docker & Docker Compose
  • PHP 7.2+ (for running Composer/Artisan outside Docker)
  • Composer
  • Node.js + npm (for email template asset compilation)
1

Get the environment file

The API requires a .env file in the project root. This file is not committed to the repo.Options:
  • Ask a team member for the current .env
  • Download from S3: s3://tutorbloc-app/env-configurations/staging/.env
  • The parent tutorbloc/ directory may already have a .env you can reference
The .env contains secrets (Stripe keys, API tokens, database credentials). Never commit it.
2

Install PHP dependencies

composer install
3

Start Docker services

docker-compose up -d
This starts 6 services:
ServicePortPurpose
app9000PHP 7.2-FPM application server
webserver80, 443Nginx reverse proxy
mysql-db3306Primary MySQL 5.7 database
mysql-db-test3310Test MySQL 5.7 database
redis6379Cache, sessions, queue
blackbox3000Distance calculation microservice
Default database credentials:
  • Primary: admin / secret (database: tutorbloc_db)
  • Test: tester / tester_secret (database: tutorbloc_db_test)
4

Run database migrations

docker-compose exec app php artisan migrate --force
5

Seed initial data

docker-compose exec app php artisan db:seed --class=InitialDatabaseSeeder
This seeds: countries, currencies, roles, subjects, subject levels, exam boards, languages, name titles, payment gateways, and verification gateways.Individual seeders available in database/seeds/:
  • InitialCountryTableSeeder
  • InitialCurrencyTableSeeder
  • InitialRoleTableSeeder
  • InitialSubjectTableSeeder
  • InitialSubjectLevelTableSeeder
  • InitialExamBoardTableSeeder
  • InitialLanguageTableSeeder
  • InitialNameTitleTableSeeder
  • InitialPaymentGatewayTableSeeder
  • InitialVerificationGatewayTableSeeder
6

Compile frontend assets (optional)

npm install
npm run dev
Only needed if you’re working on email templates. Compiles JS and SASS via Laravel Mix.

Alternative: Laravel Homestead

The repo includes Homestead.yaml and Vagrantfile for Vagrant-based local development.
The Homestead config has a hardcoded path (/Users/jmendoza/Sites/tutorbloc-api). You’ll need to update this to your local path in Homestead.yaml.
# Update Homestead.yaml folder mapping first, then:
vagrant up
vagrant ssh
cd code
php artisan migrate
php artisan db:seed --class=InitialDatabaseSeeder
Homestead maps three sites:
  • homestead.test
  • api.homestead.test
  • staging.api.homestead.test

Useful aliases

The aliases file in the project root defines shell shortcuts:
AliasCommand
artphp artisan
phpunitvendor/bin/phpunit
servephp artisan serve
dbexportDatabase backup
dbimportDatabase restore

Verifying setup

Once running, hit http://localhost/api/countries — you should get a JSON response with seeded country data (no auth required).