AI Draft
AI-assisted draft. This page is the fast explanation of how the package works.
Summary
Section titled “Summary”@lastshotlabs/slingshot-community is a full community/forum package built with definePackage(...). It models containers, threads, replies, reactions, moderation, bans, reports, memberships, rules, and notifications as entity definitions plus operations.
This package is important because it is both a product package and a proof point. It demonstrates that a real package with permissions, middleware, cascades, search, event wiring, notification side effects, and moderation workflows can run without hand-written route files.
Core Shape
Section titled “Core Shape”src/entities/defines the entities and their operations.src/plugin.tsis thecreateCommunityPackage()factory that returns aSlingshotPackageDefinition.src/middleware/holds the custom domain logic that config alone cannot express.src/lib/mentions.tsandsetupPost()handle side effects that consume emitted events.src/types/holds config, hook, and model types exposed to consumers.
Why It Depends On Auth
Section titled “Why It Depends On Auth”The package declares slingshot-auth as a dependency because community behavior assumes authenticated identities for membership, moderation, notifications, and real user-scoped actions. It also relies on auth-related contracts exposed through core for permission and identity resolution.
Design Pattern
Section titled “Design Pattern”The key split is:
- entity config handles route wiring, auth, permissions, events, cascades, and channel declarations
- middleware handles package-specific decision logic
setupPost()handles event consumers and notification side effects
That split keeps the package mostly declarative without pretending every rule can be reduced to config.
What Makes This Package Non-Trivial
Section titled “What Makes This Package Non-Trivial”- nine entities with different access patterns
- moderation and ban checks
- grant management
- reaction and notification workflows
- mention parsing and event-driven follow-up behavior
- search and realtime hooks layered on top of entity definitions
Reading Order
Section titled “Reading Order”src/plugin.tssrc/entities/src/middleware/docs/human/index.md
Good Follow-Ups
Section titled “Good Follow-Ups”- Use the human guide for the package invariants and the “what belongs in config vs code” rules.
- Use the generated docs for the public exports.
- Pair this package with
slingshot-entitydocs when making structural changes.