# Scaling a Regional Bike-Sharing Network

A regional bike-sharing network spanning several municipalities has different operating constraints from a single-city system. Riders expect one account, consistent pricing, and reliable bike availability even when local agencies use different infrastructure vendors. Our architecture treats stations, bikes, docks, and service zones as shared regional resources while preserving municipal ownership metadata for reporting and cost allocation.

## Event-Driven Fleet Tracking

Each dock and e-bike publishes status events through a cellular or municipal network gateway. Events include battery level, lock state, location, and firmware health. Gateways buffer messages during outages and forward them to a regional broker when connectivity returns. Consumers update the operational database, feed maintenance alerts, and produce anonymized trip records for planning teams. Idempotency keys prevent replayed events from creating duplicate rentals or incorrect inventory counts.

```yaml
telemetry:
  publish_interval_seconds: 30
  offline_buffer_hours: 12
  low_battery_threshold: 20
```

## Availability and Rebalancing

A forecasting service estimates demand in 15-minute intervals using recent trips, weather, transit disruptions, holidays, and station capacity. Dispatch software converts those forecasts into rebalancing tasks for field crews, prioritizing empty stations near morning transit hubs and full stations in evening destination areas. Predictions are advisory: dispatchers can override them when construction, festivals, or road closures make historical patterns unreliable.

## Payments Across Municipal Boundaries

Trips may begin in one municipality and end in another, so the billing service records usage independently from settlement. Riders see a single charge, while a nightly process allocates revenue and operating costs according to agreed rules for trip origin, destination, duration, and vehicle type. Keeping settlement asynchronous prevents inter-agency accounting failures from blocking bike unlocks at the curb.

## Reliability, Privacy, and Operations

The network degrades safely when regional services are unavailable. Stations cache current access credentials, mobile clients receive short-lived signed unlock tokens, and trip completion events can be reconciled later. Location data is retained at full precision only for operational investigations, then aggregated for long-term analysis. Operators monitor unlock latency, station connectivity, telemetry lag, payment failures, and inventory drift, with alerts scoped by municipality so local teams can respond without losing the regional view.