Templates/Work & productivity

Task lists (Firestore) database schema

Workspaces, their projects and tasks, with due-date queries indexed and finished tasks expiring.

3 collections, 0 references

Opens as a new diagram you can change. Free.

Collections

workspaces

A team's space; roles map user ids to their role.

  • idstring not null
  • namestring not null
  • rolesmap not null
  • createdAttimestamp not null

workspaces/projects

Projects inside a workspace.

  • idstring not null
  • namestring not null
  • colourstring
  • archivedboolean not null

workspaces/projects/tasks

Tasks; done ones are deleted by a TTL policy a month after.

  • idstring not null
  • titlestring not null
  • assigneeIdstring
  • doneboolean not null
  • dueAttimestamp
  • labelsarray
  • purgeAttimestamp

As firestore.indexes.json

The diagram also exports firestore.rules skeleton, TypeScript types and converters, Zod schemas, Sample documents (JSON).

{
  "indexes": [
    {
      "collectionGroup": "tasks",
      "queryScope": "COLLECTION_GROUP",
      "fields": [
        {
          "fieldPath": "assigneeId",
          "order": "ASCENDING"
        },
        {
          "fieldPath": "done",
          "order": "ASCENDING"
        },
        {
          "fieldPath": "dueAt",
          "order": "ASCENDING"
        }
      ]
    },
    {
      "collectionGroup": "tasks",
      "queryScope": "COLLECTION",
      "fields": [
        {
          "fieldPath": "done",
          "order": "ASCENDING"
        },
        {
          "fieldPath": "dueAt",
          "order": "ASCENDING"
        }
      ]
    }
  ],
  "fieldOverrides": [
    {
      "collectionGroup": "tasks",
      "fieldPath": "purgeAt",
      "ttl": true,
      "indexes": []
    }
  ]
}

More Work & productivity templates

Start with one diagram, free

One diagram with two branches, no card needed. Upgrade when your team needs more.