r/nim • • 4h ago

Neel 2.0: HTML/JS GUI apps for Nim, rewritten from scratch

15 Upvotes

https://github.com/Niminem/Neel

Some of you may know Neel. This was my first Nim repository from 2020 when I was first learning it. It was what drove me to move from Python to Nim! It is my child and if you speak ill of it we will have problems (jk).

Neel is a library for making lightweight Electron-like desktop apps: the UI is in HTML/CSS/JS and everything else in Nim.

I just released v2. It is a ground-up rewrite. It is much better- more ergonomic, more capable, more... everything. Especially fun. A lot more fun.

Example, you can mark a Nim proc with {.expose.} pragma and the HTML page can call it as neel.<name>(...) and gets the return value back through a Promise. Register a JS function with neel.expose and Nim calls it as js.<name>(...), or js.wait.<name>(...) when it needs the answer. That's just too f*****g cool man. Neel handles the server, the browser window, the JSON conversion, the errors in between, all that stuff that's a PIA.

The short version of what's new:

  • Return values in both directions (1.x had none). Nim exceptions reach JS as e.name / e.message; JS throws reach Nim as NeelRemoteError.
  • {.expose.} on any top-level proc, in any module. Objects, Option, Table, HashSet, enums, tuples, JsonNode, and default parameter values all convert automatically.
  • Multiple windows, each addressable from Nim (openWindow, closeWindow, windows(), requireWindow(id), hooks).
  • Its own thread-based HTTP/WebSocket server in the spirit of Mummy: one IO thread owns the sockets, a worker pool runs your procs, no async anywhere. Mummy itself is gone.
  • Zero dependencies. Standard library only.
  • Finds Chrome, Chromium, or Edge and opens them in app mode (no tabs, no address bar); falls back to a tab in the default browser when none is installed.
  • Hardened against other websites open in the same browser: per-launch token plus Host / Origin / Sec-Fetch-Site checks, server bound to 127.0.0.1 only.
  • Release builds embed the web folder into the binary, so you ship one file.

Verified on macOS, Windows, and Linux (Ubuntu). Requires Nim >= 2.2.12 (older allocators crash intermittently when memory is freed after the owning thread exits, so Neel refuses to compile on them).

A complete app. The page asks for a directory and Nim picks a random entry from it:

import std/[os, random]
import neel

type
  MissingDirectoryError = object of CatchableError
  EmptyDirectoryError = object of CatchableError

proc filePicker(directory: string): string {.expose.} =
  let dir = absolutePath(directory, root = getHomeDir())
  if not dirExists(dir):
    raise newException(MissingDirectoryError, "no such directory: " & dir)
  var names: seq[string]
  for _, path in walkDir(dir):
    names.add path.extractFilename
  if names.len == 0:
    raise newException(EmptyDirectoryError, "the directory is empty: " & dir)
  var rng = initRand() # exposed procs run on worker threads
  rng.sample(names)

startApp()

And the page side (web/main.js, loaded after <script src="/neel.js">):

try {
  const name = await neel.filePicker(input.value);
  result.textContent = name;
} catch (e) {
  error.textContent = e.name + ": " + e.message;  // ex: "MissingDirectoryError: no such directory: ..."
}

Calling back into the page from Nim works the same way in reverse:

proc askPage(question: string): string {.expose.} =
  let reply = js.wait.answer(question)  # blocks until the page answers
  "the page answered: " & reply.getStr

proc notify(text: string) {.expose.} =
  js.showToast(text)                    # fire-and-forget

neel.expose(async function answer(question) {
  return prompt(question);
});

HOW COOL IS THAT???

Moving on...

nim c -r main.nim for development (assets read from disk, refresh to see changes), nim c -d:release main.nim to ship (assets embedded). Add --app:gui to hide the terminal.

Nothing from 1.x compiles unchanged; the README has the rename table and the guide (docs/GUIDE.md) has every detail: the full type list, error messages, lifecycle, threading model, security, caveats. Three runnable examples in the repo; start with examples/filepicker.

---

Neel started years ago as a port of Python's Eel library (now deprecated), and the 1.x line never really outgrew that: one window, no return values, a block of exposeProcs:, etc. Back in 2023 I rewrote the server with Mummy as the server because of a bunch of async problems but still never addressed some of its shortcomings.

