Skip to Content
API v1Setup

Setup

Prerequisites

  • Docker and Docker Compose
  • A populated .env file (copy from .env.example)

Local Development

# Build and start the container docker compose up --build # The API is accessible at http://localhost/api/ # Example: http://localhost/api/login.php

The docker-compose.yml mounts the following as bind volumes for hot-reloading during development:

  • ./api -> /var/www/api (endpoint files)
  • ./deploy/deploy.conf -> Nginx server config
  • ./deploy/nginx.conf -> Nginx main config
  • ./deploy/run -> Container entrypoint
  • ./.env -> Environment file
  • ./docker/xdebug.ini -> Xdebug config
  • ./vendor -> Composer dependencies

PHP OPcache timestamp validation is enabled in development (PHP_OPCACHE_VALIDATE_TIMESTAMPS=1), so file changes are picked up without restarting.

Docker Image

The Dockerfile builds on a custom PHP 8.2-FPM base image. It installs:

  • PHP extensions: mysqli, pdo, pdo_mysql, pdo_pgsql, bcmath, gd, zip, opcache, exif, xdebug
  • Nginx
  • SimpleSAMLphp 2.2.2 (for US university SSO)
  • Composer dependencies

The container runs both Nginx (port 80) and PHP-FPM (port 9000) via the deploy/run entrypoint script.

Environment Variables

Database

VariableDescriptionExample
DB_SERVERMySQL hosthousr-database-instance-1.xxx.rds.amazonaws.com
DB_USERNAMEMySQL usernameadmin
DB_PASSWORDMySQL password(from AWS Secrets Manager in production)
DB_DATABASEMain database namehousr_database_prod
DB_DATABASE_BILLSBills database name (UK only)housr_bills_prod
DB_PORTMySQL port3306
DB_CONNECTIONConnection typemysql

Application

VariableDescriptionExample
APP_ENVEnvironment nameproduction, us_prod, development, uat, demo
USARegional flag (truthy = US mode)true or omitted for UK
URLBase API URLhttps://api.uk.housr.com/
PORTAL_URLPortal URL (for email links)https://housrportal.co.uk

Services

VariableDescription
SENTRY_DSNSentry error tracking DSN
SENTRY_ENVIRONMENTSentry environment label
SENTRY_TRACES_SAMPLE_RATESentry tracing rate (0.0-1.0)
FIREBASE_CREDENTIALSFirebase service account JSON
FIREBASE_DATABASE_URLFirebase Realtime DB URL
HUBSPOT_API_KEYHubSpot API access token
FINIX_USERNAMEFinix API username
FINIX_PASSWORDFinix API password
FINIX_MERCHANT_IDFinix merchant ID
FINIX_API_URLFinix API base URL
EXTERNAL_API_KEYAPI key for external endpoints
BRAND_PORTAL_URLBrand portal base URL
BRAND_PORTAL_SECRET_KEYBrand portal secret
HUDDLE_API_URLHuddle (bills provider) API URL
HUDDLE_PUBLIC_API_KEYHuddle public key
HUDDLE_SECRET_API_KEYHuddle secret key
APPLE_API_URLApple StoreKit API URL
APPLE_API_SECRETApple API secret
GOOGLE_PLAY_SERVICE_ACCOUNTGoogle Play service account JSON
VERIFALIA_USERNAMEVerifalia email verification username
VERIFALIA_PASSWORDVerifalia email verification password
STARREZ_USERNAMEStarRez integration username
STARREZ_PASSWORDStarRez integration password
ENTRATA_CLIENT_IDEntrata OAuth client ID (US only)
ENTRATA_CLIENT_SECRETEntrata OAuth client secret (US only)

Xdebug

Xdebug is installed in the Docker image. Configuration is loaded from docker/xdebug.ini via a bind mount. Enable it for step debugging during local development.

Last updated on