---
title: "Beacon Content Platform — BLE Ad Backend & API — Tran Manh Tuan"
description: "A multi-tenant BLE/iBeacon advertising platform that recorded 761,921 device connections in a single hour while matching campaigns and delivering context-aware content."
canonical: "https://tmtuan.dev/en/projects/beacon-content-platform"
language: "en"
image: "https://tmtuan.dev/_img/projects/beacon-content-platform/beacon-content-platform-2.59f401ec-og.jpg"
tokens: 2212
---

# Beacon-based Content Delivery Platform

This was a **freelance project** I worked on from **2023 to 2024**. My primary responsibility was building, extending and maintaining the **backend and APIs**, together with deployment and operational support for the related cloud services.

> **Scale signal:** the hourly statistics pipeline recorded **761,921 device connections in a single hour** at peak. Each connection entered the campaign-selection path, where beacon context, delivery schedules and targeting conditions determined the relevant advertising content.

## The system problem

The platform served multiple businesses from one system. Its administration console managed accounts, users and permissions; integrated applications; facilities, beacons and tags; offers, advertisements and notifications; and campaign schedules, frequency controls and target audiences.

For end users, a mobile SDK detected a **BLE/iBeacon** signal and called the API. The backend authenticated the application context, found active campaigns, applied delivery rules, returned the relevant content and captured events for operational monitoring and analytics.

## Primary responsibilities and contributions

- Developed and maintained the **PHP** administration backend and the real-time **Java + Play Framework** APIs.
- Extended multi-tenant administration across accounts, access control, applications, beacons, content and campaigns.
- Maintained campaign-matching logic for delivery windows, device platforms, frequency controls and audience targeting.
- Troubleshot across the admin, API, MySQL, cache and runtime layers while keeping changes safe and compatible with active SDK and API consumers.
- Supported a load-balanced cloud runtime, managed databases, Memcached and an analytics data pipeline into BigQuery.

## System architecture

```mermaid
flowchart LR
  accTitle: Beacon content platform — system architecture
  accDescr: Operations staff use a PHP administration backend that stores accounts, applications and campaigns in MySQL. Mobile apps detect BLE or iBeacon signals and call a Java Play API, which authenticates the request and hands it to campaign matching on schedule, frequency and targeting rules. Matching uses Memcached for hot lookups and MySQL for campaign data, returns content to the app, and sends delivery events into an event and statistics pipeline that feeds BigQuery reporting. All server components run in a load-balanced cloud runtime. The observed peak was 761,921 device connections in one hour.

  Ops["Operations team<br/><small>campaign and content management</small>"]
  Mobile["Mobile app + SDK<br/><small>BLE/iBeacon detection</small>"]

  subgraph Cloud["Load-balanced cloud runtime"]
    Admin["PHP admin backend<br/><small>multi-tenant operations</small>"]
    API["Java + Play API<br/><small>authentication and request handling</small>"]
    Match["Campaign matching<br/><small>schedule · frequency · targeting</small>"]
    Cache[("Memcached<br/><small>hot lookup data</small>")]
    DB[("MySQL / managed DB<br/><small>accounts · apps · campaigns</small>")]
    Events["Event + statistics pipeline<br/><small>delivery · clicks · devices</small>"]
    Analytics[("BigQuery / reporting<br/><small>operational analytics</small>")]
  end

  Scale["Peak observed load<br/><small>761,921 device connections / hour</small>"]

  Ops --> Admin
  Mobile --> API
  Admin --> DB
  API --> Match
  Match --> Cache
  Match --> DB
  Match -- "content" --> Mobile
  Match --> Events
  Events --> Analytics
  Scale -.-> API
```

_Public reconstruction of the platform at component level. It shows the backend and data responsibilities without exposing internal hosts, repositories or proprietary implementation details._

## Advertisement delivery flow

