Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cloud-docs.mentra.glass/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Organization model enables enterprise deployments and team collaboration. It groups users together and provides shared ownership of apps.

Schema Structure

Core Fields

{
  name: string,              // Display name
  slug: string,             // URL-safe identifier
  profile: {                // Public profile
    website?: string,
    contactEmail: string,   // Required for app publishing
    description?: string,
    logo?: string
  },
  members: [{               // Organization members
    user: ObjectId,         // Reference to User
    role: 'admin' | 'member',
    joinedAt: Date
  }],
  pendingInvites: [{        // Unaccepted invitations
    email: string,
    role: 'admin' | 'member',
    token: string,          // JWT for acceptance
    invitedBy: ObjectId,
    invitedAt: Date,
    expiresAt: Date,
    emailSentCount: number,
    lastEmailSentAt?: Date
  }]
}

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:
// App model references organization
{
  organizationId: ObjectId('org123'),
  // Previously: developerId: 'user@example.com'
}

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

// Find user's organizations
Organization.findByMember(userId)

// Check permissions
Organization.hasRole(orgId, userId, 'admin')

// Validate membership
Organization.isMember(orgId, userId)

Slug Generation

Converts organization names to URL-safe identifiers:
  • “Mentra Labs” → “mentra-labs”
  • “AI Vision Inc.” → “ai-vision-inc”
  • Ensures uniqueness across system