Social Layer for the M Framework
npm install @mframework/layer-social
---
@mframework/social — README.md ``md@mframework/social
A powerful, backend‑agnostic social integration layer for Meeovi.
Supports ATProto (Bluesky), Mastodon, WordPress/BuddyPress, and any custom social backend.
- Pluggable social providers
- Unified useSocial() composable
- Unified activity feed abstraction
- Caching (TTL‑based)
- Stale‑While‑Revalidate (SWR) background refresh
- Retry + exponential backoff
- Provider‑specific rate‑limit strategies
- Analytics hooks (per‑provider metrics)
- Unified error model
`sh
npm install @mframework/social
đź§© Usage
import { useSocial } from '@mframework/social'
const { getActivityFeed } = useSocial()
const feed = await getActivityFeed('sebastian')
🔌 Providers
export interface SocialProvider {
getProfile(handle: string): Promise
listPosts(handle: string): Promise
createPost?(content: string): Promise
}
Register:
registerSocialProvider('mastodon', MastodonProvider)
đź§ Advanced Features
Caching
cacheKey: atproto:posts:${handle}`,
ttlMs: 30000
SWR (Stale‑While‑Revalidate)
swr: true
Retry + Backoff
retry: true
Provider‑Specific Rate Limits
setRateLimit('mastodon', { maxRequests: 10, windowMs: 60000 })
Metrics
import { getMetrics } from '@mframework/social'
console.log(getMetrics('atproto'))
đź§± Folder Structure
Code
src/
providers/
config.
registry.
useSocial.
cache.
retry.
swr.
rateLimit.
metrics.
utils.