Stood Data model

Stood CRM Data Model

Overview

Stood is a Customer Relationship Management (CRM) system built on Firebase Firestore. The data model is designed around core business entities: Accounts, Contacts, Deals, Activities, Posts, Users, and Teams. All data is stored as JSON documents in Firestore collections with consistent field naming and structure.

Firestore Collections

1. accounts

Purpose: Companies or organizations

Document Structure:

{
"name": "string",
"location": "string | null",
"website": "string | null",
"description": "string",
"parent": "string | null",
"archived": "boolean"
}

Fields:

2. contacts

Purpose: Individual people associated with accounts

Document Structure:

{
"firstName": "string | null",
"lastName": "string | null",
"account": "string",
"email": "string | null",
"phone": "string | null",
"role": "string | null",
"location": "string | null",
"archived": "boolean",
"team": "string",
"activations": ["string"]
}

Fields:

3. deals

Purpose: Sales opportunities and transactions

Document Structure:

{
"name": "string",
"account": "string",
"amount": "number",
"stage": "string",
"description": "string",
"solution": "string | null",
"creationDate": "timestamp",
"closingDate": "timestamp",
"relatedContacts": ["string"],
"tags": ["string"],
"team": "string",
"owner": "string | null",
"parent": "string | null"
}

Fields:

4. activities

Purpose: Tasks and actions related to deals/contacts

Document Structure:

{
"todo": "string",
"account": "string",
"contact": "string",
"deal": "string",
"comments": "string",
"date": "timestamp",
"status": "string",
"owner": "string",
"team": "string"
}

Fields:

5. posts

Purpose: Communication threads within deals

Document Structure:

{
"content": "string",
"deal": "string",
"sentAt": "timestamp",
"comments": ["object"],
"author": "string",
"generated": "boolean",
"meta": "object | null"
}

Fields:

6. users

Purpose: System users and their preferences

Document Structure:

{
"firstname": "string",
"lastname": "string",
"starredDeals": ["string"],
"teams": ["string"],
"admin": "boolean",
"avatarBytes": "string | null",
"email": "string | null"
}

Fields:

Note: Document ID matches Firebase Auth UID

7. teams

Purpose: Organizational units with specific roles

Document Structure:

{
"name": "string",
"authorizedEmails": ["string"],
"apiKey": "string | null",
"category": "string",
"nextTeam": "string | null"
}

Fields:

Field Value Enumerations

Activity Status Values

Deal Stage Values

Team Category Values

Document Relationships

teams (1) ──→ (N) users
teams (1) ──→ (N) deals
teams (1) ──→ (N) contacts
teams (1) ──→ (N) activities
accounts (1) ──→ (N) contacts
accounts (1) ──→ (N) deals
accounts (1) ──→ (N) activities
deals (1) ──→ (N) activities
deals (1) ──→ (N) posts
deals (1) ──→ (N) contacts (via relatedContacts array)
users (1) ──→ (N) deals (via owner field)
users (1) ──→ (N) activities (via owner field)
users (1) ──→ (N) posts (via author field)
deals (1) ──→ (1) deals (via parent field - hierarchical)
accounts (1) ──→ (1) accounts (via parent field - hierarchical)

Firestore Storage Patterns

Data Types

Multi-Tenant Architecture

Data Access Patterns

Query Patterns

  1. User Authentication: Firebase Auth → user document lookup

  2. Team Assignment: User belongs to teams → data access scoped by team

  3. Document Creation: New documents inherit team context

  4. Cross-References: Related documents linked via document IDs

Performance Considerations

Extensibility Features

Best Practices

  1. Always set team context when creating documents

  2. Use document ID references to maintain relationships

  3. Implement soft deletes with archived flags

  4. Validate enum values against allowed string values

  5. Maintain referential integrity through document ID relationships

  6. Use consistent field naming across collections

  7. Handle null values gracefully in document structure


Contact - Stood CRM support & integration

Published with Nuclino