Skip to Content
API v1Overview

Housr API v1 (Legacy)

Legacy flat-PHP API powering the Housr mobile app and web platform. This API serves both the UK and US markets with region-specific logic controlled by a $USA environment flag.

Status: Legacy. New features should target Housr-API2  (Laravel-based API v2). This codebase is maintained for existing endpoints that have not yet been migrated.

Stack

  • Runtime: PHP 8.2 (FPM)
  • Web Server: Nginx (reverse proxy to PHP-FPM)
  • Database: MySQL (dual databases: main + bills)
  • Container: Docker (deployed via AWS Copilot / App Runner)
  • Error Tracking: Sentry
  • Auth: JWT (HS256, custom implementation using firebase/php-jwt)

Quick Start

# Clone and start git clone <repo-url> cp .env.example .env # Fill in database credentials and service keys docker compose up --build # API is available at http://localhost/api/

The Docker setup runs Nginx + PHP-FPM in a single container. The deploy/run script starts both services.

Project Structure

Housr-API/ api/ # All endpoint files (flat PHP, file-based routing) include/ # Bootstrap, DB config, Firebase, email templates utils/ # Shared utility functions (JWT, notifications, bills, HubSpot, etc.) libs/ # Vendored libraries (php-jwt, AWS SDK) external/ # External-facing endpoints (Finix, Entrata, perks) roomie/ # Roomie feature endpoints propertyFeed/ # Property feed integrations (Jupix, BLM, Aspasia, RTDF, Veco) us/ # US-specific endpoints (moderation, landlord reviews) websiteEnquiries/ # Website enquiry handling PHPMailer/ # PHPMailer library deploy/ # Nginx config, PHP-FPM config, entrypoint script copilot/ # AWS Copilot service definitions and environment configs saml/ # SimpleSAMLphp config for SSO (US university auth) docker/ # Docker-specific config (xdebug) vendor/ # Composer dependencies composer.json Dockerfile docker-compose.yml

Documentation Index

DocumentDescription
ArchitectureFile-based routing, request flow, utility pattern
SetupDocker setup, environment variables, local development
AuthJWT implementation, token structure, auth guards
DatabaseDual DB setup, connection patterns, key tables
Regional LogicUK vs US branching via $USA flag
DeploymentDocker, AWS Copilot, Nginx configuration
Endpoints
Auth EndpointsLogin, signup, SSO, OTP, social auth
Houses EndpointsProperty listing, search, details, likes
Viewings EndpointsViewing requests, cancellation, ratings
Chat EndpointsChat rooms, messaging
Bills EndpointsQuotes, signup, meters, direct debit
Perks EndpointsPerk categories, redemption, tokens
Roomie EndpointsProfile CRUD, matching, requests
Rideshare EndpointsRides, booking, chat
Users EndpointsProfile, friends, groups, referrals
Notifications EndpointsFCM tokens, push, reminders
Moderation EndpointsUS moderation, ratings, disputes
Integrations
FirebaseRealtime DB, Cloud Messaging
HubSpotCRM contacts, leads, deals
FinixPayment processing
EntrataProperty management (US)
Property FeedsJupix, BLM, Aspasia, RTDF, Veco
TwilioSMS delivery
MailgunEmail delivery

Key Dependencies (composer.json)

PackagePurpose
kreait/laravel-firebaseFirebase Admin SDK (FCM, Realtime DB)
firebase/php-jwt (vendored in libs/)JWT encoding/decoding
twilio/sdkSMS via Twilio
mailgun/mailgun-phpEmail via Mailgun
hubspot/api-clientHubSpot CRM integration
aws/aws-sdk-phpS3 uploads, Secrets Manager
guzzlehttp/guzzleHTTP client
sentry/sentryError tracking
dompdf/dompdfPDF generation
mailchimp/marketingMailchimp integration (US SSO signup)
verifalia/sdkEmail verification
google/apiclientGoogle Sign-In verification
Last updated on