The API is modeled after Flutter. StatefulComponent, setState(), Row, Column, Expanded, ListView.
There have been some discussions about performance of TUIs recently, and I think Dart is actually a great language for writing TUIs in. It compiles down to fast native code, is cross-platform, and has great developer ergonomics. JIT compilation for development (which enables hot reload) and AOT compilation for production binaries.
What's really cool is stateful hot reload. If you save your file with some modification, Nocterm will pick it up and update the TUI in real time without restarting.
Under the hood:
- Differential rendering: virtual terminal buffer, only redraws changed cells - Declarative component model (same as Flutter): Component → Element → RenderObject pipeline - 45+ components: layout, scrolling, text input, markdown, animations, mouse support - Built-in test framework: pump a component, send keys, assert on terminal state - Theming: 6 built-in themes, auto-detects terminal dark/light mode
Example:
void main() async { await runApp(Counter()); }
class Counter extends StatefulComponent { int _count = 0;
Component build(BuildContext context) {
return Focusable(
onKeyEvent: (event) {
if (event.logicalKey == LogicalKey.space) {
setState(() => _count++);
return true;
}
return false;
},
child: Center(child: Text('Count: $_count')),
);
}
}I tried a couple of existing TUI frameworks but missed the Flutter DX I've learned to love, so I built my own (for better or worse...).
I've been using Nocterm to build vide_cli (https://github.com/Norbert515/vide_cli), a coding agent in the terminal.
There's some cool stuff coming up too, like virtual text selection in alternate screen mode. Since TUI apps take over the terminal, normal text selection breaks. This reimplements it at the framework level so users can select and copy text naturally.
Repository: https://github.com/Norbert515/nocterm
Happy to answer questions about the architecture, hot reload implementation, or anything else.
What are compiled binaries like with this and Dart? I've been building a sort of similar framework and engine in Nim, mostly because I can get binaries under 200Kb. I looked into implementing the concept in other languages but don't recall much with Dart.
Also, how does this carry over to Flutter? Is this similar enough that minimal changes would be needed to move a TUI app into Flutter's graphical domain?
Binaries in Dart are definitely larger than 200kb, I just AOT compiled one of the examples and it was ~7.4MB (arm64 MacOS). Dart has a few different targets it can compile to, but it generally requires a couple of MBs, as it packages the whole runtime.
Yeah, my goal definitely is to have to as close to Flutter where it makes sense. You should mostly be able to copy it over 1:1, with a couple of caveats (GUI and a TUI app have a few differences here and there).
How did you handle the WASM backend? That part was extremely impressive to me. But aren't the binaries practically too large for WASM?
In any case, really love what you're doing and will be following progress. Outstanding work!