# nevalang/neva architecture

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

- Interactive diagram: https://gitdiagram.com/nevalang/neva
- Repository: https://github.com/nevalang/neva

## Overview

Neva is a statically typed compiled dataflow language. A user invokes the CLI to build or run a Neva project: the builder loads module sources, the compiler parses and analyzes them, lowers the network representation, then emits Go, native/Wasm, or visual IR output. The runtime supplies concurrent message passing and language functions; indexing and formatting are additional user-facing capabilities. The graph follows documented and indexed connections; several backend, runtime, and CLI details are unsampled, so their internal links are omitted.

Main entry points: [`internal/cli/build.go`](https://github.com/nevalang/neva/blob/main/internal/cli/build.go) (Build command), [`internal/compiler/compiler.go`](https://github.com/nevalang/neva/blob/main/internal/compiler/compiler.go) (Compiler frontend), [`internal/compiler/parser/parser.go`](https://github.com/nevalang/neva/blob/main/internal/compiler/parser/parser.go) (Source parser), [`internal/builder/builder.go`](https://github.com/nevalang/neva/blob/main/internal/builder/builder.go) (Module builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and modules"]
  node_cli["Neva CLI<br/>[cli.go]"]
  node_commands["Build command<br/>[build.go]"]
  node_builder["Module builder<br/>[builder.go]"]
end

subgraph group_compile["Compiler pipeline"]
  node_parser["Source parser<br/>[parser.go]"]
  node_ast["Flow AST<br/>[flowast.go]"]
  node_analyzer["Static analyzer<br/>[nodes.go]"]
  node_types["Type resolver<br/>[resolver.go]"]
  node_desugar["Network lowering<br/>[network.go]"]
  node_irgen["IR generation<br/>[network.go]"]
  node_ir["Compiler IR<br/>[ir.go]"]
  node_compiler["Compiler frontend<br/>[compiler.go]"]
end

subgraph group_output["Targets and tools"]
  node_gobackend["Go backend<br/>[backend.go]"]
  node_native["Native backend<br/>[backend.go]"]
  node_wasm["Wasm backend<br/>[backend.go]"]
  node_irbackend["IR exporters<br/>[backend.go]"]
end

subgraph group_runtime["Execution runtime"]
  node_runtime["Dataflow runtime<br/>[program.go]"]
  node_messages["Message types<br/>[message.go]"]
  node_registry["Runtime functions<br/>[registry.go]"]
end

subgraph group_workspace["Workspace views"]
  node_indexer["Workspace indexer<br/>[indexer.go]"]
  node_projector["Visual projection<br/>[projector.go]"]
  node_formatter["Source formatter<br/>[formatter.go]"]
end

node_user(("Developer"))
node_go["Go compiler"]
node_binary["Native or Wasm output"]

node_user -->|"invokes"| node_cli
node_cli -.->|"registers"| node_commands
node_commands -->|"loads sources"| node_builder
node_builder -->|"supplies source"| node_parser
node_parser -->|"produces"| node_ast
node_commands -->|"configures build"| node_compiler
node_compiler -->|"loads modules"| node_builder
node_compiler -.->|"parses modules"| node_parser
node_compiler -.->|"lowers network"| node_desugar
node_compiler -.->|"generates IR"| node_irgen
node_parser -.->|"readies AST"| node_analyzer
node_analyzer -->|"checks types"| node_types
node_desugar -->|"resolves types"| node_types
node_irgen -.->|"builds representation"| node_ir
node_commands -->|"selects target"| node_gobackend
node_commands -->|"selects target"| node_native
node_commands -->|"selects target"| node_wasm
node_commands -->|"selects format"| node_irbackend
node_gobackend -.->|"emits Go"| node_go
node_go -->|"compiles"| node_binary
node_native -.->|"produces target"| node_binary
node_wasm -.->|"produces target"| node_binary
node_runtime -->|"transports messages"| node_messages
node_registry -.->|"provides functions"| node_runtime
node_user -.->|"indexes workspace"| node_indexer
node_indexer -->|"analyzes build"| node_analyzer
node_user -.->|"requests view"| node_projector
node_user -.->|"formats source"| node_formatter

click node_cli "https://github.com/nevalang/neva/blob/main/internal/cli/cli.go"
click node_commands "https://github.com/nevalang/neva/blob/main/internal/cli/build.go"
click node_builder "https://github.com/nevalang/neva/blob/main/internal/builder/builder.go"
click node_parser "https://github.com/nevalang/neva/blob/main/internal/compiler/parser/parser.go"
click node_ast "https://github.com/nevalang/neva/blob/main/pkg/ast/flowast.go"
click node_analyzer "https://github.com/nevalang/neva/blob/main/internal/compiler/analyzer/nodes.go"
click node_types "https://github.com/nevalang/neva/blob/main/internal/compiler/typesystem/resolver.go"
click node_desugar "https://github.com/nevalang/neva/blob/main/internal/compiler/desugarer/network.go"
click node_irgen "https://github.com/nevalang/neva/blob/main/internal/compiler/irgen/network.go"
click node_ir "https://github.com/nevalang/neva/blob/main/internal/compiler/ir/ir.go"
click node_compiler "https://github.com/nevalang/neva/blob/main/internal/compiler/compiler.go"
click node_gobackend "https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/backend.go"
click node_native "https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/native/backend.go"
click node_wasm "https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/wasm/backend.go"
click node_irbackend "https://github.com/nevalang/neva/blob/main/internal/compiler/backend/ir/backend.go"
click node_runtime "https://github.com/nevalang/neva/blob/main/internal/runtime/program.go"
click node_messages "https://github.com/nevalang/neva/blob/main/internal/runtime/messages/message.go"
click node_registry "https://github.com/nevalang/neva/blob/main/internal/runtime/funcs/registry.go"
click node_indexer "https://github.com/nevalang/neva/blob/main/pkg/indexer/indexer.go"
click node_projector "https://github.com/nevalang/neva/blob/main/pkg/view/projector.go"
click node_formatter "https://github.com/nevalang/neva/blob/main/pkg/formatter/formatter.go"

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_cli,node_commands,node_builder toneBlue
class node_parser,node_ast,node_analyzer,node_types,node_desugar,node_irgen,node_ir,node_compiler toneAmber
class node_gobackend,node_native,node_wasm,node_irbackend toneMint
class node_runtime,node_messages,node_registry toneRose
class node_indexer,node_projector,node_formatter,node_user,node_go,node_binary toneIndigo
```

## Components

### CLI and modules

- [Neva CLI](https://github.com/nevalang/neva/blob/main/internal/cli/cli.go): `internal/cli/cli.go`
- [Build command](https://github.com/nevalang/neva/blob/main/internal/cli/build.go): `internal/cli/build.go`
- [Module builder](https://github.com/nevalang/neva/blob/main/internal/builder/builder.go): `internal/builder/builder.go`

### Compiler pipeline

- [Source parser](https://github.com/nevalang/neva/blob/main/internal/compiler/parser/parser.go): `internal/compiler/parser/parser.go`
- [Flow AST](https://github.com/nevalang/neva/blob/main/pkg/ast/flowast.go): `pkg/ast/flowast.go`
- [Static analyzer](https://github.com/nevalang/neva/blob/main/internal/compiler/analyzer/nodes.go): `internal/compiler/analyzer/nodes.go`
- [Type resolver](https://github.com/nevalang/neva/blob/main/internal/compiler/typesystem/resolver.go): `internal/compiler/typesystem/resolver.go`
- [Network lowering](https://github.com/nevalang/neva/blob/main/internal/compiler/desugarer/network.go): `internal/compiler/desugarer/network.go`
- [IR generation](https://github.com/nevalang/neva/blob/main/internal/compiler/irgen/network.go): `internal/compiler/irgen/network.go`
- [Compiler IR](https://github.com/nevalang/neva/blob/main/internal/compiler/ir/ir.go): `internal/compiler/ir/ir.go`
- [Compiler frontend](https://github.com/nevalang/neva/blob/main/internal/compiler/compiler.go): `internal/compiler/compiler.go`

### Targets and tools

- [Go backend](https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/backend.go): `internal/compiler/backend/golang/backend.go`
- [Native backend](https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/native/backend.go): `internal/compiler/backend/golang/native/backend.go`
- [Wasm backend](https://github.com/nevalang/neva/blob/main/internal/compiler/backend/golang/wasm/backend.go): `internal/compiler/backend/golang/wasm/backend.go`
- [IR exporters](https://github.com/nevalang/neva/blob/main/internal/compiler/backend/ir/backend.go): `internal/compiler/backend/ir/backend.go`

### Execution runtime

- [Dataflow runtime](https://github.com/nevalang/neva/blob/main/internal/runtime/program.go): `internal/runtime/program.go`
- [Message types](https://github.com/nevalang/neva/blob/main/internal/runtime/messages/message.go): `internal/runtime/messages/message.go`
- [Runtime functions](https://github.com/nevalang/neva/blob/main/internal/runtime/funcs/registry.go): `internal/runtime/funcs/registry.go`

### Workspace views

- [Workspace indexer](https://github.com/nevalang/neva/blob/main/pkg/indexer/indexer.go): `pkg/indexer/indexer.go`
- [Visual projection](https://github.com/nevalang/neva/blob/main/pkg/view/projector.go): `pkg/view/projector.go`
- [Source formatter](https://github.com/nevalang/neva/blob/main/pkg/formatter/formatter.go): `pkg/formatter/formatter.go`

### Other components

- **Developer**
- **Go compiler**
- **Native or Wasm output**

## Connections

- Developer → Neva CLI: invokes
- Neva CLI → Build command: registers
- Build command → Module builder: loads sources (evidence: `internal/cli/build.go`)
- Module builder → Source parser: supplies source
- Source parser → Flow AST: produces (evidence: `internal/compiler/parser/parser.go`)
- Build command → Compiler frontend: configures build (evidence: `internal/cli/build.go`)
- Compiler frontend → Module builder: loads modules (evidence: `internal/compiler/compiler.go`)
- Compiler frontend → Source parser: parses modules
- Compiler frontend → Network lowering: lowers network
- Compiler frontend → IR generation: generates IR
- Source parser → Static analyzer: readies AST
- Static analyzer → Type resolver: checks types (evidence: `internal/compiler/analyzer/nodes.go`)
- Network lowering → Type resolver: resolves types (evidence: `internal/compiler/desugarer/network.go`)
- IR generation → Compiler IR: builds representation
- Build command → Go backend: selects target (evidence: `internal/cli/build.go`)
- Build command → Native backend: selects target (evidence: `internal/cli/build.go`)
- Build command → Wasm backend: selects target (evidence: `internal/cli/build.go`)
- Build command → IR exporters: selects format (evidence: `internal/cli/build.go`)
- Go backend → Go compiler: emits Go
- Go compiler → Native or Wasm output: compiles
- Native backend → Native or Wasm output: produces target
- Wasm backend → Native or Wasm output: produces target
- Dataflow runtime → Message types: transports messages (evidence: `internal/runtime/program.go`)
- Runtime functions → Dataflow runtime: provides functions
- Developer → Workspace indexer: indexes workspace
- Workspace indexer → Static analyzer: analyzes build (evidence: `pkg/indexer/indexer.go`)
- Developer → Visual projection: requests view
- Developer → Source formatter: formats source
