Skip to content

How to add new feature modules

LeNDuyA edited this page Dec 2, 2025 · 10 revisions
---
title: Client-feature architecture
---
graph TB
    discordBot[Discord Bot]
    
    subgraph "Wrapper interface"
        registeredFeature[RegisteredFeature<br/>+ commands<br/>+ featureInfo]
    end
    
    subgraph "Features"
        glossaryInfil[feat/GlossaryInfil]
        wikiWavu[feat/WikiWavu]
        yourService[feat/YourService]
    end
    
    subgraph "Sources"
        apiGlossary[Glossary API]
        apiWavu[Wavu API]
        apiYour[Your API]
    end
    
    discordBot <-->|n:n| registeredFeature
    
    glossaryInfil -.->|implements| registeredFeature
    wikiWavu -.->|implements| registeredFeature
    yourService -.->|implements| registeredFeature
    
    glossaryInfil -->|pulls data| apiGlossary
    wikiWavu -->|pulls data| apiWavu
    yourService -->|pulls data| apiYour
    
    style discordBot fill:#3B82F6,stroke:#2563EB,color:#fff
    style registeredFeature fill:#F59E0B,stroke:#D97706,color:#fff
    style glossaryInfil fill:#10B981,stroke:#059669,color:#fff
    style wikiWavu fill:#10B981,stroke:#059669,color:#fff
    style yourService fill:#6B7280,stroke:#4B5563,color:#fff,stroke-dasharray: 5 5
    style apiGlossary fill:#8B5CF6,stroke:#7C3AED,color:#fff
    style apiWavu fill:#8B5CF6,stroke:#7C3AED,color:#fff
    style apiYour fill:#6B7280,stroke:#4B5563,color:#fff,stroke-dasharray: 5 5
Loading

Core module (core/)

  1. Game - add the game if relevant

Feature module (feat/)

  1. create feature/yourNewFeature
  2. create the new module and its corresponding functionalities
  3. in build.gradle.kts I recommend adding the core module dependency - implementation(project(":core"))
  4. create a Koin module and add your classes

Bot (bot/discord)

  1. connect your feature module
    1. to the bot's gradle via build.gradle.kts
    2. to the bot's Koin module via dcBotModule.kt
      • if your feature uses any DI databases, you will need to add and use qualifiers
  2. /featureRegistry
    1. add your command via CommandRegistry.kt
    2. create /yourNewFeature/ directory
    3. create needed usecases
    4. register your usecases via featureRegistryModule.kt
    5. create YourNewFeatureDiscordFeature and implement DiscordRegisteredFeature interface
  3. /res/config.json
    1. register your feature
      • your name must match FeatureInfo.name

Apps (composeApp/commonMain)

  1. connect your feature module
    1. to the app's gradle via build.gradle.kts
    2. to the app's Koin module via Module.kt
      • if your feature uses any DI databases, you will need to add and use qualifiers
  2. /featureRegistry/
    1. create /yourNewFeature/
    2. create needed usecases
    3. /ui/
      1. create ViewState, ViewModel and View for the Home screen
        • for the View, you can use FeatureInfoHeader and CharacterOverview composable components
    4. create YourNewFeatureComposeRegisteredFeature and implement ComposeRegisteredFeature interface
      • if you want to navigate to Destination.MoveList, you must provide the qualifier you added in Apps-1.2.
  3. composeResources
    1. register your feature
      • your name must match FeatureInfo.name

Clone this wiki locally