# henriqf/nosei architecture

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

- Interactive diagram: https://gitdiagram.com/henriqf/nosei
- Repository: https://github.com/henriqf/nosei

## Overview

Nosei is a small file-backed database service with terminal and TCP command interfaces. The main workflow accepts create/use/insert/read/update/delete commands, validates table rules, and persists table entries and indexes; reads may also filter rows using parsed expressions. The graph reflects the sampled command routing and storage behavior. The README is empty, and unsampled portions of the data package limit detail on table loading and deletion internals.

Main entry points: [`src/ponte/externo.go`](https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go) (Command dispatch), [`src/data/use.go`](https://github.com/henriqf/nosei/blob/main/src/data/use.go) (Record operations), [`src/shared/share.go`](https://github.com/henriqf/nosei/blob/main/src/shared/share.go) (Shared database state), [`src/ponte/ponte.go`](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go) (Create command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Command interfaces"]
  node_main["Mode entry<br/>[main.go]"]
  node_tcp["TCP listener<br/>[externo.go]"]
  node_web["Web connection<br/>[externo.go]"]
  node_terminal["Terminal input<br/>[externo.go]"]
  node_dispatch["Command dispatch<br/>[externo.go]"]
end

subgraph group_commands["Command handling"]
  node_createcmd["Create command<br/>[ponte.go]"]
  node_insertcmd["Insert command<br/>[ponte.go]"]
  node_readcmd["Read command<br/>[ponte.go]"]
  node_updatecmd["Update command<br/>[ponte.go]"]
  node_deletecmd["Delete command<br/>[ponte.go]"]
end

subgraph group_database["Database engine"]
  node_rules["Rule parser<br/>[ruler.go]"]
  node_creation["Database creation<br/>[create.go]"]
  node_databaseuse["Database selection<br/>[use.go]"]
  node_records["Record operations<br/>[use.go]"]
  node_filter["Expression filtering<br/>[operacoes.go]"]
end

subgraph group_runtime["Shared runtime"]
  node_state["Shared database state<br/>[share.go]"]
end

node_user(("Client"))
node_store[("Database files")]

node_user -->|"starts"| node_main
node_main -->|"selects web"| node_tcp
node_main -->|"selects terminal"| node_terminal
node_user -->|"sends commands"| node_web
node_tcp -->|"accepts connections"| node_web
node_web -->|"dispatches input"| node_dispatch
node_terminal -->|"dispatches input"| node_dispatch
node_dispatch -->|"routes create"| node_createcmd
node_dispatch -->|"routes insert"| node_insertcmd
node_dispatch -->|"routes read"| node_readcmd
node_dispatch -->|"routes update"| node_updatecmd
node_dispatch -->|"routes delete"| node_deletecmd
node_dispatch -->|"routes use"| node_databaseuse
node_createcmd -->|"parses rules"| node_rules
node_createcmd -->|"creates database"| node_creation
node_createcmd -->|"selects database"| node_databaseuse
node_insertcmd -->|"inserts record"| node_records
node_readcmd -->|"loads table"| node_databaseuse
node_readcmd -->|"prepares and applies filter"| node_filter
node_readcmd -->|"reads table"| node_records
node_updatecmd -->|"updates record"| node_records
node_deletecmd -->|"deletes record"| node_records
node_rules -->|"sets table rules"| node_state
node_creation -->|"uses schema"| node_state
node_databaseuse -->|"reads rules"| node_store
node_databaseuse -->|"parses rules"| node_rules
node_databaseuse -->|"sets active database"| node_state
node_records -->|"reads and writes"| node_store
node_records -->|"uses loaded tables"| node_state
node_filter -->|"loads rows"| node_records
node_filter -->|"reads and sets results"| node_state
node_creation -->|"creates files"| node_store

click node_main "https://github.com/henriqf/nosei/blob/main/src/main.go"
click node_tcp "https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go"
click node_web "https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go"
click node_terminal "https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go"
click node_dispatch "https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go"
click node_createcmd "https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go"
click node_insertcmd "https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go"
click node_readcmd "https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go"
click node_updatecmd "https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go"
click node_deletecmd "https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go"
click node_rules "https://github.com/henriqf/nosei/blob/main/src/data/ruler.go"
click node_creation "https://github.com/henriqf/nosei/blob/main/src/data/create.go"
click node_databaseuse "https://github.com/henriqf/nosei/blob/main/src/data/use.go"
click node_records "https://github.com/henriqf/nosei/blob/main/src/data/use.go"
click node_filter "https://github.com/henriqf/nosei/blob/main/src/ops/operacoes.go"
click node_state "https://github.com/henriqf/nosei/blob/main/src/shared/share.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_main,node_tcp,node_web,node_terminal,node_dispatch,node_user toneBlue
class node_createcmd,node_insertcmd,node_readcmd,node_updatecmd,node_deletecmd,node_store toneAmber
class node_rules,node_creation,node_databaseuse,node_records,node_filter toneMint
class node_state toneRose
```

## Components

### Command interfaces

- [Mode entry](https://github.com/henriqf/nosei/blob/main/src/main.go): `src/main.go`
- [TCP listener](https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go): `src/ponte/externo.go`
- [Web connection](https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go): `src/ponte/externo.go`
- [Terminal input](https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go): `src/ponte/externo.go`
- [Command dispatch](https://github.com/henriqf/nosei/blob/main/src/ponte/externo.go): `src/ponte/externo.go`

### Command handling

- [Create command](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go): `src/ponte/ponte.go`
- [Insert command](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go): `src/ponte/ponte.go`
- [Read command](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go): `src/ponte/ponte.go`
- [Update command](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go): `src/ponte/ponte.go`
- [Delete command](https://github.com/henriqf/nosei/blob/main/src/ponte/ponte.go): `src/ponte/ponte.go`

### Database engine

- [Rule parser](https://github.com/henriqf/nosei/blob/main/src/data/ruler.go): `src/data/ruler.go`
- [Database creation](https://github.com/henriqf/nosei/blob/main/src/data/create.go): `src/data/create.go`
- [Database selection](https://github.com/henriqf/nosei/blob/main/src/data/use.go): `src/data/use.go`
- [Record operations](https://github.com/henriqf/nosei/blob/main/src/data/use.go): `src/data/use.go`
- [Expression filtering](https://github.com/henriqf/nosei/blob/main/src/ops/operacoes.go): `src/ops/operacoes.go`

### Shared runtime

- [Shared database state](https://github.com/henriqf/nosei/blob/main/src/shared/share.go): `src/shared/share.go`

### Other components

- **Client**
- **Database files**

## Connections

- Client → Mode entry: starts
- Mode entry → TCP listener: selects web
- Mode entry → Terminal input: selects terminal
- Client → Web connection: sends commands
- TCP listener → Web connection: accepts connections
- Web connection → Command dispatch: dispatches input
- Terminal input → Command dispatch: dispatches input
- Command dispatch → Create command: routes create
- Command dispatch → Insert command: routes insert
- Command dispatch → Read command: routes read
- Command dispatch → Update command: routes update
- Command dispatch → Delete command: routes delete
- Command dispatch → Database selection: routes use
- Create command → Rule parser: parses rules
- Create command → Database creation: creates database
- Create command → Database selection: selects database
- Insert command → Record operations: inserts record
- Read command → Database selection: loads table
- Read command → Expression filtering: prepares and applies filter
- Read command → Record operations: reads table
- Update command → Record operations: updates record
- Delete command → Record operations: deletes record
- Rule parser → Shared database state: sets table rules
- Database creation → Shared database state: uses schema
- Database selection → Database files: reads rules
- Database selection → Rule parser: parses rules
- Database selection → Shared database state: sets active database
- Record operations → Database files: reads and writes
- Record operations → Shared database state: uses loaded tables
- Expression filtering → Record operations: loads rows
- Expression filtering → Shared database state: reads and sets results
- Database creation → Database files: creates files
