Content Platform Account Systems and Cross-Device Synchronization: A Technical Design

    This article turns a content community site's user-facing feature set—client download, login or registration, HD playback, cross-device watch history, danmaku and comments, premium membership, messages, and favorites—into a backend system design. It groups the visible features into five technical subdomains (identity, content, progress and relationship, interaction, and monetization and notification), then works through the core engineering problems: a stable account model with multiple login identifiers, a dual-token authentication scheme, guest-to-account merging, cross-device watch-progress synchronization with conflict resolution, incremental pulls and weak-network fallback, danmaku and comment delivery, server-side entitlement decisions, and a vendor-neutral cloud architecture. It closes with a reliability checklist covering idempotency, read/write separation, tiered degradation, version negotiation, and data compliance.

    What follows is a technical description that abstracts a “capabilities available after login” list into a backend system design. The source material is essentially a user-facing description of a content community site’s entry page: downloading the client, logging in or registering, watching HD video, syncing watch history across devices, sending danmaku and comments, premium membership, messages and activity feeds, and favorites. What users see are features; what engineering must deliver is an entire system of identity, data consistency, and real-time channels. The design is layered as follows.

    From a Feature List to System Boundaries

    Mapping user-visible capabilities to technical domains yields five subdomains:

    • Identity domain: accounts, login, registration, devices, and risk control—the prerequisite dependency for every other capability.
    • Content domain: media upload, transcoding, quality tiers, and distribution/acceleration—a relatively independent technology stack.
    • Progress and relationship domain: watch history, favorites, follows, and history—write-heavy and read-heavy, naturally sharded per user.
    • Interaction domain: danmaku, comments, and likes—bursty writes, heavy read amplification, and latency sensitivity.
    • Monetization and notification domain: membership entitlements, messages, and the activity feed—requiring strong consistency and traceability.

    The value of drawing these boundaries is that cross-domain calls must go through well-defined interfaces and asynchronous events, avoiding reverse dependencies such as “the login service writing directly to the danmaku table.”

    Identity Domain: Account Model and Login Credentials

    1. User Master Data Modeling

    The user entity is best modeled as a “stable internal ID + multiple login identifiers” structure. The internal ID is never reused once assigned and is never exposed externally; phone numbers, emails, third-party authorization identifiers, and similar items exist as rows in a separate login-identifier table, associated with the user master table via foreign keys. The benefit is that later changing a bound phone number or adding a new login method requires no changes to user foreign keys in any business table.

    1. -- Example: separating users from login identifiers
    2. user(id BIGINT PK, status SMALLINT, created_at DATETIME, ...)
    3. user_identity(
    4. id BIGINT PK,
    5. user_id BIGINT,
    6. auth_type SMALLINT, -- phone / email / third-party authorization
    7. auth_key VARCHAR(128), -- normalized identifier
    8. UNIQUE(auth_type, auth_key)
    9. )

    Key point: auth_key must be normalized before it is stored (strip spaces and country code from phone numbers, lowercase emails). Otherwise the same user ends up with duplicate accounts due to format differences.

    2. Login Credentials and Tokens

    A dual-token model is recommended: a short-lived access token for API authentication and a long-lived refresh token for silent renewal. Four points matter:

    • Keep the access token lifetime on the order of minutes to hours; the refresh token is longer-lived but must still expire.
    • Store refresh tokens per device or per session, supporting “kick offline” and logout across all devices.
    • Validate tokens once at the gateway and pass the user ID downstream, reducing repeated signature verification.
    • On mobile, use the operating system’s keystore for local secure storage; never write tokens to disk in plaintext.

    3. First Use and Silent Registration

    Content communities typically let guests browse first and log in later. Implementation uses a “temporary guest ID + account merge after login” scheme: during the guest phase, data is attached to a device-level guest ID; once the user logs in or registers, an idempotent merge job migrates historical behavior (watch history, favorites, drafts) to the formal user ID. The merge interface must be idempotent, because client retries under weak network conditions are the norm.

    1. // Example: merge after login, handling conflicts per business type
    2. merge(guest_id, user_id):
    3. for each record in history(guest_id):
    4. if exists(user_id, record.target):
    5. apply_merge_policy(record) // newer progress wins; favorites take the union
    6. else:
    7. move(record, user_id)
    8. invalidate_token(guest_id)

    4. Risk Control First

    Registration and login endpoints are the primary targets of automated abuse and should include at least: tiered triggering of CAPTCHA (graphical or behavioral), per-IP and per-device rate limiting, detection of bulk registration from anomalous devices, and progressive lockout on repeated failures. Risk control decisions must be observable and written to a logging service for retrospective analysis.

    Cross-Device Watch Progress Synchronization

    This is the technical core of “cross-device watch history sync” and the place where consistency is easiest to get wrong.

    1. Data Model

    A single progress record is uniquely determined by “user + item”; store position, total duration, update time, an update timestamp, and a change sequence number generated on the client.

    1. watch_progress(
    2. user_id, item_id,
    3. position_ms, duration_ms,
    4. version BIGINT, -- monotonically increasing or a client logical clock
    5. updated_at DATETIME,
    6. PRIMARY KEY(user_id, item_id)
    7. )

    2. Write Timing and Aggregation

    Reporting every second produces a large number of writes. A dual-trigger aggregation scheme on the client is recommended—“interval time + key events”: for example, report every 15–30 seconds, and force a report on pause, exit, backgrounding, and playback end. This keeps progress usable while reducing write volume by one to two orders of magnitude.

    3. Conflict Merge Strategy

    When multiple devices watch the same item simultaneously, conflicts are inevitable. Use “last write wins” with sensible refinements:

    • Use updated_at as the primary criterion; break ties within the same timestamp using the larger version.
    • If the two timestamps differ within a seconds-level jitter range, take the larger position, avoiding progress “rollback.”
    • Watched-through content is no longer overwritten by an intermediate position; explicitly distinguish three states: “watching,” “completed,” and “in progress.”

    4. Incremental Pull and Weak-Network Fallback

    Don’t pull the full history every time a detail page opens. Provide an “incremental pull by update time” endpoint, with the client maintaining a local cursor; also keep a local cache so that when offline the client reads locally and, once reconnected, uploads in bulk. The upload uses the same idempotent writes (upsert by primary key).

    1. -- Example: idempotent upsert, overwrite only when the new version is larger
    2. UPDATE watch_progress
    3. SET position_ms = :pos, version = :ver, updated_at = :now
    4. WHERE user_id = :uid AND item_id = :iid AND :ver >= version;
    5. -- When 0 rows are affected, then insert; combine with ignore on unique-key conflict

    Interaction Domain: Danmaku and Comments

    Danmaku is characterized by massive small messages, reads limited to a recent time window, and tolerance for slight loss. A workable approach is “short-window aggregation + sequence numbers + pull-based delivery”: maintain an increasing sequence number per item; the client remembers the largest sequence number received and backfills by sequence range after reconnecting. The server keeps only the most recent few minutes of data in an in-memory cache, and cold data is asynchronously written to object storage or a data warehouse for analytics.

    Comments are hierarchical structured data and require additional considerations:

    • For storage, use an adjacency list with a “root comment ID + floor number” to avoid recursive queries.
    • For display, fetch the first page of popular comments first and expand replies on demand, reducing read amplification per request.
    • All user-generated content passes through a text and media moderation pipeline before it is stored; content that hits a policy enters pending review or is blocked. Moderation decisions are written back asynchronously, and the display layer filters by status.
    • Counts (comment count, like count) go through an independent count cache with asynchronous persistence, allowing eventual consistency.

    Membership and Entitlements

    The principle for entitlement decisions is “the server decides; the client only displays.” Concretely:

    • Membership status is delivered to the authentication component as an “entitlement snapshot” that carries an expiration time; on expiry it is recalibrated against the source of truth.
    • Activation, renewal, and refunds each need a unique business transaction number, ensuring that duplicate callbacks do not grant duration twice.
    • High-value writes (order placement, entitlement changes) are separated from front-end actions and decoupled from downstream fulfillment, notification, and reporting via a message queue.

    Favorites, Messages, and Activity Feed

    Favorites fit a “set semantics” model, storing a list of IDs in a per-user set structure, which naturally supports union merges and incremental sync. Messages and the activity feed are append-only time-series data, suited to sharded writes with descending-cursor pagination. What they share is the need for an “unread count”; maintain the count separately and allow brief inconsistency, with a corrective fallback at read time.

    Common Cloud Infrastructure Building Blocks

    When these capabilities are deployed to the cloud, they can be assembled from generic component categories without binding to a specific vendor:

    • A container platform hosts stateless services (login, authentication, interaction), with autoscaling to handle evening traffic peaks.
    • Object storage holds large static data such as media, images, and audit logs.
    • A content delivery network accelerates media and static resources, reducing origin load.
    • An in-memory cache holds sessions, counts, and the danmaku hot window.
    • A message queue handles asynchronous decoupling and peak shaving for progress reporting, moderation events, and entitlement changes.
    • A relational database stores strongly consistent data such as accounts and entitlements, sharded by user ID.
    • Logging and monitoring/alerting cover core metrics such as API success rate, P99 latency, sync failure rate, and risk-control hit rate.

    Reliability Checklist

    • End-to-end idempotency: any write endpoint a client may retry must carry an idempotency key.
    • Read/write separation and cache-penetration protection: high-frequency read endpoints for progress and counts must not connect directly to the database.
    • Tiered degradation: under extreme traffic, first disable the danmaku hot window and activity-feed recommendations, preserving login and playback.
    • Canary release and rollback: changes to the login protocol and sync protocol must support version negotiation, so old clients are not broken.
    • Data compliance: minimize the collection of user behavior data, store it encrypted, and set retention periods per policy.

    Summary

    The “available after login” feature list of a content community is essentially a combination of three engineering problems—identity, consistency, and real-time delivery. The identity domain solves “who is accessing,” the progress and relationship domain solves “how multiple devices align,” and the interaction domain solves “how massive small data is delivered with low latency.” Solidify four things—merge strategy, idempotent writes, incremental sync, and degradation plans—and the stability of the cross-device experience gains a solid engineering foundation.