# jackdh/rasatalk architecture

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

- Interactive diagram: https://gitdiagram.com/jackdh/rasatalk
- Repository: https://github.com/jackdh/rasatalk

## Overview

##### Project type and purpose
- This is a full-stack, single-page React/Redux application (“app” folder) paired with an Express/MongoDB backend (“server” folder).
- Purpose: Rasa Talk is an on-premise dialog-management tool that sits on top of Rasa NLU. It provides a UI for creating agents, intents, entities, dialog nodes, and training Rasa models. It also supports hooking chatbots into third-party channels (Facebook, Telegram, etc.).

##### File structure
- Top-level folders:
- app – the React/Redux front end
- server – the Node/Express REST API & MongoDB integration
- internals – build, generator, testing, and CI scripts
- app/ contains: components (presentational), containers (Redux + sagas), configureStore, reducers, sagas, utils, translations, global styles, index.html
- server/ contains: Express app setup, authentication routes, mongo controllers & schemas, third-party adapters, middleware, API tests
- Docker and CI config in docker-compose.yml, .travis.yml, appveyor.yml

##### README for additional insights
- Confirms tech stack: React, Redux, Redux-Saga, Material-UI, Express, MongoDB, PassportJS, Docker, Rasa NLU
- Describes features: training-data generator, dialog management, webhook integrations, permission system, model training, analytics
- External dependencies: Rasa NLU service, MongoDB, optional Botkit for chat channels

##### Essential architectural elements
- Separate Presentation vs. Business logic: React components vs. Redux/Saga
- API segmentation: Auth, Agents, Intents, Dialog, Training, Chatbot testing, Third-Party integrations
- Service boundaries: MongoDB, Rasa NLU, Chat channels

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend SPA"
        SPA["Browser / React SPA"]:::frontend
        Components["React Presentational Components"]:::frontend
        Containers["Redux Containers & Sagas"]:::frontend
        Store["Redux Store Configuration"]:::frontend
        SagaUtils["Saga Injection & Utilities"]:::frontend
        BuildConfig["Webpack / Babel Build Config"]:::frontend
    end

    subgraph "Express API Server"
        API["Express Server"]:::backend
        Auth["Authentication Module (PassportJS)"]:::backend
        Middleware["Express Middleware Chain"]:::backend
        Router["MongoDB Router"]:::backend
        Controllers["MongoDB Controllers"]:::backend
        DirectUtils["MongoDB Direct Utilities"]:::backend
        Schemas["MongoDB Schemas"]:::backend
        DBUtils["MongoDB Utility Methods"]:::backend
        ThirdParty["Third-Party Chat Adapters"]:::backend
        APITests["Backend API Tests"]:::backend
    end

    subgraph "Infrastructure"
        MongoDB["MongoDB Database"]:::database
        Rasa["Rasa NLU Service"]:::external
        Channels["Third-Party Channels"]:::external
    end

    subgraph "DevOps & CI"
        DockerCompose["Docker Compose Orchestration"]:::external
        Dockerfile["Dockerfile for App/Server Images"]:::external
        CI["Continuous Integration Configurations"]:::external
        Scripts["Build / CI Helper Scripts & Generators"]:::external
    end

    %% Frontend Flows
    SPA -->|REST API calls| API
    Components -->|renders| Store
    Containers -->|dispatch actions| Store
    Containers -->|uses| SagaUtils
    Store -->|provides state| Components
    SagaUtils -->|injects sagas| Containers
    BuildConfig -->|builds| SPA

    %% Backend Flows
    API -->|uses| Middleware
    Middleware -->|protects| Auth
    API -->|routes| Router
    Router -->|invokes| Controllers
    Controllers -->|uses schemas| Schemas
    Controllers -->|calls utils| DBUtils
    Controllers -->|direct operations| DirectUtils
    Controllers -->|CRUD| MongoDB
    API -->|HTTP training & parse| Rasa
    API -->|webhooks/SDK| Channels
    Channels <-->|bidirectional| API

    %% DevOps Flows
    DockerCompose -.-> SPA
    DockerCompose -.-> API
    DockerCompose -.-> MongoDB
    DockerCompose -.-> Rasa
    Dockerfile -.-> SPA
    Dockerfile -.-> API
    CI -.-> Scripts
    Scripts -.-> SPA
    Scripts -.-> API

    %% Click Events
    click SPA "https://github.com/jackdh/rasatalk/tree/master/app/"
    click Components "https://github.com/jackdh/rasatalk/tree/master/app/components/"
    click Containers "https://github.com/jackdh/rasatalk/tree/master/app/containers/"
    click Store "https://github.com/jackdh/rasatalk/blob/master/app/configureStore.js"
    click SagaUtils "https://github.com/jackdh/rasatalk/blob/master/app/utils/injectSaga.js"
    click BuildConfig "https://github.com/jackdh/rasatalk/blob/master/internals/webpack/webpack.base.babel.js"
    click API "https://github.com/jackdh/rasatalk/blob/master/server/index.js"
    click Auth "https://github.com/jackdh/rasatalk/tree/master/server/authentication/"
    click Middleware "https://github.com/jackdh/rasatalk/tree/master/server/middlewares/"
    click Router "https://github.com/jackdh/rasatalk/blob/master/server/mongo/router.js"
    click Controllers "https://github.com/jackdh/rasatalk/tree/master/server/mongo/controllers/"
    click DirectUtils "https://github.com/jackdh/rasatalk/tree/master/server/mongo/direct/"
    click Schemas "https://github.com/jackdh/rasatalk/tree/master/server/mongo/schemas/"
    click DBUtils "https://github.com/jackdh/rasatalk/tree/master/server/mongo/utils/"
    click ThirdParty "https://github.com/jackdh/rasatalk/tree/master/server/thirdparties/"
    click APITests "https://github.com/jackdh/rasatalk/tree/master/server/api_tests/"
    click DockerCompose "https://github.com/jackdh/rasatalk/blob/master/docker-compose.yml"
    click Dockerfile "https://github.com/jackdh/rasatalk/tree/master/internals/docker/Dockerfile"
    click CI "https://github.com/jackdh/rasatalk/blob/master/.travis.yml"
    click Scripts "https://github.com/jackdh/rasatalk/tree/master/internals/scripts/"

    %% Styles
    classDef frontend fill:#D4E6F1,stroke:#1B4F72,stroke-width:1px;
    classDef backend fill:#D5F5E3,stroke:#145A32,stroke-width:1px;
    classDef database fill:#FCF3CF,stroke:#7D6608,stroke-width:1px;
    classDef external fill:#FADBD8,stroke:#922B21,stroke-width:1px;
```
