Basket case is sort of like what boost for C++ is, but less over-engineered and with more of a focus on simplicty and hackability. It is licensed under the LGPL version 3. Unlike most libraries, it will not be targetting future lgpl versions for the foreseeable future until the after effects of the cancel culture attempts to unperson Richard Stallman from the FSF with lies, slander, and misreprenstation becomes more apparent.

You can view the license here or here -

Meta Modules

Nake Expansion (basket/cases/meta/nakespansion) | Source Code

Provides several utility functions for project-level tasks such as fetching dependencies via nimble, initializing and fetching submodules, as well as a general purpose means of compiling a Nim-based executable in release and debug modes.

Algorithm Modules

Dirtiable (basket/cases/algorithm/dirtiable) | Source Code

A module that provides a way to have modifiable variables that can retain their prior state. Useful for gui code involving options menus.

Random helpers (basket/cases/algorithm/helpers) | Source Code

A module that provides a few helper functions such as giving a len function for enum types.

Standard Library Expansion Modules

Extra string functions (basket/cases/stdspansion/strextras) | Source Code

Adds several convienance functions that should be in strutils but aren’t. Also implements some alternative versions for existing functions that do less allocation.

Extra os functions (basket/cases/stdspansion/osextras) | Source Code

Adds convienance functions like array-taking versions of some. Doesn’t really do anything massive just some nice stuff to reduce your workload.

Extra math data types (basket/cases/stdspansion/mathextras) | Source Code

Adds extra data types for maths targeting game development purposes. This module is a meta-module - you can import the various sub parts to minimize imports. It provides

Math Extras Submodules

Note: Some of these modules have optional support for Vladar4’s excellent SDL2 library which can be enabled by passing --define:SDL_SUPPORT when compiling.

2D Point types (basket/cases/stdspansion/mathextras/point2d) | Source Code

Implements a data type containing a point in 2D space.

3D Point types (basket/cases/stdspansion/mathextras/point3d) | Source Code

Implements a data type containing a point in 3D space.

2D Vector types (basket/cases/stdspansion/mathextras/vector2d) | Source Code

Implements a data type containing a vector in 2D space.

3D Vector types (basket/cases/stdspansion/mathextras/vector3d) | Source Code

Implements a data type containing a vector in 3D space.

Rect types (basket/cases/stdspansion/mathextras/rect) | Source Code

Implements a data type containing a rectangle in 2D space.

2D Transform types (basket/cases/stdspansion/mathextras/transform2d) | Source Code

Implements a data type containing a transform in 2D space.

3D Transform types (basket/cases/stdspansion/mathextras/transform3d) | Source Code

Implements a data type containing a transform in 3D space.

Data Modules

DEPRECATED Event system (basket/cases/data/events) | Source Code

Provides a pure nim implementation of a basic observer pattern signal bus.

Event system (basket/cases/data/signals) | Source Code

Provides a pure nim implementation of a basic observer pattern signal bus. It deprecates the old events.nim module and provides much simpler and a much easier API to use. No multimethods anymore, just a basic object.

Basic hash tables (basket/cases/data/hashtables) | Source Code

WARNING This might need to be moved to experimental due to some potential problems!
Nim’s standard library provides an excellent tables module, but this module sometimes is missing certain functionality, such as being able to get something via a numerical index (ex: getting the very first value without having to track the key). That’s where this module comes in. It’s probably not as optimized, nor as featured, but it serves as a nice basic container.

Memory pool (basket/cases/data/mempools) | Source Code

Provides a generic memory pool container for object references. depends on Nuuid when built with --define(debug).

Optionality (basket/cases/data/optionality) | Source Code

Provides a custom solution for optional types. The use case is expecting generally one of three states - success, failure, and success but with warnings, with the failure value always being a string. Care was taken to keep things simple. This will remove the third-party dependency for Arnetheduck’s Nim-Result module, an excellent library that may be better for your use case if you need an optional who’s error value can be anything.

String Modules

Command Expansion (basket/cases/parsing/expandcmd) | Source Code

Performs something similar to some foss software such as tmux that try to match a string against a given list of[Nim-Result] module for the return value.

OS Modules

X11 Clipboard (basket/cases/os/linux/x11clipboard) | Source Code | C Source Code

Provides access to the X11 clipboard. Has a C dependency that is automatically compiled at build time.

Syslog (basket/cases/os/linux/syslog) | Source Code

Allows for emitting to the syslog with an entirely native interface.

Path Utilities (basket/cases/os/linux/pathutils) | Source Code

Provides functions for working with paths on a linux system as well as cleaning them up for use in a pipe chain.

XDG Standards support (basket/cases/os/linux/xdg) | Source Code

Provides helpers for working within the XDG Base Directory Specification’s directories.

Crossplatfrom Standard Paths (basket/cases/os/stdpaths) | Source Code

Provides functions to get paths to standard locations for system-wide things, such as the configuration directory if applicable.

Terminal Modules

DEPRECATED Log (basket/cases/terminal/log) (Nim can’t even build it’s docs anymore) | Source Code

A generic and customizable log module that provides a Sink concept that allows for a single logger to easily dispatch to multiple sinks, such as stdout and a file sink. New sinks can be defined via a simple inheritance and method approach. An example custom sink which also provides a syslog sink for linux is provided. See below.

DEPRECATED Log - Syslog sink (basket/cases/terminal/log/syslogsink) (Nim can’t even build it’s docs anymore) | Source Code

An example for how to make a custom sink for the log module as well as a syslog sink that uses basketcase’s syslog module.

Simple and pretty console (basket/cases/terminal/simpleconsole) | Source Code

A non-configurable basic but pretty console module. It supports long-text output and general pretty-ness.

Ansi escapes helper (basket/cases/terminal/ansi) | Source Code

A helper for working with direct ansi escapes focused around color usage. Supports the normal 16 colors as well as leveraging Nim’s colors module with true color support.

This module has a few compile-time options available

Disables all true color code from being compiled


Disables all color code. Useful to disable colors if necessary making this fairly safe to use just about anywhere. All color escapes will be mapped to ""

Experimental Modules

A library for making logging easier (basket/experimental/terminal/logcore) | Source Code

A module meant to make instituting your own console and file logger systems easier. Supports theming, customization, and more. This is still relatively new so expect breaking changes. (Needs: API cleanup and solidification, Documentation)

A multithreaded logging interface (basket/experimental/terminal/simplelog) | Source Code

The reference implementation for how to interface with logcore. Provides a logger that by default only uses console output and runs in its own thread. Note that logcore does not by itself need threads, so you can use that and set it up yourself if you need to. (Needs: API cleanup and solidification, Documentation)