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

Database Reference

Overview of the database schema and data model

Overview

Danvas uses PostgreSQL via Neon with Drizzle ORM for type-safe database access. The schema is split into domain modules under packages/database/src/schema/.

Technology

LayerChoice
DatabaseNeon PostgreSQL (serverless, branching)
ORMDrizzle ORM with @neondatabase/serverless
MigrationsDrizzle Kit (drizzle-kit generate / drizzle-kit push)
StudioDrizzle Studio (bun db:studio) at port 3005

Core Tables

TablePurpose
teamsRestaurant groups (one per Clerk org)
usersStaff members — linked to Clerk identities via clerkId
locationsRestaurant locations — each team can have multiple
server_reportsEnd-of-shift reports filed by staff (sales, ratings, notes)
manager_reportsDaily manager reports with employee reviews
incidentsSafety and operational incident reports
management_schedulesWeekly schedules for managers and staff
management_shiftsIndividual shifts within a management schedule
shift_task_definitionsDefinitions for recurring shift tasks
shift_task_instancesSpecific instances of shift tasks to be completed
complianceTracks whether staff have filed required reports
formsCustom form definitions (checklists, logs)
form_submissionsSubmitted form data
messagesInternal team messages and board announcements

Core Domain

Technical architecture and data models for Danvas domains

Locations Domain

Technical design of multi-location hierarchy and data isolation

On this page

OverviewTechnologyCore TablesMulti-tenant IsolationSchema ManagementSeed DataRelated
usage_trackingAI token usage tracking per user per day
slack_configsConfiguration for Slack webhook routing

Multi-tenant Isolation

All tables (except teams itself) include a teamId column. This column corresponds to the Clerk Organization ID.

  • Query Level: Every query MUST include a .where(eq(table.teamId, teamId)) clause.
  • Middleware Level: The teamId is resolved from the Clerk session and passed to Server Actions and API routes.

Schema Management

# Development — push changes directly to Neon
bun db:push

# Production — generate migration files
bun db:generate

# Apply pending migrations
bun db:migrate

Seed Data

bun db:seed          # Seed 5 sample locations
bun db:seed-forms    # Seed Opening Checklist + Daily Standup forms + sample submissions
bun db:seed-q12      # Seed Q12 Gallup Survey
bun db:seed-survey   # Seed Customer Feedback + NPS surveys
bun db:seed-coupons  # Seed coupon theme data + sample coupon
bun db:seed-slack-routes # Seed Slack routing (requires SLACK_BOT_TOKEN + tmp/slack_routes_seed.csv)

Related

Architecture Overview

Multi-location Model

Audit & Compliance