Setup
Prerequisites
- PHP 8.2+
- Composer
- Node.js 18+
- MySQL (or MariaDB)
- Redis (optional, for caching/queues)
Installation
# Clone the repo
git clone <repo-url>
cd Housr-API2
# Install PHP dependencies
composer install
# Install Node dependencies (for Vite module assets)
npm install
# Copy environment file
cp .env.example .env
# Generate app key
php artisan key:generateEnvironment Variables
Core Laravel
| Variable | Description | Default |
|---|---|---|
APP_NAME | Application name | Housr-API2 |
APP_ENV | Environment (local/staging/production) | local |
APP_DEBUG | Enable debug mode | true |
APP_URL | Base URL | http://localhost:8080 |
APP_KEY | Encryption key (generate with artisan key:generate) | — |
Database
| Variable | Description | Default |
|---|---|---|
DB_CONNECTION | Database driver | mysql |
DB_HOST | Database host | 127.0.0.1 |
DB_PORT | Database port | 3306 |
DB_DATABASE | Main database name | housr_database_dev |
DB_USERNAME | Database user | — |
DB_PASSWORD | Database password | — |
DB_DATABASE_BILLS | Bills database name | housr_bills_dev |
DB_BILLS_DRIVER | Bills DB driver | mysql |
Authentication
| Variable | Description | Default |
|---|---|---|
JWT_KEY | Shared JWT secret (must match API v1) | example_key |
EXTERNAL_JWT_KEY | External JWT secret | example_key |
Region
| Variable | Description | Default |
|---|---|---|
USA | Run in US mode (true/false) | false |
Third-Party Services
| Variable | Description |
|---|---|
SENTRY_LARAVEL_DSN | Sentry error tracking DSN |
MAILGUN_DOMAIN / MAILGUN_SECRET | Mailgun email delivery |
TWILIO_ACCOUNT_SID / TWILIO_AUTH_TOKEN / TWILIO_FROM | Twilio SMS |
HUBSPOT_API_KEY | HubSpot CRM API key |
MAPBOX_ACCESS_TOKEN | Mapbox maps |
HUDDLE_API_URL / HUDDLE_PUBLIC_API_KEY / HUDDLE_SECRET_API_KEY | Huddle address lookup |
VERIFALIA_USERNAME / VERIFALIA_PASSWORD | Email validation |
MAILCHIMP_API_KEY / MAILCHIMP_SERVER / MAILCHIMP_MARKETING_LIST_ID | Mailchimp newsletters |
FIREBASE_CREDENTIALS | Firebase service account JSON (as string) |
FIREBASE_DATABASE_URL | Firebase Realtime Database URL |
AUTHORIZATION_KEY | Shared webhook authorization key |
QUOTE_PREFILL_EXTERNAL_API_KEY | External quote prefill API key |
PROPERTIES_API_BASE_URL / REAPIT_CLIENT_ID / REAPIT_CLIENT_SECRET | Reapit property API |
Storage
| Variable | Description |
|---|---|
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY | AWS credentials |
AWS_PUBLIC_IMAGES_ACCESS_KEY_ID / AWS_PUBLIC_IMAGES_SECRET_ACCESS_KEY | Public images S3 credentials |
Database Setup
The application uses two MySQL databases:
- Main database (
DB_DATABASE): Shared with API v1 and Portal. Contains users, houses, cities, feature flags, etc. - Bills database (
DB_DATABASE_BILLS): Bills-specific tables (contracts, tenants, pricing, regions).
# Create databases
mysql -u root -e "CREATE DATABASE housr_database_dev;"
mysql -u root -e "CREATE DATABASE housr_bills_dev;"
# Run migrations
php artisan migrateSee database.md for details on the multi-database setup.
Running the Dev Server
The recommended way to run all dev services:
composer devThis starts:
- API server on
http://localhost:8001 - Queue worker for async jobs
- Log viewer (Laravel Pail) for real-time log output
- Vite for module asset compilation
Alternatively, run just the server:
php artisan serve --port=8001Docker
A Docker Compose setup is available for local development:
docker-compose upThis runs the app on port 8000 with the DB host set to host.docker.internal for connecting to a local MySQL instance.
Last updated on