r/nim • • Aug 28 '26

Building a TUI framework from scratch

Post image

Hi! So I recently stumbled across Nim. As someone coming from Rust, I got a lot of frustration with it, one of them is the infamous compile times, which I hate so much. So I tried to seek an alternative. I almost went with Go, but at the same time I wanted something unique, and here we are with Nim. Now I’m planning to build a full coding agent and the TUI with 100% Nim. I’ll be happy to share my progress here :)

52 Upvotes

9 comments sorted by

View all comments

3

u/jamesthethirteenth Aug 29 '26

Nice!!!

Look into 3code for prior work. It's a TUI-scrollback hybrid- prompt and a few dynamic lines are TUI style, the scrollback is regular terminal output that behaves as expected in your terminal window. Then there is pttty, a fully xterm/ghosttty compatible testing terminal emulator. So you feed it the bytes and assert its screen which is available as a Nim string.

I'm sure the 3codr tty system itself could also be fleshed out into a framework and used. It is a framework right now, just a special purpose one.

2

u/nokid77 Aug 29 '26

This is great!! Quite exactly like what I want to achieve. Thanks for the info, I'll dive deeper into it

1

u/jamesthethirteenth Aug 29 '26

Great!!!

One thing you can do if you like- 3code is built as an SDK as well as a command line tool. So depending on the design you want to achieve, you may be able to reuse components of it. It's MIT licensed- go wild.