DashboardSupportWelcome

👤 USER DOCS

Getting Started

Daily Operations

Shift Workspace & TasksPre-Shift SetupLine-Up CardsShift ReportsForms

Staff & Locations

Staff SchedulingManaging Locations

Oversight

Manager ReportsAnalyticsPre-Shift & Compliance

Incidents & Feedback

Incident ReportingAnonymous FeedbackMessages & Announcements

AI & Settings

AI ChatgearApp Settings

Administration

Dashboard & OnboardingAdmin

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainNotifications DomainAudit Log & OptimizationDesign Audit Findings

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & NotificationsimageScreenshots

API Reference

API Reference

Endpoints

POS Sales APIOptimization Data APISchedule Shifts APIEmployee Export APIReports APIIncidents APIAI Chat APIPush Notifications APIWebhooks APICron API

Contributing

ContributingcodeCode Examples

Security

Security & Compliance
Danvas IconDanvas
Danvas IconDanvas

Locations Domain

Technical design of multi-location hierarchy and data isolation

Overview

The locations domain is the foundation of multi-tenancy in Danvas. It allows a single team (Clerk Organization) to manage multiple physical restaurant locations with strictly isolated operational data.

Database Schema

Locations (locations)

The central entity for physical sites.

ColumnTypeDescription
idtextPrimary key (UUID)
teamIdtextReferences teams.id (Clerk Org)
slugtextURL-friendly identifier
nametextHuman-readable name
timezonetextIANA timezone (e.g., America/Chicago)
brandColortextCustom UI color for the location

Multi-location Logic

Active Location Resolution

The application uses a utility getActiveLocation() to determine which site the user is currently interacting with.

  1. Preference: The user's primaryLocationId in their profile.
  2. Context: URL parameters or headers for specific requests.
  3. Fallback: The first location alphabetically assigned to the user.

Data Isolation

Isolation is enforced at the query level. Every table that stores location-specific data (reports, incidents, shifts) includes a locationId column.

Database Reference

Overview of the database schema and data model

Auth & RBAC

Technical design of Clerk integration and Role-Based Access Control

On this page

OverviewDatabase SchemaLocations (locations)Multi-location LogicActive Location ResolutionData IsolationUser PermissionsRelated
// Example: Fetching reports for current location
const activeLocation = await getActiveLocation();
const locationReports = await db.query.serverReports.findMany({
  where: and(
    eq(serverReports.teamId, teamId),
    eq(serverReports.locationId, activeLocation.id)
  )
});

User Permissions

Users are linked to locations via the locationIds array in the users table.

  • Global Admin: Can access all locations within the team.
  • Location Manager: Can access specific locations listed in their profile.
  • Staff: Typically assigned to a single primary location but can be authorized for multiple.

Related

Managing Locations Guide

Database Schema

Auth & RBAC