Overview
The Organization model enables enterprise deployments and team collaboration. It groups users together and provides shared ownership of apps.Schema Structure
Core Fields
Field Purposes
name & slug
- name: Human-readable organization name
- slug: URL-safe identifier (e.g., “mentra-labs” from “Mentra Labs”)
- Used in: Developer portal URLs, API references
profile
Organization’s public information displayed in app store:- contactEmail: Required for app store publishing, support contact
- website: Company website for credibility
- description: About the organization
- logo: Visual identity in app listings
members
Array tracking organization membership:- user: Reference to User document
- role: Permission level (admin can manage org, member can publish apps)
- joinedAt: Membership start date
pendingInvites
Manages invitation workflow:- email: Invitee’s email address
- token: Secure acceptance token
- expiresAt: Invitation validity period
- emailSentCount: Retry tracking for failed deliveries
Usage Patterns
App Publishing
Organizations own apps instead of individual developers:Team Collaboration
Multiple developers can work on same apps:- Admins: Manage members, apps, billing
- Members: Publish and update apps
Enterprise Features
- Centralized app management
- Shared API keys
- Team-wide analytics
- Consolidated billing
Relationships
With Users
- Many-to-many via members array
- Each user has a defaultOrg (personal organization)
- Users can belong to multiple organizations
With Apps
- One-to-many: Organization owns many apps
- Apps published under organization name
- Shared across all organization members
Common Queries
Slug Generation
Converts organization names to URL-safe identifiers:- “Mentra Labs” → “mentra-labs”
- “AI Vision Inc.” → “ai-vision-inc”
- Ensures uniqueness across system