I finally sat down and rewrote the whole thing. The big question was whether to keep an external server library or write one. Mummy had effectively been abandoned (there's a fork, but relying on a fork of an unmaintained dependency for the core of the library didn't sit right), and I'm using Neel for work, so future-proofing it mattered. Writing the server myself also meant Neel controls the threading, the shutdown ordering, and the WebSocket details end to end, which turned out to matter a lot for return values and multiple windows. Mummy is great and the design here is very much borrowed from it: one IO thread, a worker pool, no async. It's just all in the stdlib now, with no deps.

The big thing that ate most of my time was actually the hardening pass. Running all three examples on three OSes, trying to break them, and fixing what broke turned up some fun findings: a refreshed stale tab stealing another window's identity, Edge signing a fresh profile into your Microsoft account and syncing your extensions into the app window, Windows select silently capping you at about 8 windows, an allocator crash that pushed the minimum Nim to 2.2.12, all kinds of stuff. All has been fixed and pinned down with tests.

So this release had a lot of effort put into it. I'm sure you'll find it enjoyable and useful.

I have a few things next on the list: Brave / Opera / Vivaldi discovery (basically any other chromium based browsers), a Webview target (at least for Mac and Linux since Windows is guaranteed to have Edge), custom HTTP routes, and wss:. I will get to them when I can, but issues and PRs welcome of course.

Enjoy!


r/nim • • 1d ago

is nim good at making external dsls

11 Upvotes

can nim convert into aarch64


r/nim • • 6d ago

strip metadata from photos, audios and videos

Thumbnail github.com
12 Upvotes

I guess we should animate this sub somehow. A simple CLI for removing metadata from files!

``` usage: striptease <input|input-dir> --out:<dir> [options]

required: <input> file or directory (mixed formats allowed) -o, --out:<dir> output directory for cleaned copies (single file input plus --out:foo.ext writes one file, not needed with --inspect)

supported formats: audio: .wav | images: .jpg .jpeg .png .gif .webp raw: .cr2 .nef .nrw .arw .srf .dng .rw2 .orf .pef .srw .tif .tiff video: .mp4 .mov .m4v .avi .mkv .webm | canon raw: .cr3 | heic: .heic .heif .hif

options: --dry-run report only, write nothing --inspect print metadata as pretty JSON, write nothing --verbose per file kept and dropped chunks plus bytes saved --overwrite overwrite existing files in out dir (default: skip) --keep-musical WAV only: also keep cue, smpl, inst, acid chunks -h, --help show this help --version show version ```


r/nim • • 6d ago

yet another proxy lib

Thumbnail github.com
3 Upvotes

i didn't like the lack of proxy libs, so naturally i wrote my own
feel free to contribute.


r/nim • • 11d ago

cursorsdk: Cursor SDK Bridge client for Nim

8 Upvotes

https://github.com/Niminem/cursorsdk

Cursor has an SDK and is what powers both the Cursor CLI and the Cursor editor. It's very powerful and flexible (ex: you can actually control the system prompt, tools, and much more).

At some point not long ago they created an SDK Bridge that allows non-typescript and non-python languages to communicate with it via RPC. Of course I had to write a Nim client for it.

It is fully compliant- built with and tested against their documentation. I did have to add some workarounds for upstream issues, but it's mostly implementation details (all noted in readme).

No deps aside from the nim standard library.

I've tested it on Mac (x64) and Windows (x64). Should work out of the box for Linux but it's untested.

You could build your own harness on top of this and all kinds of automations, scripts, etc. Pretty cool! Enjoy.

Example:

import std/asyncdispatch
import cursorsdk
proc main() {.async.} =
  let client = newClient()                 # CURSOR_API_KEY from env
  defer: waitFor client.close()
  let agent = await client.createAgent("composer-2.5")
  let run = await agent.send("Summarize this repository.")
  while true:
    let chunk = await run.nextText()
    if chunk.isNone: break
    stdout.write chunk.get
  await agent.close()
waitFor main()

r/nim • • 14d ago

Packages to make Gui apps

15 Upvotes

So, I'm pretty new to nim, and I wanted to make my first app, so, I wanted you guys some recommendations of packages for Gui apps creation,

If u guys want to see the idea, just read:

notepad, but for markdown, and with vertical tabs, like arc and zen browser


