# fossasia/magic-epaper-app architecture

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

- Interactive diagram: https://gitdiagram.com/fossasia/magic-epaper-app
- Repository: https://github.com/fossasia/magic-epaper-app

## Overview

Magic ePaper is a Flutter app for designing images and cards and transferring them to NFC ePaper badges. The main workflow is to choose a display, create content with an editor or template, process it for ePaper, and transfer it over NFC. Other documented branches include saved designs, NDEF operations, raw tag commands, and Arduino export. The Dart implementation was not sampled, so feature links below reflect README-documented behavior; the Rust dithering and generated bridge are supported by source excerpts.

Main entry points: [`lib/utils/epd`](https://github.com/fossasia/magic-epaper-app/tree/main/lib/utils/epd) (NFC image transfer), [`lib/view/display_selection_screen.dart`](https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/display_selection_screen.dart) (Display selection), [`lib/view/image_editor.dart`](https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/image_editor.dart) (Image editor), [`lib/card_templates`](https://github.com/fossasia/magic-epaper-app/tree/main/lib/card_templates) (Card templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_design["Design creation"]
  node_app["Flutter app<br/>[main.dart]"]
  node_display["Display selection"]
  node_image_editor["Image editor<br/>[image_editor.dart]"]
  node_canvas["Canvas editor"]
  node_templates["Card templates"]
  node_bulk["Bulk generation"]
  node_weather["Weather snapshot"]
  node_image_library["Image Library<br/>[image_library.dart]"]
end

subgraph group_transfer["Badge transfer"]
  node_transfer_flow["NFC image transfer"]
  node_display_protocols["Display protocols"]
  node_arduino["Arduino export"]
end

subgraph group_tag["Tag tools"]
  node_ndef["NDEF read/write<br/>[ndef_screen.dart]"]
  node_console["Command console"]
end

subgraph group_platform["Processing core"]
  node_processing["Image processing"]
  node_rust_bridge["Rust bridge<br/>[simple.dart]"]
  node_rust_dither["Rust dithering<br/>[simple.rs]"]
end

node_user(("App user"))
node_badge["NFC ePaper badge"]
node_ndef_tag["NDEF tag"]

node_user -->|"uses"| node_app
node_app -->|"opens"| node_display
node_display -->|"creates image"| node_image_editor
node_display -->|"creates design"| node_canvas
node_display -->|"creates card"| node_templates
node_templates -->|"generates batches"| node_bulk
node_templates -->|"offers snapshot"| node_weather
node_image_editor -->|"processes image"| node_processing
node_processing -.->|"calls dithering"| node_rust_bridge
node_rust_bridge -->|"invokes"| node_rust_dither
node_image_editor -->|"transfers design"| node_transfer_flow
node_canvas -->|"transfers design"| node_transfer_flow
node_templates -->|"transfers design"| node_transfer_flow
node_transfer_flow -.->|"uses protocols"| node_display_protocols
node_display_protocols -->|"writes image"| node_badge
node_image_editor -->|"saves design"| node_image_library
node_image_library -->|"retransfers design"| node_transfer_flow
node_user -->|"reads or writes"| node_ndef
node_ndef -->|"exchanges records"| node_ndef_tag
node_user -->|"sends commands"| node_console
node_user -->|"exports"| node_arduino

click node_app "https://github.com/fossasia/magic-epaper-app/blob/main/lib/main.dart"
click node_display "https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/display_selection_screen.dart"
click node_image_editor "https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/image_editor.dart"
click node_canvas "https://github.com/fossasia/magic-epaper-app/blob/main/lib/native_canvas/native_canvas_editor.dart"
click node_templates "https://github.com/fossasia/magic-epaper-app/tree/main/lib/card_templates"
click node_bulk "https://github.com/fossasia/magic-epaper-app/tree/main/lib/card_templates/bulk"
click node_weather "https://github.com/fossasia/magic-epaper-app/blob/main/lib/card_templates/weather_service.dart"
click node_processing "https://github.com/fossasia/magic-epaper-app/blob/main/lib/utils/image_processing/image_processing.dart"
click node_rust_bridge "https://github.com/fossasia/magic-epaper-app/blob/main/lib/src/rust/api/simple.dart"
click node_rust_dither "https://github.com/fossasia/magic-epaper-app/blob/main/rust/src/api/simple.rs"
click node_transfer_flow "https://github.com/fossasia/magic-epaper-app/tree/main/lib/utils/epd"
click node_display_protocols "https://github.com/fossasia/magic-epaper-app/tree/main/lib/utils/epd"
click node_image_library "https://github.com/fossasia/magic-epaper-app/blob/main/lib/image_library/image_library.dart"
click node_ndef "https://github.com/fossasia/magic-epaper-app/blob/main/lib/ndef_screen/ndef_screen.dart"
click node_console "https://github.com/fossasia/magic-epaper-app/blob/main/lib/command_console/command_console_screen.dart"
click node_arduino "https://github.com/fossasia/magic-epaper-app/blob/main/lib/utils/magic_epaper_firmware.dart"

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_app,node_display,node_image_editor,node_canvas,node_templates,node_bulk,node_weather,node_image_library,node_user toneBlue
class node_transfer_flow,node_display_protocols,node_arduino toneAmber
class node_ndef,node_console toneMint
class node_processing,node_rust_bridge,node_rust_dither toneRose
class node_badge,node_ndef_tag toneIndigo
```

## Components

### Design creation

- [Flutter app](https://github.com/fossasia/magic-epaper-app/blob/main/lib/main.dart): `lib/main.dart`
- [Display selection](https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/display_selection_screen.dart): `lib/view/display_selection_screen.dart`
- [Image editor](https://github.com/fossasia/magic-epaper-app/blob/main/lib/view/image_editor.dart): `lib/view/image_editor.dart`
- [Canvas editor](https://github.com/fossasia/magic-epaper-app/blob/main/lib/native_canvas/native_canvas_editor.dart): `lib/native_canvas/native_canvas_editor.dart`
- [Card templates](https://github.com/fossasia/magic-epaper-app/tree/main/lib/card_templates): `lib/card_templates`
- [Bulk generation](https://github.com/fossasia/magic-epaper-app/tree/main/lib/card_templates/bulk): `lib/card_templates/bulk`
- [Weather snapshot](https://github.com/fossasia/magic-epaper-app/blob/main/lib/card_templates/weather_service.dart): `lib/card_templates/weather_service.dart`
- [Image Library](https://github.com/fossasia/magic-epaper-app/blob/main/lib/image_library/image_library.dart): `lib/image_library/image_library.dart`

### Badge transfer

- [NFC image transfer](https://github.com/fossasia/magic-epaper-app/tree/main/lib/utils/epd): `lib/utils/epd`
- [Display protocols](https://github.com/fossasia/magic-epaper-app/tree/main/lib/utils/epd): `lib/utils/epd`
- [Arduino export](https://github.com/fossasia/magic-epaper-app/blob/main/lib/utils/magic_epaper_firmware.dart): `lib/utils/magic_epaper_firmware.dart`

### Tag tools

- [NDEF read/write](https://github.com/fossasia/magic-epaper-app/blob/main/lib/ndef_screen/ndef_screen.dart): `lib/ndef_screen/ndef_screen.dart`
- [Command console](https://github.com/fossasia/magic-epaper-app/blob/main/lib/command_console/command_console_screen.dart): `lib/command_console/command_console_screen.dart`

### Processing core

- [Image processing](https://github.com/fossasia/magic-epaper-app/blob/main/lib/utils/image_processing/image_processing.dart): `lib/utils/image_processing/image_processing.dart`
- [Rust bridge](https://github.com/fossasia/magic-epaper-app/blob/main/lib/src/rust/api/simple.dart): `lib/src/rust/api/simple.dart`
- [Rust dithering](https://github.com/fossasia/magic-epaper-app/blob/main/rust/src/api/simple.rs): `rust/src/api/simple.rs`

### Other components

- **App user**
- **NFC ePaper badge**
- **NDEF tag**

## Connections

- App user → Flutter app: uses (evidence: `README.md`)
- Flutter app → Display selection: opens (evidence: `README.md`)
- Display selection → Image editor: creates image (evidence: `README.md`)
- Display selection → Canvas editor: creates design (evidence: `README.md`)
- Display selection → Card templates: creates card (evidence: `README.md`)
- Card templates → Bulk generation: generates batches (evidence: `README.md`)
- Card templates → Weather snapshot: offers snapshot (evidence: `README.md`)
- Image editor → Image processing: processes image (evidence: `README.md`)
- Image processing → Rust bridge: calls dithering
- Rust bridge → Rust dithering: invokes
- Image editor → NFC image transfer: transfers design (evidence: `README.md`)
- Canvas editor → NFC image transfer: transfers design (evidence: `README.md`)
- Card templates → NFC image transfer: transfers design (evidence: `README.md`)
- NFC image transfer → Display protocols: uses protocols
- Display protocols → NFC ePaper badge: writes image (evidence: `README.md`)
- Image editor → Image Library: saves design (evidence: `README.md`)
- Image Library → NFC image transfer: retransfers design (evidence: `README.md`)
- App user → NDEF read/write: reads or writes (evidence: `README.md`)
- NDEF read/write → NDEF tag: exchanges records (evidence: `README.md`)
- App user → Command console: sends commands (evidence: `README.md`)
- App user → Arduino export: exports (evidence: `README.md`)
