Main entry point for XHub-short SDK - Short Video Feed for WebView
npm install @xhub-short/sdk> Glue Layer - Kแบฟt nแปi Core Domain vแปi React UI
SDK (Software Development Kit) lร package chรญnh mร Host App cร i ฤแบทt ฤแป tรญch hแปฃp Short Video Feed. Nรณ ฤรณng vai trรฒ "Glue Layer" - kแบฟt nแปi tแบฅt cแบฃ cรกc thร nh phแบงn bรชn trong SDK thร nh mแปt API thแปng nhแบฅt, dแป sแปญ dแปฅng.
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HOST APP (Your App) โ
โ โ
โ import { ShortVideoProvider, useFeed, usePlayer } from '@xhub-short/sdk';
โ import { VideoFeed, VideoPlayer } from '@xhub-short/ui'; โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ uses
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ @xhub-short/ui โ
โ (Lego Components - Phase 4) โ
โ โ
โ VideoFeed, VideoPlayer, InteractionBar, CommentSheet... โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ imports hooks from
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ @xhub-short/sdk โ
โ (Glue Layer - Current) โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Provider โ โ Hooks โ โ Factory (createSDK) โ โ
โ โ (Context) โ โ (React) โ โ (Dependency Inject) โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ orchestrates
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ @core โ โ @adapters โ
โ (Domain) โ โ (Infra) โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
> Lฦฐu รฝ: @sdk KHรNG import tแปซ @ui. Mลฉi tรชn chแป hฦฐแปng dependency (ai import ai).
---
| Vแบฅn ฤแป | Giแบฃi phรกp cแปงa SDK |
|--------|-------------------|
| Host App phแบฃi hiแปu kiแบฟn trรบc phแปฉc tแบกp bรชn trong | SDK expose API ฤฦกn giแบฃn: hooks + provider |
| Khรณ setup dependency injection cho adapters | createSDK() tแปฑ ฤแปng wire tแบฅt cแบฃ |useSyncExternalStore
| State management phแปฉc tแบกp (Feed, Player, Resource...) | Hooks abstract hแบฟt complexity |
| SSR compatibility | built-in |sdk.destroy()
| Memory leaks khi unmount | cleanup tแปฑ ฤแปng |
---
SDK thแปฑc hiแปn 7 nhiแปm vแปฅ chรญnh ฤแป Host App cรณ thแป tรญch hแปฃp dแป dร ng:
SDK lร nฦกi duy nhแบฅt thแปฑc hiแปn dependency injection - kแบฟt nแปi cรกc adapters vแปi core managers:
``
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DEPENDENCY INJECTION MAP โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Adapter Interface โโโโบ Core Component โ
โ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ IDataSource โโโโบ FeedManager โ
โ IInteraction โโโโบ OptimisticManager โ
โ ISessionStorage โโโโบ LifecycleManager โ
โ INetworkAdapter โโโโบ ResourceGovernor โ
โ IVideoLoader + IPosterLoader โโโโบ ResourceGovernor โ
โ IAnalytics โโโโบ PlayerEngine (events) โ
โ ILogger โโโโบ All managers (debug) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SDK tแปฑ ฤแปng resolve adapters theo thแปฉ tแปฑ ฦฐu tiรชn:
``
Config Priority:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ 1. config.adapters.dataSource โโโ Highest (User-defined)โ
โ โ โ
โ โผ fallback โ
โ 2. config.preset โ createBrowserAdapters() โ
โ โ โ
โ โผ fallback โ
โ 3. MockAdapter โโโ Lowest (Development) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ฤiแปu nร y cho phรฉp:
- Development: Khรดng cแบงn config โ Mock adapters tแปฑ ฤแปng
- Production vแปi Preset: Chแป cแบงn baseUrl + auth + endpoints
- Full Custom: Override bแบฅt kแปณ adapter nร o
Core Domain sแปญ dแปฅng vanilla stores (khรดng React). SDK bridge chรบng sang React:
``
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Core Store โ โ SDK Hook โ โ React UI โ
โ (Vanilla) โ โโโโบ โ (useSyncExternalโ โโโโบ โ (Re-render) โ
โ โ โ Store) โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โ store.subscribe() โ getSnapshot()
โ store.setState() โ
โผ โผ
Framework-agnostic SSR-safe subscription
Tแบกi sao khรดng dรนng Zustand trแปฑc tiแบฟp trong Core?
- Core phแบฃi framework-agnostic (cรณ thแป dรนng vแปi Vue, Svelte...)
- Giแบฃm bundle size cho Core package
- Tรกch biแปt concerns rรต rร ng
SDK wire cรกc events giแปฏa managers ฤแป chรบng phแปi hแปฃp:
``
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EVENT WIRING โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ PlayerEngine โ
โ โ โ
โ โโโ on('videoChange') โโโโโโโบ Analytics.flush() โ
โ โ (Flush trฦฐแปc khi ฤแปi video) โ
โ โ โ
โ โโโ on('timeUpdate') โโโโโโโโบ LifecycleManager.setPendingSave()โ
โ (Auto-save playback position) โ
โ โ
โ LifecycleManager โ
โ โ โ
โ โโโ on('visibilityChange') โโบ Analytics.flush() โ
โ (state === 'hidden') (Flush khi app background) โ
โ โ
โ ResourceGovernor โ
โ โ โ
โ โโโ on('focusChange') โโโโโโโบ PlayerEngine.load(video) โ
โ (Load video khi swipe) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SDK quแบฃn lรฝ toร n bแป vรฒng ฤแปi cแปงa cรกc managers:
| Phase | SDK Actions |
|-------|-------------|
| Init | Tแบกo managers, inject adapters, wire events, restore session |
| Active | Managers hoแบกt ฤแปng ฤแปc lแบญp, SDK chแป expose hooks |
| Background | Auto-save session, flush analytics |
| Destroy | Cleanup timers, unsubscribe events, clear cache |
`typescript`
// Tแปฑ ฤแปng trong Provider:
useEffect(() => {
const sdk = createSDK(config);
return () => sdk.destroy(); // Cleanup khi unmount
}, []);
SDK expose API ฤฦกn giแบฃn, แบฉn ฤi complexity bรชn trong:
| Exposed to Host App | Hidden from Host App |
|---------------------|----------------------|
| useFeed() - videos, loadMore | FeedManager internals |usePlayer()
| - play, pause, seek | PlayerEngine state machine |useOptimistic()
| - like, follow | Rollback queue, pending states |useSwipeGesture()
| - onSwipe | DOM allocation logic |
| Config vแปi preset | Adapter creation |
SDK ฤแบฃm bแบฃo hoแบกt ฤแปng vแปi Server-Side Rendering:
``
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SSR STRATEGY โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Server: โ
โ โโ ShortVideoProvider renders vแปi empty state โ
โ โโ Hooks return initial/fallback values โ
โ โโ Khรดng tแบกo SDK instance โ
โ โ
โ Client (Hydration): โ
โ โโ useEffect tแบกo SDK instance โ
โ โโ Restore session tแปซ localStorage โ
โ โโ useSyncExternalStore subscribe to stores โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
---
``
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HEXAGONAL ARCHITECTURE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ @xhub-short/sdk โ โ
โ โ โโโโโโโโโโโโโโโโ โ โ
โ โ โ โ
โ โ ShortVideoProvider โโโโโโโฌโโโโโโโโ createSDK() โ โ
โ โ โ โ โ โ โ
โ โ โ Dependency Injection โ โ โ
โ โ โ โ โ โ โ
โ โ โผ โผ โผ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โ Hooks โ โ Core โ โ Adapters โ โ โ
โ โ โ (React) โโโโโโโถโ Managers โโโโโ (Inject) โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ @contracts โ โ @core โ โ @adapters โ โ
โ โ (Interfaces) โ โ (Domain) โ โ (Infrastructure) โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
``
@xhub-short/sdk
โโโ @xhub-short/contracts (types, interfaces)
โโโ @xhub-short/core (domain logic)
โโโ @xhub-short/adapters (mock + preset adapters)
โโโ @xhub-short/ui (headless components)
โโโ react (peer dependency)
โโโ zustand (peer dependency)
`bash`
npm install @xhub-short/sdk
That's it! No other dependencies needed.
Bundled internally:
- zustand - state management (bundled in @xhub-short/core)clsx
- - class names utility (bundled in @xhub-short/ui)useTouchDrag
- Custom hook - gesture handling (bundled in @xhub-short/sdk)
---
`tsx`
| Hook | Mแปฅc ฤรญch |
|------|----------|
| useFeed() | Video list, pagination, loading states |usePlayer()
| | Playback control, time, volume, handlers |useResource()
| | DOM allocations, prefetch queue |useOptimistic()
| | Like/Follow vแปi instant UI + rollback |useSwipeGesture()
| | Vertical swipe navigation |
SDK exports pre-wired versions of UI components with SDK hooks already injected:
| Component | Description |
|-----------|-------------|
| VideoFeed | Wired VideoFeedHeadless with useFeed + useSwipeGesture |VideoSlot
| | Wired VideoSlotHeadless with useResourceAllocation + usePlayer |VideoPlayer
| | Wired VideoPlayerHeadless with usePlayer (auto-load, sync) |ProgressBar
| | Wired progress bar with Direct DOM Update (60fps smooth) |
#### VideoPlayer (Wired)
Pre-wired video player that auto-connects to SDK PlayerEngine.
`tsx
import { VideoSlot, VideoPlayer } from '@xhub-short/sdk';
import { VideoSlotPoster, VideoSlotOverlay } from '@xhub-short/ui';
function FeedItem({ video }) {
return (
/>
);
}
`
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| video | VideoItem | from context | Video to play (optional if inside VideoSlot) |autoLoad
| | boolean | true | Auto-load video into PlayerEngine |autoPlay
| | boolean | true | Auto-play when slot becomes active |resetOnInactive
| | boolean | true | Reset video to 0:00 when slot becomes inactive |loop
| | boolean | true | Loop video playback |muted
| | boolean | true | Start muted (required for autoplay) |
resetOnInactive behavior:
- true (default): TikTok-like - swiping back restarts video from beginningfalse
- : YouTube-like - video continues from where user left off
#### ProgressBar (Wired) - P11 Re-render Optimization
Pre-wired progress bar that uses Direct DOM Update for 60fps smooth animation.
`tsx
import { VideoSlot, VideoPlayer, ProgressBar } from '@xhub-short/sdk';
import { VideoSlotOverlay } from '@xhub-short/ui';
function FeedItem({ video }) {
return (
);
}
`
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| seekable | boolean | true | Enable click/drag to seek |showTime
| | boolean | false | Show current/duration text |showTooltip
| | boolean | true | Show tooltip on hover |minimal
| | boolean | false | Thin bar without handle |
Performance Architecture:
``
PlayerEngine.store โโโโโ subscribe() โโโโโ fillRef.style.transform
(scaleX, GPU accelerated)
NOT React re-render!
This component demonstrates ADR 005: Direct DOM Manipulation for high-frequency updates.
See docs/issues/RE_RENDER_ANALYSIS.md for detailed optimization rationale.
`typescript`
const sdk = createSDK({
preset: { baseUrl, auth, endpoints }, // Auto-generate adapters
adapters: { dataSource, interaction }, // Or custom adapters
feed: { pageSize: 20 },
player: { autoplay: true },
});
---
``
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ INITIALIZATION โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ 1. Host App mount
โ โ โ
โ โผ โ
โ 2. createSDK(config) โ
โ โโ Resolve adapters (preset โ browser adapters) โ
โ โโ Create Core managers: โ
โ โ โโ FeedManager (video list, deduplication, GC) โ
โ โ โโ PlayerEngine (playback state machine) โ
โ โ โโ ResourceGovernor (DOM allocation, prefetch) โ
โ โ โโ OptimisticManager (like/follow with rollback) โ
โ โ โโ LifecycleManager (session persistence) โ
โ โโ Wire analytics flush events โ
โ โ โ
โ โผ โ
โ 3. SDKContext.Provider value={sdk} โ
โ โ โ
โ โผ โ
โ 4. Hooks subscribe to managers via useSyncExternalStore โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
``
User swipes down
โ
โผ
useSwipeGesture() โโโโโโโโโโบ ResourceGovernor.setFocusedIndex(n+1)
โ
โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โผ โผ โผ
Deallocate Allocate Preload
video[n-1] video[n+1] video[n+2]
โ
โผ
PlayerEngine.load(video)
โ
โผ
Analytics.track('video_view')
---
`typescript`
export { ShortVideoProvider } from './provider';
export type { ShortVideoProviderProps, SDKConfig } from './provider';
`typescript
// Feed management
export { useFeed, useFeedSelector } from './hooks';
// Player control
export { usePlayer, usePlayerSelector, usePlayerForVideo } from './hooks';
// Resource management (DOM allocation)
export { useResource, useResourceSelector, useResourceAllocation } from './hooks';
// Optimistic UI (like/follow)
export { useOptimistic, useOptimisticSelector } from './hooks';
// Swipe navigation
export { useSwipeGesture } from './hooks';
// SDK context access
export { useSDK } from './hooks';
`
`typescript`
export { createSDK } from './store';
export type { SDKInstance } from './store';
`typescript
// From @xhub-short/contracts
export type { VideoItem, FeedResponse, IDataSource, ... } from '@xhub-short/contracts';
// From @xhub-short/core
export type { FeedState, PlayerState, ResourceState, ... } from '@xhub-short/core';
`
---
`tsx
import { ShortVideoRoot, VideoFeed, DefaultSlot } from '@xhub-short/sdk';
function App() {
return (
preset: {
baseUrl: 'https://api.example.com/v1',
auth: { getAccessToken: () => localStorage.getItem('token') },
endpoints: {
feed: { list: '/videos', detail: '/videos/:id' },
interaction: { like: '/videos/:id/like' },
},
},
}}
errorMode="auto-skip-with-toast"
>
index={index}
showBookmark={true}
onOpenComments={(videoId) => openSheet(videoId)}
onShare={(video) => shareVideo(video)}
/>
)} />
);
}
`
That's it! The SDK handles everything: video loading, HLS playback, swipe navigation, like/follow actions, error handling, and more.
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| video | VideoItem | required | Video data |index
| | number | required | Index in feed |showPoster
| | boolean | true | Show poster |showLikeAnimation
| | boolean | true | Double-tap hearts |showAuthorInfo
| | boolean | true | Avatar + follow |showActionBar
| | boolean | true | Like, comment, share |showVideoInfo
| | boolean | true | Caption, hashtags |showProgressBar
| | boolean | true | Progress bar |showBookmark
| | boolean | false | Bookmark button |onOpenComments
| | (videoId) => void | - | Comment click |onShare
| | (video) => void | - | Share click |onOpenProfile
| | (author) => void | - | Author click |onHashtagClick
| | (tag) => void | - | Hashtag click |
For full control, use individual components:
`tsx
import {
ShortVideoRoot, VideoFeed, VideoSlot, VideoPlayer,
ActionBar, AuthorInfo, VideoInfo, ProgressBar
} from '@xhub-short/sdk';
import { VideoSlotOverlay, VideoSlotPoster } from '@xhub-short/ui';
)} />
`tsx`
adapters: {
dataSource: new MyGraphQLAdapter(),
interaction: new MyFlutterBridgeAdapter(),
},
}}
>
---
SDK hแป trแปฃ chแบฟ ฤแป khรกch cho phรฉp ngฦฐแปi dรนng chฦฐa ฤฤng nhแบญp xem video vร bรฌnh luแบญn (read-only). Cรกc tฦฐฦกng tรกc (Like, Comment, Follow) sแบฝ bแป chแบทn vร trigger callback ฤแป Host App xแปญ lรฝ (vรญ dแปฅ: hiแปn modal ฤฤng nhแบญp).
`tsx
// ...
guest: {
/**
* 'auto': Tแปฑ ฤแปng detect dแปฑa trรชn auth token (default)
* true: Force guest mode
* false: Disable guest mode
*/
mode: 'auto',
/**
* Callback khi guest thแปฑc hiแปn hร nh ฤแปng cแบงn auth (Like, Comment, Follow...)
*/
onAction: (action, context) => {
console.log('Guest Action:', action, context);
// VD: showLoginModal();
}
}
}}
>
`
- Follow: Trigger onAction
- Comment Input: Hiแปn thแป nรบt "Login to comment". Khi click triggers onAction (action='comment').---
โก Prefetch Data (Tแบฃi trฦฐแปc dแปฏ liแปu)
Cho phรฉp Host App tแบฃi trฦฐแปc dแปฏ liแปu Feed (Reels) ฤแป trแบฃi nghiแปm hiแปn thแป tแปฉc thรฌ (instant loading).
$3
Gแปi hร m
prefetchFeed trฦฐแปc khi mount SDK components (vรญ dแปฅ: khi hover vร o menu Reels hoแบทc trong route loader).`tsx
import { prefetchFeed } from '@xhub-short/sdk';// 1. Prefetch data (lฦฐu vร o bแป nhแป tแบกm)
// Cรณ thแป gแปi แป bแบฅt kแปณ ฤรขu trong Host App
await prefetchFeed(sdkConfig, { ttl: 5 60 1000 });
// ... Sau ฤรณ ...
// 2. Khi User vร o trang Reels, SDK sแบฝ tแปฑ ฤแปng dรนng data ฤรฃ fetch
`$3
- In-Memory Cache: Dแปฏ liแปu chแป lฦฐu tแบกm trong RAM, mแบฅt khi refresh trang (ฤแบฃm bแบฃo fresh data).
- Auto-Consume: ShortVideoRoot tแปฑ ฤแปng tiรชu thแปฅ cache vร xรณa sau khi dรนng.
- Performance: Giรบp giแบฃm thแปi gian chแป ฤแปฃi (LCP) xuแปng gแบงn bแบฑng 0 khi user chuyแปn trang.---
๐ Liรชn kแบฟt vแปi cรกc Packages
| Package | Quan hแป vแปi SDK |
|---------|-----------------|
|
@xhub-short/contracts | SDK re-export types/interfaces |
| @xhub-short/core | SDK wraps core managers vแปi React hooks |
| @xhub-short/adapters | SDK inject adapters vร o core managers |
| @xhub-short/ui | UI components sแปญ dแปฅng SDK hooks (Phase 4) |
| @xhub-short/bridge | Optional Flutter integration |$3
`
contracts โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฒ โ
โ โ
core โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โฒ โ โ
โ โ โ
adapters โโโโโโโโโโโโ โ โ
โฒ โ โ โ
โ โ โ โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโ sdk โโโโ
โ
โผ
Host App
`---
โ ๏ธ Lฦฐu รฝ quan trแปng
$3
- Tแบฅt cแบฃ hooks sแปญ dแปฅng useSyncExternalStore
- Provider render fallback trรชn server
- SDK instance chแป tแบกo trรชn client$3
- sdk.destroy() ฤฦฐแปฃc gแปi tแปฑ ฤแปng khi Provider unmount
- Max 3 video DOM nodes (via ResourceGovernor)
- LRU cache eviction trong FeedManager$3
`typescript
// โ DEPRECATED - Singleton gรขy issues vแปi SSR/testing
const sdk = getSDK(config);// โ
RECOMMENDED - Sแปญ dแปฅng Provider
``---
- ADD.md - System Architecture
- TECH_STACK.md - Technology Stack
- packages/core/README.md - Core Domain
- packages/adapters/README.md - Adapters