r/nim • • 14d ago

Which IDE you guys use to code?

9 Upvotes

r/nim • • 15d ago

HQTUI — Terminal UI for nim

Thumbnail hqtui.com
18 Upvotes

r/nim • • 17d ago

this page is linked form nim lang site and 502s

Thumbnail nimble.directory
7 Upvotes

r/nim • • 17d ago

just learned about nim via nimble

8 Upvotes

WHat's the 10,000 foot view here? is it as fast(er) than rust?


r/nim • • 20d ago

qwatcher version 0.7.0 is released

17 Upvotes

Hey all,

qwatcher is a very efficient tool to monitor and audit your NICs' send and receive queue buffers to spot network or application issues.

This version drops the `ss` and `libpcre` dependencies, making the program a pure Nim binary, solves some bugs, and provides a `tail`-like report capability.

Here is the link to the repo:

https://github.com/pouriyajamshidi/qwatcher


r/nim • • 28d ago

Sirius is an independent web engine written in Nim

Thumbnail gallery
68 Upvotes

Hey there.

I've been working on a successor to my previous web engine project, Ferus (which is now officially abandoned) for the past three or so months at this point. As the title suggests, Sirius is a web rendering engine like Chromium's Blink or Firefox's Gecko, but written largely in Nim (with the exception of certain C/C++ dependencies, obviously). Its CSS parser, JavaScript engine (a hard fork of Bali with a LOT of improvements), layout engine and the like are all written in Nim.

It uses a multiprocessing architecture, meaning each tab occupies one browser process and it crashing does not bring the entire browser down with it.

It's not exactly fast or optimized right now, but I believe it's ready enough for very basic web browsing tasks that don't touch the modern web. You're probably not going to be logging into your mail with it for a while. :^)

Sirius can be embedded into programs using OpenGL/Vulkan using its WebView API, the same one that the browser UI uses. It abstracts away process management and tabs away from you, leaving you to only handle presenting the final rendered page framebuffer it passes you. That means you can use Sirius to make your own web browsers in Nim, or if you're brave enough, to use it as a GUI framework in your app. :P

It's currently only on Linux due to it utilizing many Linux-isms like DMA-BUF, but there are plans to port it to other platforms too.

I'd love to hear what you guys think about it. And yes, I welcome most contributions, even tiny ones not related to web browser engineering. If you want to use this project as an excuse to get into that field, be my guest. Here's the contribution guide if anyone's interested.

The source code lives both here on a Github mirror, but it's actually developed on my personal forge.

Adios!


r/nim • • 29d ago

Official Nim SDL3 bindings brought up to SDL 3.4.12

Thumbnail github.com
47 Upvotes

This update fixes the broken hints and brings the API coverage up to speed. It also adds bindings for sdl3_mixer, and fleshes out what's there for sdl3_ttf. I haven't done game dev in Nim in a little while, but this should make it easier for any SDL users to hop in.


r/nim • • Sep 09 '26

Nim version 2.2.12 released

Thumbnail nim-lang.org
74 Upvotes

r/nim • • Sep 09 '26

NIM OR VLANG?

0 Upvotes

Dude, I think V is better because it's both much easier and practically everything is included. If you want to do something, you don't need to download any libraries at all.


r/nim • • Sep 07 '26

Nim port of wlogout

Thumbnail github.com
25 Upvotes

I was annoyed by how one button is always selected in wlogout. And since it doesn't seem to be actively maintained anymore, the only way to fix it is with a fork. So I thought it'd be a good opportunity to port it over to Nim. Its mostly backwards compatible wlogout. So old configs should work. But I've made some small changes and switched over to TOML for the config. Feel free to have a look.


r/nim • • Sep 07 '26

My first Nim project lscd

Thumbnail github.com
40 Upvotes

I've been using python for 20 years since I dont work on C++ by then.

Nim gives me some reason to try new things.

I created my first 'real' nim project several days ago and I'm heavily using it daily.

It is a tiny tool as a shortcut for ls + cd, that I can use to fast navigation in folders.

For such tasks, I can not do it in python because the launch speed and having a binary is very important.


r/nim • • Sep 06 '26

Trying to build my audio library

12 Upvotes

[Linux]

This idea was born while I was building my TUI music player. I've found such a big barrier:

