# contiki-ng/contiki-ng architecture

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

- Interactive diagram: https://gitdiagram.com/contiki-ng/contiki-ng
- Repository: https://github.com/contiki-ng/contiki-ng

## Overview

Contiki-NG is a cross-platform IoT operating system. A typical device application runs within its process/timer environment, handles application protocols such as CoAP, and uses the networking stack to communicate over low-power links; routing and IPv6 support protocols highlighted in the README, including RPL, 6LoWPAN and 6TiSCH. LwM2M builds on CoAP, while border-router components support network bridging. The tree also includes SNMP, EDHOC key management and Antelope storage. The sampled evidence shows selected module dependencies, not a complete runtime call graph; unverified workflow links are dashed.

Main entry points: [`os/net/netstack.h`](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/netstack.h) (Network Stack API), [`os/net/routing/routing.h`](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/routing/routing.h) (Routing API), [`os/services/rpl-border-router/rpl-border-router.c`](https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/rpl-border-router/rpl-border-router.c) (Border Router), [`os/contiki.h`](https://github.com/contiki-ng/contiki-ng/blob/develop/os/contiki.h) (Processes and Timers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["OS Runtime"]
  node_processes["Processes and Timers<br/>[contiki.h]"]
end

subgraph group_network["Networking"]
  node_netstack["Network Stack API<br/>[netstack.h]"]
  node_packetbuf["Packet Buffer<br/>[packetbuf.h]"]
  node_ipv6["IPv6<br/>[uip.h]"]
  node_routing["Routing API<br/>[routing.h]"]
  node_radio["Radio Drivers"]
  node_linkaddr["Link Addressing<br/>[linkaddr.h]"]
end

subgraph group_services["IoT Services"]
  node_coap["CoAP Engine<br/>[coap-engine.c]"]
  node_lwm2m["LwM2M Engine<br/>[lwm2m-engine.c]"]
  node_snmp["SNMP Engine<br/>[snmp-engine.c]"]
  node_border["Border Router"]
  node_bordercbor["Router CBOR"]
end

subgraph group_security["Security"]
  node_edhoc["EDHOC Key Store"]
end

subgraph group_storage["Storage"]
  node_antelope["Antelope Database<br/>[storage-cfs.c]"]
  node_cfs[("Coffee File System<br/>[cfs-coffee.c]")]
end

node_application(("Device Application"))

node_application -.->|"runs in"| node_processes
node_processes -.->|"uses"| node_coap
node_coap -.->|"serves"| node_lwm2m
node_application -.->|"uses"| node_snmp
node_application -.->|"manages keys"| node_edhoc
node_application -.->|"stores data"| node_antelope
node_netstack -->|"uses"| node_radio
node_netstack -->|"uses"| node_linkaddr
node_netstack -.->|"uses"| node_packetbuf
node_routing -->|"uses"| node_ipv6
node_border -->|"uses"| node_routing
node_bordercbor -->|"uses"| node_packetbuf
node_antelope -->|"reads and writes"| node_cfs
node_ipv6 -.->|"communicates over"| node_netstack
node_routing -.->|"routes over"| node_netstack
node_border -.->|"bridges network"| node_application

click node_processes "https://github.com/contiki-ng/contiki-ng/blob/develop/os/contiki.h"
click node_netstack "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/netstack.h"
click node_packetbuf "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/packetbuf.h"
click node_ipv6 "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/ipv6/uip.h"
click node_routing "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/routing/routing.h"
click node_radio "https://github.com/contiki-ng/contiki-ng/tree/develop/arch/dev/radio"
click node_linkaddr "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/linkaddr.h"
click node_coap "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/app-layer/coap/coap-engine.c"
click node_lwm2m "https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/lwm2m/lwm2m-engine.c"
click node_snmp "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/app-layer/snmp/snmp-engine.c"
click node_border "https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/rpl-border-router/rpl-border-router.c"
click node_bordercbor "https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/rpl-border-router/native/border-router-cbor.c"
click node_edhoc "https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/security/edhoc/edhoc-key-storage.c"
click node_antelope "https://github.com/contiki-ng/contiki-ng/blob/develop/os/storage/antelope/storage-cfs.c"
click node_cfs "https://github.com/contiki-ng/contiki-ng/blob/develop/os/storage/cfs/cfs-coffee.c"

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_processes toneBlue
class node_netstack,node_packetbuf,node_ipv6,node_routing,node_radio,node_linkaddr toneAmber
class node_coap,node_lwm2m,node_snmp,node_border,node_bordercbor toneMint
class node_edhoc toneRose
class node_antelope,node_cfs,node_application toneIndigo
```

## Components

### OS Runtime

- [Processes and Timers](https://github.com/contiki-ng/contiki-ng/blob/develop/os/contiki.h): `os/contiki.h`

### Networking

- [Network Stack API](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/netstack.h): `os/net/netstack.h`
- [Packet Buffer](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/packetbuf.h): `os/net/packetbuf.h`
- [IPv6](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/ipv6/uip.h): `os/net/ipv6/uip.h`
- [Routing API](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/routing/routing.h): `os/net/routing/routing.h`
- [Radio Drivers](https://github.com/contiki-ng/contiki-ng/tree/develop/arch/dev/radio): `arch/dev/radio`
- [Link Addressing](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/linkaddr.h): `os/net/linkaddr.h`

### IoT Services

- [CoAP Engine](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/app-layer/coap/coap-engine.c): `os/net/app-layer/coap/coap-engine.c`
- [LwM2M Engine](https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/lwm2m/lwm2m-engine.c): `os/services/lwm2m/lwm2m-engine.c`
- [SNMP Engine](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/app-layer/snmp/snmp-engine.c): `os/net/app-layer/snmp/snmp-engine.c`
- [Border Router](https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/rpl-border-router/rpl-border-router.c): `os/services/rpl-border-router/rpl-border-router.c`
- [Router CBOR](https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/rpl-border-router/native/border-router-cbor.c): `os/services/rpl-border-router/native/border-router-cbor.c`

### Security

- [EDHOC Key Store](https://github.com/contiki-ng/contiki-ng/blob/develop/os/net/security/edhoc/edhoc-key-storage.c): `os/net/security/edhoc/edhoc-key-storage.c`

### Storage

- [Antelope Database](https://github.com/contiki-ng/contiki-ng/blob/develop/os/storage/antelope/storage-cfs.c): `os/storage/antelope/storage-cfs.c`
- [Coffee File System](https://github.com/contiki-ng/contiki-ng/blob/develop/os/storage/cfs/cfs-coffee.c): `os/storage/cfs/cfs-coffee.c`

### Other components

- **Device Application**

## Connections

- Device Application → Processes and Timers: runs in (evidence: `README.md`)
- Processes and Timers → CoAP Engine: uses
- CoAP Engine → LwM2M Engine: serves (evidence: `os/services/lwm2m/lwm2m-engine.c`)
- Device Application → SNMP Engine: uses
- Device Application → EDHOC Key Store: manages keys
- Device Application → Antelope Database: stores data
- Network Stack API → Radio Drivers: uses (evidence: `os/net/netstack.h`)
- Network Stack API → Link Addressing: uses (evidence: `os/net/netstack.h`)
- Network Stack API → Packet Buffer: uses
- Routing API → IPv6: uses (evidence: `os/net/routing/routing.h`)
- Border Router → Routing API: uses (evidence: `os/services/rpl-border-router/rpl-border-router.c`)
- Router CBOR → Packet Buffer: uses (evidence: `os/services/rpl-border-router/native/border-router-cbor.c`)
- Antelope Database → Coffee File System: reads and writes (evidence: `os/storage/antelope/storage-cfs.c`)
- IPv6 → Network Stack API: communicates over (evidence: `README.md`)
- Routing API → Network Stack API: routes over (evidence: `README.md`)
- Border Router → Device Application: bridges network (evidence: `README.md`)
