nano
Version, currently main branch1 version
- main branchlatestJun 3, 2025
github.com/ysbaddaden/nanolib.cr
Minimal alternative corelib for the Crystal programming language
37 stars
0 dependents
License: Apache-2.0
Installation
# Add this to your shard.yml
dependencies:
nano:
github: ysbaddaden/nanolib.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- Apache-2.0
- Author
- Julien Portalier <julien@portalier.com>
Dependencies
This version declares no dependencies.
Documentation
Generated from the source of the current release. The first visit to a release that has never been documented starts its build.
README
# Nano
A minimal alternative core library for the Crystal programming language.
## What
Nano is an alternative core library that doesn't need a GC and tries to bring
some features from stdlib that don't allocate memory behind your back, yet still
leverage structs, generics and exceptions that don't raise but will panic (print
a backtrace & exit the current thread or program).
The initial intent was to have a minimal interface to implement a GC, making
sure the stdlib won't try to allocate... which would use the GC (oops).
You can use it to write programs like you would C programs, or write a C
library. You may even use it to start programmming microcontrollers (e.g.
Arduino, RP2040).
## How
The crystal compiler allows to configure an alternate prelude (a simple crystal
file) that will be loaded instead of the default prelude that will load
everything from the official core library. The compiler even ships an `empty`
prelude that only defines a `main` function and nothing more.
That empty prelude is very bare metal. Only the few compiler intrinsics are
available, that is almost nothing but basic arithmetic, pointers and support for
literals.
Nano is an attempt to bring back some niceties from the stdlib, with no GC, no
hidden allocations. Pointer#malloc is available but you know when it's called,
why it is, and are responsible to clean up the memory (or not).
## Usage
Add the nano shard:
```yaml
dependencies:
nano:
github: ysbaddaden/nanolib.cr
branch: main
```
Then use nano as your prelude:
```console
$ crystal run app.cr --prelude=nano --release
```
Alternatively you can write your own prelude and only require the bits of nano
you want. See `src/nano.cr` for example. This is currently required for
microcontrollers.
For running tests and specs, look at `Nano::Test` and `Nano::Spec`.
## License
Distributed under the Apache 2.0 license.
Links
This branch
- Branch
main- Seen
- Jun 3, 2025
- Crystal
>= 1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/ysbaddaden/nanolib.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1