Danvas
Danvas
DashboardSupportWelcome

👤 USER DOCS

User Guides

Getting Started

Getting StartedDashboard & OnboardingApp Settings

Tutorials

Tutorial: Setting Up Shift Tasks & ClosersTutorial: Managing Incidents in the InboxTutorial: Tracking Compliance & Sync StatusTutorial: Operational Workflows with the AI AssistantTutorial: Building & Deploying Custom Checklists

Daily Operations (Staff)

Shift Workspace & TasksService Day SetupDaily Line-UpStaff Service Day ReportsForms

Communication & Chat

Messages & AnnouncementsUnified Operations InboxAI Assistant

Manager & Admin Guides

Daily Line-Up SetupStaff SchedulingManaging LocationsNPS and Guest FeedbackCouponsContacts and Guest HistoryManager CloseoutsDaily Line-Up & ComplianceAnalyticsIncident ReportingWhistleblower Concerns & FeedbackAdmin Tools

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewExplanation: AI Integration & Tenant SecurityExplanation: Dynamic Forms Engine DesignExplanation: Compliance Ledger DesignExplanation: Live Sync & Data FreshnessData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainUnified Operations InboxLive Sync Data FreshnessToast Sync PipelineNotifications DomainCoupons and Guest NPSAudit Log & Compliance ArchitectureDesign Audit FindingsAI Chat IntegrationAnalytics & Tips Integration

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & Offline ShellScreenshots

API Reference

API Reference

Endpoints

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

Contributing

ContributingCode Examples

Security

Security & Compliance

Release Notes

What's New

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 — a Canvas Forge tenant, not a 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)
teamIdtextConfigured logical tenant identifier; no persisted teams table
slugtextURL-friendly identifier (read-only in the UI; change requires a migration)
nametextHuman-readable name
addresstextMailing address (free-form, ≤500 chars)
timezonetextIANA timezone (e.g., America/Chicago) — validated by LocationSettingsSchema
brandColortextHex color used as the accent for the location (e.g., #F59E0B)
avatarUrltextPublic URL to a logo/avatar image — surfaced on the location card and settings form

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.

// 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

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