in nimble I couldnt found any musical libraries for my goals, and i was too lazy to importing headers from C. So, i've created a concept and want make from this concept a completed and most importantly usable and simple lib.

It would be really nice to get some feedback(if you're interest)
source: https://github.com/svyatoslavSPB/nimnaudio/tree/main


r/nim • • Aug 28 '26

Building a TUI framework from scratch

Post image
51 Upvotes

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 :)


r/nim • • Aug 29 '26

KANKALAR BEN BİR DİL YAPICAM

0 Upvotes

Arkadaşlar ben bir programlama dili yapmak istiyorumda hem hızlı olsun hemde derlenmesi kokay olsun hemde Python kadar kolay; işlemciyle konuşan bir dil yapmak istiyorumda acaba Nim iyimi ? Pascal,Forth,Vlang falan varda acaba hepsi yerine Nim mi kullansam ? YARDIM EDİNNNNNNNNNNNNNNNNNN !


r/nim • • Aug 24 '26

I stopped vibe coding for nim.

Post image
62 Upvotes

​

hello, I want to say that I was a vibcoder before that, but not because I liked it, I don't have any free time Except for one or two hours at night (they give me 10 hours to sleep) and of course I don't want to spend these personal 2 hours on programming, let alone studying but the desire to be a real programmer who can really just write his own program with his own hands is stronger than the desire to do nothing further. ;

why nim?

I went through a lot of options, and although nim was not the only option, it was ideally suited according to the criteria: "simple", "many libraries", "fast", so I chose it.

personally, I am proud that I searched for information about Nim and other programming languages without a neural network (and although I was a vibecoder, I want to say that I hated and hate neural networks)

What's next?

I won't be learning much about nim as much as time allows me.


r/nim • • Aug 21 '26

Any Nim success stories? Or maybe horror stories instead?

46 Upvotes

Hey, everyone. Do you have any anecdotes to share about Nim? It doesn't matter whether it was positive or negative. I am just curious how the use of Nim has affected you. And to keep this subreddit more alive.

Thanks a lot!


r/nim • • Aug 20 '26

Nim-agent-template: Scaffolding Generator with AI Agent Skills, MCP Tooling, and Multi-Toolchain Build Profiles

20 Upvotes

Hello everyone,

I have put together nim-agent-template, a project template and scaffolding tool designed to bootstrap Nim applications and libraries with standard build task orchestrations, MCP support, and AI agent skills.

Repository

GitHub: https://github.com/Vyrnexis/nim-agent-template

Highlights & Features

  • Interactive & Scriptable Scaffolding (init_nim_project.sh):
    • Prompts for package type (Binary vs Library), tooling (nimble vs atlas), author, and license.
    • Supports non-interactive CLI flags (--name, --tooling, --kind, --in-place) for automated setups.
    • Includes an --install-cli option to install init-nim-project into ~/.local/bin/ with canonical symlink resolution.
  • 6 Standardized Build Profiles in config.nims: All binaries are strictly emitted into ./bin/ at the repository root:
    • nim nimRelease: Native host-optimized binary (-d:release -d:danger --opt:speed -march=native -mtune=native)
    • nim nimPortable: Generic CPU baseline portable binary (-d:release --opt:size -mtune=generic -s)
    • nim nimDebug: Diagnostics build with stack traces and assertions (--debuginfo:on --assertions:on --stackTrace:on)
    • nim zigRelease: Native host binary using Zig CC (--cc:clang -d:release -d:danger --opt:speed -O3 -march=native)
    • nim zigPortable: Generic CPU portable binary using Zig CC (--cc:clang -d:release --opt:size -Oz -mcpu=baseline -s)
    • nim zigDebug: Zig CC debug build with symbols (--cc:clang --debuginfo:on)
    • Plus standard helper tasks: nim test, nim fmt (nimpretty), and nim docs.
  • Model Context Protocol (MCP) Integration:
    • Automatically configures .mcp/servers.json for nimlangserver --mcp to support symbol resolution, references, and diagnostics in AI-assisted environments.
  • Pre-Bundled Agent Skills (.agents/skills/):
    • Ships with 19 curated Nim agent skills covering API design, C wrappers and FFI bindings, ARC/ORC ownership hooks, testing patterns, error contracts, style guides, and fuzzing harnesses.
  • Automated CI Workflow:
    • Emits a ready-to-use GitHub Actions workflow (.github/workflows/ci.yml) leveraging jiro4989/setup-nim-action with formatting validation and test execution.