```mermaid
flowchart TB
  accTitle: Beacon advertisement delivery flow
  accDescr: A mobile SDK detects a beacon, builds an API request with app, device and beacon context, authenticates the tenant and application, resolves the active campaigns for that beacon or location, applies delivery rules for time window, platform, frequency and target, selects an offer, advertisement or notification, returns it for the app to render, records delivery and interaction events, and aggregates them into hourly statistics. The observed peak was 761,921 device connections in one hour.

  Detect["1. Detect proximity<br/><small>SDK receives a BLE/iBeacon signal</small>"]
  Request["2. Build API request<br/><small>app, device and beacon context</small>"]
  Auth["3. Authenticate context<br/><small>resolve tenant and application</small>"]
  Candidates["4. Resolve candidates<br/><small>active campaigns for the beacon/location</small>"]
  Rules["5. Apply delivery rules<br/><small>window · platform · frequency · target</small>"]
  Content["6. Select content<br/><small>offer, advertisement or notification</small>"]
  Response["7. Return response<br/><small>the app renders the content</small>"]
  Events["8. Record outcome<br/><small>delivery and interaction events</small>"]
  Stats["9. Aggregate statistics<br/><small>hourly reporting and analytics</small>"]
  Peak["Observed peak<br/><small>761,921 device connections in one hour</small>"]

  Detect --> Request --> Auth --> Candidates --> Rules --> Content --> Response --> Events --> Stats
  Peak -.-> Stats
```

_The request path separates real-time campaign selection from downstream event aggregation, keeping the mobile response focused while preserving data for operations and reporting._

## Administration and operations flow

```mermaid
flowchart TB
  accTitle: Beacon platform administration and operations flow
  accDescr: The operations team administers the system and its tenants, manages accounts with role-based permissions, configures SDK and API integration for each application, maintains locations, tags and the beacon inventory, prepares offers, advertisements and notifications, sets up campaigns with targets, schedules and frequency, publishes and operates them, and finally monitors events, hourly statistics and exports.

  Ops["Operations team<br/><small>system and tenant administration</small>"]
  RBAC["Accounts + RBAC<br/><small>users, roles and permissions</small>"]
  Apps["Applications<br/><small>SDK/API integration settings</small>"]
  Beacons["Locations + beacons<br/><small>facilities, tags and beacon inventory</small>"]
  Content["Content catalogue<br/><small>offers, ads and notifications</small>"]
  Campaign["Campaign setup<br/><small>targets, schedule and frequency</small>"]
  Publish["Publish + operate<br/><small>status control and delivery</small>"]
  Monitor["Monitor + analyse<br/><small>events, hourly stats and exports</small>"]

  Ops --> RBAC --> Apps --> Beacons --> Content --> Campaign --> Publish --> Monitor
```

_The admin console is an operational control plane: it connects tenant governance, physical beacon inventory, campaign configuration and post-delivery monitoring in one workflow._

These diagrams are public-safe reconstructions from the technical documentation and administration interface at component level. They omit internal URLs, credentials, proprietary source code and raw production data.

## Details

- **Role:** Backend · Cloud Infrastructure · Production Operations

## Technology

- PHP
- Java
- Play Framework
- MySQL
- Apache
- Linux
- Memcached
- AWS EC2
- Elastic Load Balancing
- Amazon RDS
- BigQuery
- BLE
- iBeacon

## Services this project shows

- [Custom Business Systems](https://tmtuan.dev/en/services/business-systems)
- [Backend Engineering](https://tmtuan.dev/en/services/backend-development)
- [Cloud Infrastructure](https://tmtuan.dev/en/services/gcp-cloud-infrastructure)

## Related articles

- [How I Traced a Googlebot-only HTTP 500 Across Next.js, Cloud Run and the Hosting Edge](https://tmtuan.dev/en/articles/googlebot-500-firebase-hosting-nextjs)

## Structured data (JSON-LD)

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebPage","@id":"https://tmtuan.dev/en/projects/beacon-content-platform#webpage","url":"https://tmtuan.dev/en/projects/beacon-content-platform","name":"Beacon Content Platform — BLE Ad Backend & API","description":"A multi-tenant BLE/iBeacon advertising platform that recorded 761,921 device connections in a single hour while matching campaigns and delivering context-aware content.","inLanguage":"en","isPartOf":{"@id":"https://tmtuan.dev/#website"},"about":{"@id":"https://tmtuan.dev/#person"}},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://tmtuan.dev/en"},{"@type":"ListItem","position":2,"name":"Projects","item":"https://tmtuan.dev/en/projects"},{"@type":"ListItem","position":3,"name":"Beacon-based Content Delivery Platform","item":"https://tmtuan.dev/en/projects/beacon-content-platform"}]}]}
```
