# neoactyl/panel architecture

> Architecture diagram of the GitHub repository neoactyl/panel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/neoactyl/panel
- Repository: https://github.com/neoactyl/panel

## Overview

Neoactyl is a game-hosting management panel for users and hosting administrators. The main user workflow is to choose server software or a storefront plan, create and manage a server through a backend adapter, and use credits for purchases or renewals. Separate product branches cover AFK earnings, Discord rewards and administration, ads, and system administration. The README documents these capabilities; source excerpts show adapter requests and AFK payout internals. Several route-to-service connections are not shown, so those relationships are omitted rather than inferred.

Main entry points: [`src/lib/server/afk/service.ts`](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/service.ts) (AFK earnings), [`src/routes/(app)/server`](https://github.com/neoactyl/panel/tree/main/src/routes/(app)/server) (Server pages), [`src/lib/adapter/client.ts`](https://github.com/neoactyl/panel/blob/main/src/lib/adapter/client.ts) (Adapter client), [`src/routes/api/adapter/+server.ts`](https://github.com/neoactyl/panel/blob/main/src/routes/api/adapter/%2Bserver.ts) (Adapter API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Panel Experience"]
  node_app["Panel pages"]
  node_auth["Authentication"]
  node_ads["Panel ads<br/>[ads.ts]"]
end

subgraph group_servers["Server Management"]
  node_serverroutes["Server pages"]
  node_adapterclient["Adapter client<br/>[client.ts]"]
  node_adapterapi["Adapter API<br/>[+server.ts]"]
  node_adapterimpl["Backend adapters<br/>[adapters.ts]"]
  node_software["Software catalog<br/>[software-policy.ts]"]
end

subgraph group_economy["Economy and Rewards"]
  node_storefront["Storefront<br/>[billing.ts]"]
  node_credits["Credits<br/>[credits.ts]"]
  node_renewals["Server renewals"]
  node_afk["AFK earnings<br/>[service.ts]"]
  node_afkconfig["AFK rules<br/>[config.ts]"]
  node_afkpayout["AFK payout<br/>[payout.ts]"]
  node_afktoken["AFK tickets<br/>[token.ts]"]
  node_afkgateway["AFK gateway<br/>[gateway.ts]"]
  node_discord["Discord rewards"]
end

subgraph group_operations["Platform Operations"]
  node_discordadmin["Discord commands<br/>[commands.ts]"]
  node_adminroutes["Admin pages"]
  node_database[("Application database<br/>[connection.ts]")]
  node_lifecycle["Background lifecycle<br/>[lifecycle.ts]"]
end

node_user(("Panel user"))
node_admin(("Administrator"))
node_stripe["Stripe"]
node_discordservice["Discord"]

node_user -->|"uses"| node_app
node_admin -->|"administers"| node_adminroutes
node_user -.->|"authenticates"| node_auth
node_user -->|"buys plans"| node_storefront
node_user -->|"manages servers"| node_serverroutes
node_serverroutes -.->|"requests backend operations"| node_adapterclient
node_adapterclient -->|"POSTs requests"| node_adapterapi
node_adapterapi -.->|"dispatches operations"| node_adapterimpl
node_user -->|"selects software"| node_software
node_user -->|"uses credits"| node_credits
node_user -->|"renews servers"| node_renewals
node_user -->|"earns credits"| node_afk
node_afk -->|"reads rules"| node_afkconfig
node_afk -->|"computes payout"| node_afkpayout
node_afk -->|"signs tickets"| node_afktoken
node_afk -->|"grants credits"| node_credits
node_afk -->|"reads and writes"| node_database
node_afkgateway -.->|"verifies tickets"| node_afktoken
node_user -->|"earns invite rewards"| node_discord
node_discord -->|"uses Discord"| node_discordservice
node_admin -->|"runs commands"| node_discordadmin
node_admin -->|"configures ads"| node_ads
node_user -->|"purchases credits"| node_stripe
node_storefront -.->|"charges payments"| node_stripe
node_lifecycle -.->|"starts embedded bot"| node_discordadmin

click node_app "https://github.com/neoactyl/panel/tree/main/src/routes/(app)"
click node_auth "https://github.com/neoactyl/panel/tree/main/src/lib/server/auth"
click node_ads "https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/ads.ts"
click node_storefront "https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/billing.ts"
click node_credits "https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/credits.ts"
click node_renewals "https://github.com/neoactyl/panel/tree/main/src/lib/server/billing"
click node_afk "https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/service.ts"
click node_afkconfig "https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/config.ts"
click node_afkpayout "https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/payout.ts"
click node_afktoken "https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/token.ts"
click node_afkgateway "https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/gateway.ts"
click node_discord "https://github.com/neoactyl/panel/tree/main/src/lib/server/rewards"
click node_discordadmin "https://github.com/neoactyl/panel/blob/main/src/lib/server/discord/commands.ts"
click node_serverroutes "https://github.com/neoactyl/panel/tree/main/src/routes/(app)/server"
click node_adapterclient "https://github.com/neoactyl/panel/blob/main/src/lib/adapter/client.ts"
click node_adapterapi "https://github.com/neoactyl/panel/blob/main/src/routes/api/adapter/%2Bserver.ts"
click node_adapterimpl "https://github.com/neoactyl/panel/blob/main/src/lib/server/panel/adapters.ts"
click node_software "https://github.com/neoactyl/panel/blob/main/src/lib/server/catalog/software-policy.ts"
click node_adminroutes "https://github.com/neoactyl/panel/tree/main/src/routes/(app)/admin"
click node_database "https://github.com/neoactyl/panel/blob/main/src/lib/server/db/connection.ts"
click node_lifecycle "https://github.com/neoactyl/panel/blob/main/src/lib/server/lifecycle.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth,node_ads,node_user toneBlue
class node_serverroutes,node_adapterclient,node_adapterapi,node_adapterimpl,node_software toneAmber
class node_storefront,node_credits,node_renewals,node_afk,node_afkconfig,node_afkpayout,node_afktoken,node_afkgateway,node_discord toneMint
class node_discordadmin,node_adminroutes,node_database,node_lifecycle toneRose
class node_admin,node_stripe,node_discordservice toneIndigo
```

## Components

### Panel Experience

- [Panel pages](https://github.com/neoactyl/panel/tree/main/src/routes/(app)): `src/routes/(app)`
- [Authentication](https://github.com/neoactyl/panel/tree/main/src/lib/server/auth): `src/lib/server/auth`
- [Panel ads](https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/ads.ts): `src/lib/server/billing/ads.ts`

### Server Management

- [Server pages](https://github.com/neoactyl/panel/tree/main/src/routes/(app)/server): `src/routes/(app)/server`
- [Adapter client](https://github.com/neoactyl/panel/blob/main/src/lib/adapter/client.ts): `src/lib/adapter/client.ts`
- [Adapter API](https://github.com/neoactyl/panel/blob/main/src/routes/api/adapter/%2Bserver.ts): `src/routes/api/adapter/+server.ts`
- [Backend adapters](https://github.com/neoactyl/panel/blob/main/src/lib/server/panel/adapters.ts): `src/lib/server/panel/adapters.ts`
- [Software catalog](https://github.com/neoactyl/panel/blob/main/src/lib/server/catalog/software-policy.ts): `src/lib/server/catalog/software-policy.ts`

### Economy and Rewards

- [Storefront](https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/billing.ts): `src/lib/server/billing/billing.ts`
- [Credits](https://github.com/neoactyl/panel/blob/main/src/lib/server/billing/credits.ts): `src/lib/server/billing/credits.ts`
- [Server renewals](https://github.com/neoactyl/panel/tree/main/src/lib/server/billing): `src/lib/server/billing`
- [AFK earnings](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/service.ts): `src/lib/server/afk/service.ts`
- [AFK rules](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/config.ts): `src/lib/server/afk/config.ts`
- [AFK payout](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/payout.ts): `src/lib/server/afk/payout.ts`
- [AFK tickets](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/token.ts): `src/lib/server/afk/token.ts`
- [AFK gateway](https://github.com/neoactyl/panel/blob/main/src/lib/server/afk/gateway.ts): `src/lib/server/afk/gateway.ts`
- [Discord rewards](https://github.com/neoactyl/panel/tree/main/src/lib/server/rewards): `src/lib/server/rewards`

### Platform Operations

- [Discord commands](https://github.com/neoactyl/panel/blob/main/src/lib/server/discord/commands.ts): `src/lib/server/discord/commands.ts`
- [Admin pages](https://github.com/neoactyl/panel/tree/main/src/routes/(app)/admin): `src/routes/(app)/admin`
- [Application database](https://github.com/neoactyl/panel/blob/main/src/lib/server/db/connection.ts): `src/lib/server/db/connection.ts`
- [Background lifecycle](https://github.com/neoactyl/panel/blob/main/src/lib/server/lifecycle.ts): `src/lib/server/lifecycle.ts`

### Other components

- **Panel user**
- **Administrator**
- **Stripe**
- **Discord**

## Connections

- Panel user → Panel pages: uses (evidence: `README.md`)
- Administrator → Admin pages: administers (evidence: `README.md`)
- Panel user → Authentication: authenticates
- Panel user → Storefront: buys plans (evidence: `README.md`)
- Panel user → Server pages: manages servers (evidence: `README.md`)
- Server pages → Adapter client: requests backend operations
- Adapter client → Adapter API: POSTs requests (evidence: `src/lib/adapter/client.ts`)
- Adapter API → Backend adapters: dispatches operations
- Panel user → Software catalog: selects software (evidence: `README.md`)
- Panel user → Credits: uses credits (evidence: `README.md`)
- Panel user → Server renewals: renews servers (evidence: `README.md`)
- Panel user → AFK earnings: earns credits (evidence: `README.md`)
- AFK earnings → AFK rules: reads rules (evidence: `src/lib/server/afk/service.ts`)
- AFK earnings → AFK payout: computes payout (evidence: `src/lib/server/afk/service.ts`)
- AFK earnings → AFK tickets: signs tickets (evidence: `src/lib/server/afk/service.ts`)
- AFK earnings → Credits: grants credits (evidence: `src/lib/server/afk/service.ts`)
- AFK earnings → Application database: reads and writes (evidence: `src/lib/server/afk/service.ts`)
- AFK gateway → AFK tickets: verifies tickets
- Panel user → Discord rewards: earns invite rewards (evidence: `README.md`)
- Discord rewards → Discord: uses Discord (evidence: `README.md`)
- Administrator → Discord commands: runs commands (evidence: `README.md`)
- Administrator → Panel ads: configures ads (evidence: `README.md`)
- Panel user → Stripe: purchases credits (evidence: `README.md`)
- Storefront → Stripe: charges payments
- Background lifecycle → Discord commands: starts embedded bot
