Skip to main content

Overview

XyraPanel uses Drizzle ORM with PostgreSQL for type-safe database operations. All schemas are defined in server/database/schema.ts and provide full type inference throughout the application.

Authentication Tables

Users

Stores user accounts with authentication and profile information:
Role System: Users have both a role field (user/admin) and a rootAdmin boolean. Root admins have unrestricted access to all panel features.

Sessions

Manages active user sessions with metadata:

Session Metadata

Tracks detailed session information for security monitoring:

Accounts

Supports OAuth providers and account linking:

API Keys

Provides programmatic API access with rate limiting:

Two-Factor Authentication

Stores TOTP secrets and backup codes:

Server Management Tables

Wings Nodes

Defines Wings daemon nodes that host game servers:

Servers

Core server instances:

Server Limits

Resource constraints for each server:

Server Allocations

Network allocations (IP:Port) for servers:

Nest & Egg System

Nests

Game categories (e.g., Minecraft, Source Engine):

Eggs

Server configurations within nests:

Egg Variables

Environment variables for eggs:

Additional Features

Audit Events

Tracks all administrative actions:

Server Backups

Server Schedules

Type Inference

Drizzle provides automatic type inference for all database operations:
All timestamps use { mode: 'string' } to ensure consistent handling across the application. Dates are stored as ISO 8601 strings.

Relationships

Cascade Deletes

Many tables use onDelete: 'cascade' to automatically clean up related data:
  • Deleting a user cascades to: sessions, accounts, API keys, SSH keys, owned servers
  • Deleting a server cascades to: allocations, backups, schedules, databases, subusers
  • Deleting a node cascades to: allocations, mounted servers

Foreign Keys

Key relationships in the schema:

Next Steps

Wings Integration

Learn about Wings integration

Authentication

Explore the authentication system