Designing an Account System and User Content Hub for Video Platforms

    This article breaks down the core architecture of a video platform’s account system and user content center, covering identity management, cross-device playback sync, engagement features, recommendation systems, and content safety compliance. It provides practical design guidelines for developers building video streaming services.

    Designing an Account System and User Content Hub for Video Platforms

    I. Background and Problem Definition

    The technical challenges of a video platform appear to be about “playback experience” on the surface, but they are essentially about a complete data and service system centered on user identity and user content. A typical user’s behavior chain on the platform generally follows this sequence:

    1. Logs in or registers via the account system to obtain a unique identity;
    2. Watches long videos, series, or short videos, generating state data such as playback progress and watch history;
    3. Participates in interactions, including sending live comments (danmaku), posting comments, and liking or bookmarking content;
    4. Receives personalized content recommendations based on historical behavior, entering content consumption scenarios like membership, live events, and campaigns;
    5. Switches between multiple devices, expecting seamless synchronization of progress and state.

    The “set of capabilities available after login” reflected in the title corresponds to the four core domains of the user content center:

    • Identity Domain: Login, registration, and multi-device session management;
    • Playback Domain: Playback progress sync, adaptive bitrate streaming, and history records;
    • Interaction Domain: Danmaku, comments, likes, and bookmarks;
    • Distribution Domain: Personalized content search and recommendation, and organization of operational content like campaigns and columns.

    These domains are coupled with each other but differ significantly in technical characteristics. If mixed into the same set of services, they will rapidly evolve into a “monolithic giant” that is difficult to decouple. Therefore, the core argument of this article is: Domain decomposition and data model abstraction must come before engineering implementation in video platform architecture design.


    II. Unified Account System Design

    2.1 Identity Model

    The account system needs to abstract several stable concepts:

    Concept Description
    Account The user’s unique identity on the platform, existing long-term
    Credential Replaceable proof of identity (password, SMS code, third-party authorization, QR code login)
    Session Short-term credential for a login session, supporting active invalidation
    Token Credential for service-to-service and client-side access to protected resources

    The key design point is decoupling accounts from credentials: When a user changes their phone number, adds third-party authorization, or switches login methods, the primary account identifier remains unchanged, ensuring that historical data, membership benefits, and bookmarks are not lost.

    2.2 Authentication Flow Recommendations

    It is recommended to adopt a “short-lived token + rotatable refresh token” model to balance security and user experience:

    1. Client Auth Service Business Service
    2. | Submit Credential | |
    3. | (password/SMS code) | Validate & Issue Token |
    4. |------------------------> | |
    5. | accessToken + refreshToken |
    6. | <------------------------ | |
    7. | Request with accessToken | |
    8. |-----------------------------------------------------> |
    9. | | Validate Signature / Expiry
    10. | accessToken expired -> Refresh with refreshToken |

    Supporting considerations include:

    • Token Storage: Avoid plaintext persistence on the client; prioritize using secure storage capabilities provided by the operating system;
    • Refresh Strategy: Support rotation and reuse detection for refreshToken. If abnormal reuse is detected, invalidate the entire token chain;
    • Risk Control and Rate Limiting: Login endpoints need basic protections like rate limiting, CAPTCHA challenges, and device fingerprinting;
    • Multi-device Login Management: Provide a list of logged-in devices and a one-click logout feature to prevent account sharing risks.

    2.3 Anonymous and Unified States

    A unique aspect of video platforms is that unauthenticated users also need to watch content. A reasonable approach is to introduce “anonymous device identifiers” and “post-login unified mapping”:

    1. Anonymous Period: Generate an anonymous identifier for the device to carry watch history and temporary bookmarks;
    2. After Login: Merge anonymous data into the primary account, handling deduplication and time conflicts;
    3. After Logout: When using the same device again, allow users to choose between restoring anonymous history or clearing it.

    This approach reduces user churn caused by login barriers and provides a complete data chain for subsequent growth analysis.


    III. Cross-Device Playback Progress Sync

    “Syncing playback history across devices” is one of the most perceptible features in terms of user experience and needs separate analysis.

    3.1 Data Model

    1. {
    2. "user_id": "u_10086",
    3. "content_id": "v_98765",
    4. "position_ms": 734000,
    5. "duration_ms": 1420000,
    6. "progress_ratio": 0.517,
    7. "play_state": "paused",
    8. "device_type": "mobile",
    9. "updated_at": "2026-08-26T17:45:00Z"
    10. }

    Only one primary record is kept per user per piece of content. Historical versions can be stored in a separate table as behavioral logs for analysis and deduplication.

    3.2 Write and Read Strategies

    • Writing: Database writes are not needed on every heartbeat. The client triggers writes based on dual thresholds (time difference + progress difference), combined with forced persistence on events like playback end, page exit, or backgrounding;
    • Write Method: Use incremental reporting and merge writes. The server handles idempotency via version numbers or timestamps to prevent progress regression caused by out-of-order data;
    • Reading: Use caching to handle hot playback records. Hit rates are typically high in read-heavy, write-light scenarios;
    • Display: Scenarios like progress bar resume, history lists, and “Continue Watching” share the same data, outputting through different aggregated views.

    3.3 Consistency and Experience Trade-offs

    The difficulty in cross-device sync lies not in storage, but in semantic determination. For example: If a user watched 70% on mobile, should they resume from 70% on desktop? If the content is completed and rewatched, should only the latest session be recorded? Engineering best practices suggest defining clear rules:

    • Not Finished (e.g., progress < 95%): Resume playback;
    • Finished: Default to playing from the beginning, but retain a “last watched” marker;
    • Abnormal Client Time or Content Duration: Defer to server-side rules and perform data correction.

    IV. Danmaku and Comment Systems

    Although both danmaku and comments are “user-generated text,” their technical characteristics are almost opposite and must be treated differently.

    4.1 Danmaku: High Concurrency, Short Connections, Weak Persistence

    The core metrics for danmaku are instantaneous throughput and latency. Typical characteristics include burst traffic (key plot points, live event moments), short individual messages, and low search requirements.

    Implementation key points:

    • Access Layer: Use a long-connection gateway for sending and receiving. The gateway remains stateless, with session routing information stored externally;
    • Delivery Strategy: Bucket messages by timeline. Clients fetch data based on playback position. The server performs sampling and merging to prevent message flooding from overwhelming client-side rendering;
    • Rate Limiting and Filtering: Perform local frequency limiting and sensitive word filtering before entering the broadcast channel;
    • Degradation Plan: During peak loads, prioritize playback links. Danmaku can be degraded to “send-only without real-time display” or delayed merged display.
    1. Client --Long Connection--> Danmaku Gateway --Sampling/Merging--> Timeline Shard Cache
    2. |
    3. +--> Async Write to Danmaku Storage (Batch/Delayed)

    4.2 Comments: Strong Persistence, Search, and Governance

    Comments are closer to a social content subsystem and require:

    • Hierarchical Structure: Main comments + nested replies. It is recommended to use a “root comment table + reply table + redundant counters” structure;
    • Sorting Capability: Hotness sorting needs to combine time decay, interaction volume, and author weight to prevent new content from never gaining exposure;
    • Counter Consistency: Like counts and reply counts use cache incrementing + async calibration to avoid write amplification on hot comments;
    • Content Governance: Machine review (sensitive words, political/pornographic content, spam marketing) + human review queues + user reporting loops. All three are essential;
    • Anti-Abuse: Frequency limits per device/account, cooldown periods for new accounts, and identification of abnormal text patterns.

    V. Personalized Content Search and Distribution

    Behind “endless watching” lies the collaboration between search and recommendation, not a single recommendation model.

    5.1 Search-Side Foundation

    • Structured indexing by title, description, tags, categories, and creator dimensions;
    • Support for multi-condition combined filtering (duration, resolution, update time, content type);
    • Pagination and sorting capabilities to avoid performance degradation from deep page turning.

    5.2 Recommendation-Side Layered Approach

    It is recommended to adopt a classic layered structure for easier iteration and troubleshooting:

    1. Recall Layer: Quickly retrieve candidate sets from massive content. Typically uses multi-path recall (behavioral collaborative filtering, content similarity, popularity, regional/language preferences) followed by merging;
    2. Pre-ranking Layer: Lightweight models or rule-based scoring to compress candidate scale;
    3. Fine-ranking Layer: Fuses objectives like clicks, completion rates, and interactions, with attention to multi-objective trade-offs;
    4. Re-ranking and Strategy Layer: Diversity scattering, fatigue control, fixed insertion of operational slots, and content pool support.

    5.3 Cold Start and Feedback Loop

    • User Cold Start: Guide users to select interest tags + registration source info + exploratory exposure on the first screen;
    • Content Cold Start: Provide guaranteed exposure for new content, collect early completion and interaction data before entering regular strategies;
    • Feedback Loop: Exposure, clicks, watch duration, completion, interactions, and negative feedback (not interested, reports) must all flow back to form samples usable for training and strategy tuning.

    VI. Non-Functional Design and Stability Assurance

    6.1 Storage Selection Principles

    Data Type Characteristics Selection Approach
    Accounts & Benefits Strong consistency, low-frequency writes Relational DB + Master/Slave or Sharding
    Playback Progress High-frequency writes, single-record reads Cache + Async persistence to storage
    Danmaku Extremely high concurrency writes, timeline reads Sharded storage + Timeline cache
    Comments Complex queries, high-frequency counters Relational DB + Search index + Cache
    Behavior Logs Massive append-only writes Message queue + Log service + Analytics storage

    6.2 High Availability and Capacity Planning

    • Read/Write Splitting and Multi-level Caching: Local cache, distributed cache, database read replicas;
    • Asynchronous Processing: Danmaku writes, counter updates, and recommendation sample reporting can be asynchronous to handle peak shaving;
    • Circuit Breaking and Rate Limiting: Set thresholds by endpoint tier to safeguard core playback and login chains;
    • Observability: Unified log collection, metric monitoring, and alerting, with tracing covering key paths from login to playback;
    • Gray Releases: Validate new strategies and endpoints with small traffic first, observing core metrics before scaling up.

    VII. Content Safety and Compliance Essentials

    Content platforms must treat compliance as a first-class citizen, not an afterthought:

    1. Pre-publish Review: Tiered machine review + human review strategies for text, images, and video;
    2. Post-publish Patrols: Sample re-reviews and rapid handling channels driven by user reports;
    3. Copyright and Licensing Management: Metadata management for content license duration, regional scope, resolution, and device scope to avoid out-of-scope distribution;
    4. Data and Privacy: Minimize data collection, clarify usage purposes, provide account cancellation and data deletion paths, and encrypt sensitive information with masked display;
    5. Auditing and Traceability: Maintain traceable records for critical operations (takedowns, bans, benefit changes).

    VIII. Implementation Roadmap Recommendations

    If starting from scratch, it is recommended to proceed in three phases:

    • Phase 1 (Usable): Account login, content lists and playback, basic progress recording, comment sending/receiving, and basic content safety review;
    • Phase 2 (User-Friendly): Cross-device progress sync, danmaku system, bookmarks and history center, search filtering, and initial recommendation recall;
    • Phase 3 (Scalable): Multi-objective fine-ranking, strategy experimentation platform, capacity and stability initiatives, and refined copyright and operational data systems.

    IX. Conclusion

    The technical development of a video platform is essentially about building a sustainable service system around four main lines: “Identity — Content — Interaction — Distribution.” The account system must decouple identity from credentials while supporting anonymous states; playback progress sync must balance write frequency with semantic correctness; danmaku and comments must be designed separately as “real-time broadcasts” and “governable content”; and the recommendation system relies on layered recall and a complete feedback loop to iterate stably. On top of this, clear storage layering, asynchronous peak shaving, observability, and content safety compliance mechanisms are required to support a user experience that is both smooth and trustworthy.