jansathi-community-schema
v0.37.0
Published
Shared Zod schemas + TypeScript types for the Jansathi hyperlocal community feature (feed, posts, engagement, social graph, groups, communities).
Downloads
5,311
Maintainers
Readme
jansathi-community-schema
Shared Zod schemas + TypeScript types for the Jansathi hyperlocal community feature.
Consumed by reform-backend and every Jansathi product frontend. Single source of truth for:
- Feed — polymorphic union of posts, lost-and-found, and voice-box items
- Posts — text + media (10 images, 5 videos ≤10 min), with
visibilityLeveland area-lineage snapshot - Engagement — upvote toggle + 7-emoji reactions + comments with one-level reply nesting
- Social graph — Follow (one-way) + Connection (mutual handshake)
- Profiles — public / private toggle, viewer-relationship state
- Groups — user-created group chats wire-compatible with chat-server conversations
- Settings — profile privacy, default post visibility, notification preferences
- Reports — content moderation queue payloads
Visibility semantics
Posts carry a visibilityLevel ∈ { local, district, state, national, global } and an areaLineage snapshot at write time. The feed query uses cascade-upward semantics:
A viewer whose feed level is L sees posts at L and every broader level matching their area lineage.
So a viewer with level=local sees local + district + state + national + global content tied to their locality / village / urbanWard / etc.; a viewer with level=state sees state + national + global content tied to their state, etc.
Accepted Connections override the cascade entirely — friend posts always show regardless of level.
Build
npm install
npm run buildPublish (manual, not auto)
Bump version in package.json, then:
npm publish --access publicAfter publish, run npm install jansathi-community-schema@<version> in both reform-backend and any frontend that consumes it. Delete any nested node_modules inside the installed package to avoid duplicate Zod instances.