Quick Start

# Clone the template repository
git clone https://github.com/Vyrnexis/nim-agent-template.git
cd nim-agent-template

# Run the interactive initializer
./init_nim_project.sh

Or install it system-wide to scaffold projects from any workspace:

./init_nim_project.sh --install-cli

cd ~/my_workspace
init-nim-project --name my_app --tooling nimble --kind bin

Feedback, suggestions, and contributions are very welcome!

GitHub: https://github.com/Vyrnexis/nim-agent-template


r/nim • • Aug 15 '26

KoutenDB: A Database Built in Nim to Reduce Retrieval Work Through Data Locality

25 Upvotes

Hi everyone,

I’m the author of KoutenDB, an open-source locality-first document database written in Nim, with ring-scoped vector retrieval.

https://github.com/puffball1567/koutendb

KoutenDB is built around a locality-first retrieval model.

Applications and import rules place related data into explicit coordinates called rings. A ring is more than a category or routing label: it defines the initial candidate set and maps to ring-local persistent storage and cluster routing.

For example, data related to one user can be placed around users/123, with nearby subrings for profiles, addresses, orders, and notifications. KoutenDB can retrieve that related group together or narrow the read to selected subrings.

The goal is to avoid starting with a large unrelated dataset and filtering or reranking it afterward. This can be useful for RAG and LLM workloads, where every unnecessary candidate may also consume memory, ranking work, and context tokens.

Vector retrieval is supported, but vectors are not the basis of the data model. They are one possible ranking step after locality has narrowed the candidate set.

Some results from the included reproducible benchmarks:

- Working-set benchmark: scanned records per query decreased from 10,000 to 100.

- Memory-pressure benchmark: estimated candidate memory per query decreased from 93.079 MiB to 0.931 MiB.

- Synthetic RAG benchmark: recall remained 1.000 while scanned records per query decreased from 8,000 to 1,000 and estimated tokens per query decreased from 3,955 to 657.

- Generated AI/RAG JSONL case study: recall remained 1.000 while scanned records per query decreased from 400 to 40 and estimated tokens per query decreased from 615.2 to 231.6.

The benchmark scripts and generated datasets are included in the repository so that the results can be reproduced and examined.

KoutenDB also carries locality into persistent storage. Ring-local segments allow disk-backed reads to open the relevant ring data instead of replaying or scanning the complete database.

In an included 1,050,000-record related-data benchmark, KoutenDB retrieved a multi-subring user bundle in 196.859 microseconds. In the same included comparison, the equivalent logical result measured 515 microseconds using six indexed PostgreSQL queries and 236 microseconds using a PostgreSQL JSON aggregate query.

I have also been testing operational stability. A three-node persistent KoutenDB cluster completed a 72-hour Ubuntu run with 4,022,516 mixed client operations, zero client errors, successful offline verification of every data directory, and no fallback to global retrieval.

The trade-off is that applications or import rules need to choose meaningful rings. If useful locality is not known in advance, retrieval may still require a broad scan.

KoutenDB currently supports embedded and TCP server modes, persistent storage, exact ring-scoped vector retrieval, transactions, locks, backup and restore, corruption detection, cluster routing, and a C ABI. Language bindings and driver foundations are available for Rust, JavaScript/TypeScript, Python, PHP, and C++.

The project is currently at v0.12.0.

I’d especially appreciate technical feedback on the ring-local storage model, retrieval design, physical locality, and the Nim implementation.


r/nim • • Aug 13 '26

An Example of Nim WASM for Wolfram Alpha alternatives

Post image
32 Upvotes

My original post: https://www.reddit.com/r/sideprojects/s/2WBPjTT8Wu

I’ve been pretty busy lately, but I was thinking—what if Nim had its own SymPy Gamma / Wolfram Alpha-style project?

By using WASM, most of the computation could run directly in the browser, so it could stay free without needing a backend server. The compiler is still the WASM based Nim Compiler in the Web which exports the HTML and Wasm file.

It could start with symbolic math, derivatives, integrals, equations, matrices, and step-by-step solutions, and grow from there.

Basically, a small computer algebra system for Nim + WASM. Link to the calculator: www.qoqoro.online