# duke-store/mikasa architecture

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

- Interactive diagram: https://gitdiagram.com/duke-store/mikasa
- Repository: https://github.com/duke-store/mikasa

## Overview

This is a Discord community bot centered on developer applications, project review, and a marketplace, with supporting tickets, moderation/protection, ratings, giveaways, and server utilities. The principal workflow collects an application through interactive questions, scans and evaluates it, then supports staff review and project follow-up. The graph also shows marketplace listing and purchase, plus shared persistence and selected community features. Source excerpts and the SOURCE INDEX establish the main application links; several command and event implementations were not sampled, so their internal relationships are omitted.

Main entry points: [`index.js`](https://github.com/duke-store/mikasa/blob/last-edit/index.js) (Discord interaction router), [`handlers/apply.js`](https://github.com/duke-store/mikasa/blob/last-edit/handlers/apply.js) (Application handler), [`db.js`](https://github.com/duke-store/mikasa/blob/last-edit/db.js) (Database access), [`marketplace/marketplace.js`](https://github.com/duke-store/mikasa/blob/last-edit/marketplace/marketplace.js) (Marketplace service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_applications["Applications and review"]
  node_apply_handler["Application handler<br/>[apply.js]"]
  node_question_flow["Question sessions<br/>[questionFlow.js]"]
  node_application_system["Application system<br/>[applySystem.js]"]
  node_portfolio_scanner["Portfolio scanner<br/>[index.js]"]
  node_scanner_keywords["Detection keywords<br/>[keywordSets.js]"]
  node_project_evaluator["AI project evaluator"]
  node_review_timer["Review timer"]
  node_review_command["Admin review<br/>[review.js]"]
  node_project_tickets["Project ticket flows<br/>[projectTicket.js]"]
end

subgraph group_marketplace["Project marketplace"]
  node_marketplace_commands["Marketplace commands<br/>[list.js]"]
  node_marketplace_service["Marketplace service<br/>[marketplace.js]"]
  node_marketplace_embed["Marketplace presentation"]
end

subgraph group_community["Community operations"]
  node_ticket_handler["Ticket handler<br/>[ticket.js]"]
  node_protection_events["Protection events"]
  node_giveaways["Giveaway system<br/>[giveaway.js]"]
  node_rating_ai["Rating AI responses<br/>[aiHandler.js]"]
  node_rating_context["Rating server context<br/>[serverContext.js]"]
end

subgraph group_platform["Bot and persistence"]
  node_bot_entry["Discord interaction router<br/>[index.js]"]
  node_db[("Database access<br/>[db.js]")]
  node_utils["Guild state and utilities<br/>[utils.js]"]
  node_config["Bot configuration<br/>[config.js]"]
  node_health_server["Health and admin server<br/>[server.js]"]
end

node_discord_user(("Discord user"))
node_ai_provider{{"AI provider APIs"}}

node_discord_user -->|"submits interactions"| node_bot_entry
node_bot_entry -->|"routes application flow"| node_apply_handler
node_bot_entry -->|"routes buyer flow"| node_project_tickets
node_bot_entry -->|"routes ticket flow"| node_ticket_handler
node_bot_entry -->|"handles DM chat"| node_rating_ai
node_apply_handler -->|"uses question sessions"| node_question_flow
node_apply_handler -->|"scans submissions"| node_portfolio_scanner
node_apply_handler -->|"requests evaluation"| node_project_evaluator
node_apply_handler -->|"schedules review"| node_review_timer
node_review_command -->|"manages review timer"| node_review_timer
node_apply_handler -->|"loads and saves projects"| node_db
node_portfolio_scanner -->|"uses detection terms"| node_scanner_keywords
node_project_evaluator -.->|"requests AI evaluation"| node_ai_provider
node_marketplace_commands -->|"lists products"| node_marketplace_service
node_marketplace_commands -->|"renders listings"| node_marketplace_embed
node_marketplace_service -->|"checks originality"| node_project_evaluator
node_marketplace_service -->|"writes marketplace data"| node_utils
node_project_tickets -->|"uses question sessions"| node_question_flow
node_project_tickets -.->|"uses marketplace service"| node_marketplace_service
node_protection_events -.->|"reads protection settings"| node_db
node_giveaways -->|"uses shared utilities"| node_utils
node_rating_ai -->|"loads server context"| node_rating_context
node_db -->|"uses guild settings"| node_utils
node_bot_entry -->|"uses persistence"| node_db
node_bot_entry -->|"uses bot configuration"| node_config
node_health_server -.->|"reports guild count"| node_db

click node_bot_entry "https://github.com/duke-store/mikasa/blob/last-edit/index.js"
click node_apply_handler "https://github.com/duke-store/mikasa/blob/last-edit/handlers/apply.js"
click node_question_flow "https://github.com/duke-store/mikasa/blob/last-edit/questionFlow.js"
click node_application_system "https://github.com/duke-store/mikasa/blob/last-edit/applySystem.js"
click node_portfolio_scanner "https://github.com/duke-store/mikasa/blob/last-edit/portfolioScanner/index.js"
click node_scanner_keywords "https://github.com/duke-store/mikasa/blob/last-edit/portfolioScanner/utils/keywordSets.js"
click node_project_evaluator "https://github.com/duke-store/mikasa/blob/last-edit/aiAgents/projectEvaluator.js"
click node_review_timer "https://github.com/duke-store/mikasa/blob/last-edit/adminReviewTimer.js"
click node_review_command "https://github.com/duke-store/mikasa/blob/last-edit/commands/admin/review.js"
click node_project_tickets "https://github.com/duke-store/mikasa/blob/last-edit/projectTicket.js"
click node_marketplace_commands "https://github.com/duke-store/mikasa/blob/last-edit/commands/marketplace/list.js"
click node_marketplace_service "https://github.com/duke-store/mikasa/blob/last-edit/marketplace/marketplace.js"
click node_marketplace_embed "https://github.com/duke-store/mikasa/blob/last-edit/marketplace/templates/marketplaceEmbed.js"
click node_ticket_handler "https://github.com/duke-store/mikasa/blob/last-edit/handlers/ticket.js"
click node_protection_events "https://github.com/duke-store/mikasa/blob/last-edit/protectionEvents.js"
click node_giveaways "https://github.com/duke-store/mikasa/blob/last-edit/giveaway.js"
click node_rating_ai "https://github.com/duke-store/mikasa/blob/last-edit/ratingSystem/aiHandler.js"
click node_rating_context "https://github.com/duke-store/mikasa/blob/last-edit/ratingSystem/serverContext.js"
click node_db "https://github.com/duke-store/mikasa/blob/last-edit/db.js"
click node_utils "https://github.com/duke-store/mikasa/blob/last-edit/utils.js"
click node_config "https://github.com/duke-store/mikasa/blob/last-edit/config.js"
click node_health_server "https://github.com/duke-store/mikasa/blob/last-edit/server.js"

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_apply_handler,node_question_flow,node_application_system,node_portfolio_scanner,node_scanner_keywords,node_project_evaluator,node_review_timer,node_review_command,node_project_tickets,node_discord_user toneBlue
class node_marketplace_commands,node_marketplace_service,node_marketplace_embed toneAmber
class node_ticket_handler,node_protection_events,node_giveaways,node_rating_ai,node_rating_context,node_ai_provider toneMint
class node_bot_entry,node_db,node_utils,node_config,node_health_server toneRose
```

## Components

### Applications and review

- [Application handler](https://github.com/duke-store/mikasa/blob/last-edit/handlers/apply.js): `handlers/apply.js`
- [Question sessions](https://github.com/duke-store/mikasa/blob/last-edit/questionFlow.js): `questionFlow.js`
- [Application system](https://github.com/duke-store/mikasa/blob/last-edit/applySystem.js): `applySystem.js`
- [Portfolio scanner](https://github.com/duke-store/mikasa/blob/last-edit/portfolioScanner/index.js): `portfolioScanner/index.js`
- [Detection keywords](https://github.com/duke-store/mikasa/blob/last-edit/portfolioScanner/utils/keywordSets.js): `portfolioScanner/utils/keywordSets.js`
- [AI project evaluator](https://github.com/duke-store/mikasa/blob/last-edit/aiAgents/projectEvaluator.js): `aiAgents/projectEvaluator.js`
- [Review timer](https://github.com/duke-store/mikasa/blob/last-edit/adminReviewTimer.js): `adminReviewTimer.js`
- [Admin review](https://github.com/duke-store/mikasa/blob/last-edit/commands/admin/review.js): `commands/admin/review.js`
- [Project ticket flows](https://github.com/duke-store/mikasa/blob/last-edit/projectTicket.js): `projectTicket.js`

### Project marketplace

- [Marketplace commands](https://github.com/duke-store/mikasa/blob/last-edit/commands/marketplace/list.js): `commands/marketplace/list.js`
- [Marketplace service](https://github.com/duke-store/mikasa/blob/last-edit/marketplace/marketplace.js): `marketplace/marketplace.js`
- [Marketplace presentation](https://github.com/duke-store/mikasa/blob/last-edit/marketplace/templates/marketplaceEmbed.js): `marketplace/templates/marketplaceEmbed.js`

### Community operations

- [Ticket handler](https://github.com/duke-store/mikasa/blob/last-edit/handlers/ticket.js): `handlers/ticket.js`
- [Protection events](https://github.com/duke-store/mikasa/blob/last-edit/protectionEvents.js): `protectionEvents.js`
- [Giveaway system](https://github.com/duke-store/mikasa/blob/last-edit/giveaway.js): `giveaway.js`
- [Rating AI responses](https://github.com/duke-store/mikasa/blob/last-edit/ratingSystem/aiHandler.js): `ratingSystem/aiHandler.js`
- [Rating server context](https://github.com/duke-store/mikasa/blob/last-edit/ratingSystem/serverContext.js): `ratingSystem/serverContext.js`

### Bot and persistence

- [Discord interaction router](https://github.com/duke-store/mikasa/blob/last-edit/index.js): `index.js`
- [Database access](https://github.com/duke-store/mikasa/blob/last-edit/db.js): `db.js`
- [Guild state and utilities](https://github.com/duke-store/mikasa/blob/last-edit/utils.js): `utils.js`
- [Bot configuration](https://github.com/duke-store/mikasa/blob/last-edit/config.js): `config.js`
- [Health and admin server](https://github.com/duke-store/mikasa/blob/last-edit/server.js): `server.js`

### Other components

- **Discord user**
- **AI provider APIs**

## Connections

- Discord user → Discord interaction router: submits interactions (evidence: `index.js`)
- Discord interaction router → Application handler: routes application flow (evidence: `index.js`)
- Discord interaction router → Project ticket flows: routes buyer flow (evidence: `index.js`)
- Discord interaction router → Ticket handler: routes ticket flow (evidence: `index.js`)
- Discord interaction router → Rating AI responses: handles DM chat (evidence: `index.js`)
- Application handler → Question sessions: uses question sessions (evidence: `handlers/apply.js`)
- Application handler → Portfolio scanner: scans submissions
- Application handler → AI project evaluator: requests evaluation (evidence: `handlers/apply.js`)
- Application handler → Review timer: schedules review (evidence: `handlers/apply.js`)
- Admin review → Review timer: manages review timer (evidence: `commands/admin/review.js`)
- Application handler → Database access: loads and saves projects (evidence: `handlers/apply.js`)
- Portfolio scanner → Detection keywords: uses detection terms (evidence: `portfolioScanner/index.js`)
- AI project evaluator → AI provider APIs: requests AI evaluation
- Marketplace commands → Marketplace service: lists products (evidence: `commands/marketplace/list.js`)
- Marketplace commands → Marketplace presentation: renders listings (evidence: `commands/marketplace/list.js`)
- Marketplace service → AI project evaluator: checks originality (evidence: `marketplace/marketplace.js`)
- Marketplace service → Guild state and utilities: writes marketplace data (evidence: `marketplace/marketplace.js`)
- Project ticket flows → Question sessions: uses question sessions (evidence: `projectTicket.js`)
- Project ticket flows → Marketplace service: uses marketplace service (evidence: `projectTicket.js`)
- Protection events → Database access: reads protection settings
- Giveaway system → Guild state and utilities: uses shared utilities (evidence: `giveaway.js`)
- Rating AI responses → Rating server context: loads server context (evidence: `ratingSystem/aiHandler.js`)
- Database access → Guild state and utilities: uses guild settings (evidence: `db.js`)
- Discord interaction router → Database access: uses persistence (evidence: `index.js`)
- Discord interaction router → Bot configuration: uses bot configuration (evidence: `index.js`)
- Health and admin server → Database access: reports guild count
