Skip to main content
The mobile middleware automatically parses device information from HTTP headers and User-Agent strings, providing rich context about the client device in your handlers.

Quick Start

The Device Struct

Platform Types

The Platform type represents the client operating system:

Platform Methods

Header Parsing

The middleware parses these standard headers:

Platform Detection Priority

  1. Explicit header - X-Platform header takes priority
  2. User-Agent parsing - Falls back to User-Agent analysis
  3. Unknown - Default if no detection succeeds

Configuration Options

Basic Options

Platform Restrictions

Minimum App Version

Requests with versions below 1.5.0 receive:
With response header: X-Min-App-Version: 1.5.0

Custom Error Handlers

Performance Optimization

Using Device Context

Access in Handlers

Platform-Specific Logic

Version-Based Features

Timezone-Aware Responses

Localized Responses

User-Agent Patterns

The middleware recognizes these User-Agent patterns: iOS:
Android:
Windows:
macOS:

Client Implementation

iOS (Swift)

Android (Kotlin)

Flutter (Dart)

React Native (TypeScript)

Next Steps

API Versioning

Manage API versions with deprecation warnings

Structured Errors

Return consistent error responses

Push Notifications

Handle push token registration

API Reference

Complete API documentation