Backend Development
The Identity Backend is built with Laravel 12 and FrankenPHP (Octane), providing a high-performance authentication and authorization API.
Technology Stack
- Framework: Laravel 12
- Server: FrankenPHP + Laravel Octane
- Database: PostgreSQL (via CloudNative-PG)
- Cache: Redis
- Queue: RabbitMQ
- Auth: Laravel Sanctum + Passport (OAuth2)
Project Structure
app/
├── Http/
│ ├── Controllers/
│ │ ├── Auth/ # Authentication controllers
│ │ ├── Admin/ # Admin panel controllers
│ │ └── Api/ # API controllers
│ ├── Middleware/ # Custom middleware
│ └── Requests/ # Form requests / validation
├── Models/ # Eloquent models
├── Services/ # Business logic services
├── Policies/ # Authorization policies
└── Events/ # Event classes
Key Models
| Model | Description |
|---|---|
User | Core user model with multi-tenant support |
Tenant | Tenant/organization model |
Application | OAuth2 client applications |
TrustedDevice | Remembered devices for 2FA |
AuditLog | Authentication event log |
API Endpoints
All endpoints are prefixed with /api/.
Authentication
POST /auth/login- Login with email/passwordPOST /auth/register- Register new userPOST /auth/logout- Logout current sessionPOST /auth/2fa/verify- Verify 2FA codePOST /auth/pin/verify- Verify PIN code
User Management
GET /user- Get current user profilePUT /user/profile- Update profilePUT /user/password- Change password
Admin
GET /admin/users- List users (admin only)GET /admin/tenants- List tenants (admin only)POST /admin/tenants- Create tenant
Running Locally
# Install dependencies
composer install
# Run migrations
php artisan migrate
# Start development server
php artisan serve
# Or with Octane (production-like)
php artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000
Environment Variables
Key environment variables are configured via Kubernetes secrets:
| Variable | Source | Description |
|---|---|---|
DB_HOST | pg-credentials | PostgreSQL host |
DB_DATABASE | pg-credentials | Database name |
DB_USERNAME | pg-credentials | Database user |
DB_PASSWORD | pg-credentials | Database password |
RABBITMQ_HOST | rabbitmq-credentials | RabbitMQ host |
REDIS_HOST | redis-credentials | Redis host |
APP_KEY | app-secrets | Laravel application key |