HomeDocsDevelopmentProject Structure
Development

Project Structure

Codebase layout, module system, and key files.

bthavanishBy bthavanish

Project Structure

Top-Level Layout

panel/
├── src/                   # TypeScript source code
├── views/                 # EJS templates
├── public/                # Static assets (CSS, JS, images)
├── storage/               # Prisma schema and migrations
├── tests/                 # Test files
├── dist/                  # Compiled output (generated)
├── package.json           # Dependencies and scripts
├── tsconfig.json          # TypeScript config
├── example.env            # Environment template
└── .env                   # Your environment config

Source Code (src/)

Modules (src/modules/)

Each feature is a module (a TypeScript object with an info block and a router factory).

Admin modules (src/modules/admin/):

  • activity (activity log viewer)
  • addons (addon management)
  • analytics (analytics dashboard)
  • apiKeys (API key management)
  • databases (database host management)
  • images (image/egg management)
  • locations (location management)
  • menu (admin navigation menu)
  • mounts (mount management)
  • nodes (node management)
  • overview (admin dashboard)
  • playerStats (player statistics)
  • radar (security scanner)
  • security (security settings)
  • servers (server management)
  • settings (panel settings)
  • uiComponents (UI component library)
  • users (user management)

API modules (src/modules/api/):

  • v2/ (V2 REST API: servers, files, databases, backups, schedules, subusers, startup, account, passkey, system, admin)
  • Alternative/ (alternative API)
  • client/ (client API)

Auth modules (src/modules/auth/):

  • auth (login and registration pages)
  • authService (authentication service: login, register, logout handlers)
  • passwordReset (password reset flow)

Core (src/modules/core.ts): Core middleware, settings loader, session configuration.

Realtime (src/modules/realtime.ts): WebSocket server for console streaming and notifications.

User modules (src/modules/user/):

  • account (account settings page)
  • createServer (server creation wizard)
  • dashboard (user dashboard)
  • folderSystem (server folder management)
  • images (user image management)
  • server (server management pages)
  • serverConsole (console and power controls)
  • sftp (SFTP credential management)
  • twoFactor (2FA setup page)
  • wsUsers (WebSocket user tracking)

Services (src/services/)

Business logic layer:

ServicePurpose
backupServiceBackup creation and restore
daemonServiceHTTP client for node daemons
databaseServiceDatabase host operations
fileServiceFile operations
jobQueueBackground job processing
nodeServiceNode health and stats
realtimePubSubWebSocket pub/sub
roleServiceRole management
scheduleServiceCron job execution
serverServiceServer lifecycle
settingsServicePanel settings
startupServiceServer startup config
subuserServiceSub-user management
userServiceUser CRUD and limits

Handlers (src/handlers/)

Middleware and utilities:

HandlerPurpose
cacheRedis cache wrapper
databaseLoaderPrisma client singleton
envLoaderEnvironment variable loading
errorPages404 and 500 error pages
featuresFeature flag checking
imagesCacheImage cache management
installQueueServer installation queue
jobRegistryBackground job registry
loggerWinston logger
moduleInitModule type definitions
modulesLoaderModule discovery and mounting
nodesCacheNode connection cache
permissionsPermission system
playerStatsCollectorPlayer count collection
queueerJob queue management
redisRedis client
renderResolverTemplate resolution
runtimeQueueRuntime job queue
schedulerWorkerCron schedule executor
securityCacheSecurity cache (rate limits, bans)
sessionStoreSession configuration
settingsCacheSettings cache
settingsLoaderSettings initialization
uiComponentHandlerUI component system
updaterAuto-update system

Utils (src/handlers/utils/)

UtilPurpose
auth/authUtilSession authentication middleware
auth/authorizationPermission checking
auth/serverAuthUtilSub-user permission checking
api/apiValidatorAPI key validation
egg/eggParserPterodactyl egg format parser
ipIP address utilities

Views (views/)

EJS templates organized by section:

  • admin/ (admin panel pages, 14 sections)
  • user/ (user-facing pages: dashboard, server management, account)
  • auth/ (login, register, 2FA pages)
  • components/ (shared UI components)
  • errors/ (error pages: 404, 500)
  • fragments/ (reusable template fragments)

Database (storage/prisma/)

The Prisma schema defines all database models. See database.md for the full schema reference.