# inngest/inngest-js architecture

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

- Interactive diagram: https://gitdiagram.com/inngest/inngest-js
- Repository: https://github.com/inngest/inngest-js

## Overview

- Core Engine: Represent the central “inngest” package (packages/inngest). This module implements the event API, event processing, function orchestration, and middleware integration.
- Test and Utility Components: Optionally, add a section for packages/test and related scripts that support automated testing and integration (to show how quality and reliability are ensured).

##### Relationships and Data Flow
- After processing, the core engine triggers functions or events, which are then handled (or responded to) either internally or via external systems if applicable.
- If applicable, include data stores or external services (e.g., third-party logging, AI services, realtime channels) that interact with these components.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly differentiate between core business logic (Inngest engine) and cross-cutting concerns (middleware) as well as external integrations.

- As a reference, consider incorporating aspects from the provided examples folders; they effectively show the real-world usage of the “inngest” engine across different frameworks and platforms.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Side"
        client["Client Applications"]:::external
    end

    subgraph "Integration/Adapter Layers"
        express["Express Adapter"]:::adapter
        fastify["Fastify Adapter"]:::adapter
        nestjs["NestJS Adapter"]:::adapter
        nextApp["Next.js Adapter – App Router"]:::adapter
        nextPages["Next.js Adapter – Pages Router"]:::adapter
        astro["Astro Adapter"]:::adapter
        remix["Remix Adapter"]:::adapter
        sveltekit["SvelteKit Adapter"]:::adapter
        nuxt["Nuxt Adapter"]:::adapter
    end

    subgraph "Middleware Pipeline"
        encryption["Middleware – Encryption"]:::middleware
        sentry["Middleware – Sentry"]:::middleware
        validation["Middleware – Validation"]:::middleware
    end

    core["Inngest Core Engine"]:::core

    subgraph "Additional Services"
        ai["AI Component"]:::service
        realtime["Realtime Component"]:::service
    end

    test["Test and Utility Components"]:::test

    client -->|"sends_event"| express
    client -->|"sends_event"| fastify
    client -->|"sends_event"| nestjs
    client -->|"sends_event"| nextApp
    client -->|"sends_event"| nextPages
    client -->|"sends_event"| astro
    client -->|"sends_event"| remix
    client -->|"sends_event"| sveltekit
    client -->|"sends_event"| nuxt

    express -->|"submit_event"| encryption
    fastify -->|"submit_event"| encryption
    nestjs -->|"submit_event"| encryption
    nextApp -->|"submit_event"| encryption
    nextPages -->|"submit_event"| encryption
    astro -->|"submit_event"| encryption
    remix -->|"submit_event"| encryption
    sveltekit -->|"submit_event"| encryption
    nuxt -->|"submit_event"| encryption

    encryption -->|"process_event"| sentry
    sentry -->|"process_event"| validation
    validation -->|"process_event"| core

    core -->|"triggers"| ai
    core -->|"triggers"| realtime
    core -->|"logs_to"| test

    click core "https://github.com/inngest/inngest-js/tree/main/packages/inngest"
    click encryption "https://github.com/inngest/inngest-js/tree/main/packages/middleware-encryption"
    click sentry "https://github.com/inngest/inngest-js/tree/main/packages/middleware-sentry"
    click validation "https://github.com/inngest/inngest-js/tree/main/packages/middleware-validation"
    click express "https://github.com/inngest/inngest-js/tree/main/examples/framework-express"
    click fastify "https://github.com/inngest/inngest-js/tree/main/examples/framework-fastify"
    click nestjs "https://github.com/inngest/inngest-js/tree/main/examples/framework-nestjs"
    click nextApp "https://github.com/inngest/inngest-js/tree/main/examples/framework-nextjs-app-router"
    click nextPages "https://github.com/inngest/inngest-js/tree/main/examples/framework-nextjs-pages-router"
    click astro "https://github.com/inngest/inngest-js/tree/main/examples/framework-astro"
    click remix "https://github.com/inngest/inngest-js/tree/main/examples/framework-remix"
    click sveltekit "https://github.com/inngest/inngest-js/tree/main/examples/framework-sveltekit"
    click nuxt "https://github.com/inngest/inngest-js/tree/main/examples/framework-nuxt"
    click ai "https://github.com/inngest/inngest-js/tree/main/packages/ai"
    click realtime "https://github.com/inngest/inngest-js/tree/main/packages/realtime"
    click test "https://github.com/inngest/inngest-js/tree/main/packages/test"

    classDef core fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef middleware fill:#e3f2fd,stroke:#1565c0,stroke-width:2px;
    classDef adapter fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef external fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px;
    classDef service fill:#fffde7,stroke:#f57f17,stroke-width:2px;
    classDef test fill:#ffebee,stroke:#c62828,stroke-width:2px;
```
