Skip to main content
jasonisnthappy is available for Rust, Go, Python, and JavaScript (Node.js, Deno, and Bun). Choose your language below to get started.

Rust

For Rust projects, add jasonisnthappy as a dependency to your Cargo.toml:

Features

jasonisnthappy supports optional features that can be enabled in your Cargo.toml:
Cargo.toml
The web-ui feature includes the tiny_http dependency for serving the dashboard. Disable it with default-features = false if you don’t need the web interface.

Platform support

  • macOS: ARM64 (Apple Silicon) and x86_64 (Intel)
  • Linux: ARM64 and x86_64
  • Windows: x86_64

Quick example

src/main.rs

Go

For Go projects, jasonisnthappy uses CGO to link against native libraries. The libraries are automatically downloaded during installation.
1

Install the package

Terminal
2

Download native libraries

Terminal
This downloads the pre-compiled static library (.a file) from GitHub releases and caches it in lib/<platform>/.
3

Build your application

Terminal
Your binary is now fully self-contained with no external dependencies!
CGO must be enabled (which is the default). The native library is statically linked into your binary, so you get a single standalone executable with zero runtime dependencies.

Requirements

  • CGO enabled (default on most systems)
  • C compiler:
    • macOS: xcode-select --install
    • Linux: apt install build-essential or yum install gcc
    • Windows: Install MinGW-w64
  • Internet connection for first build (to download native library)

Platform support

  • macOS: ARM64 (Apple Silicon) and x86_64 (Intel)
  • Linux: ARM64 and x86_64
  • Windows: x86_64
Windows ARM64 is not currently supported.

Quick example

main.go

API reference

See the Go bindings README for complete API documentation including:
  • Database.Open(path string) (*Database, error) - Open a database at path
  • Database.BeginTransaction() (*Transaction, error) - Start a new transaction
  • Transaction.Insert(collection string, doc interface{}) (string, error) - Insert document
  • Transaction.FindByID(collection, id string, result interface{}) (bool, error) - Find by ID
  • Transaction.UpdateByID(collection, id string, doc interface{}) error - Update document
  • Transaction.DeleteByID(collection, id string) error - Delete document
  • Transaction.Commit() error - Commit changes
  • Transaction.Rollback() - Rollback changes

Python

For Python projects, install jasonisnthappy via pip. The package automatically downloads the native library for your platform.
Terminal

Platform support

  • macOS: Intel and Apple Silicon
  • Linux: x86_64
  • Windows: x86_64
Pre-built binaries are provided for all supported platforms and are automatically downloaded from GitHub releases.

Quick example

main.py

Using context managers

Python bindings support context managers for automatic resource cleanup:
main.py
Using context managers is the recommended approach as it ensures proper resource cleanup even if errors occur.

Type hints

The library includes full type hints for better IDE support:
main.py

API reference

Key classes and methods:
  • Database.open(path: str) -> Database - Open a database
  • Database.close() -> None - Close the database
  • Database.begin_transaction() -> Transaction - Begin a transaction
  • Transaction.commit() -> None - Commit the transaction
  • Transaction.rollback() -> None - Rollback the transaction
  • Transaction.collection(name: str) -> Collection - Get or create a collection
  • Collection.insert(doc: Dict[str, Any]) -> int - Insert a document
  • Collection.find_by_id(doc_id: int) -> Dict[str, Any] | None - Find by ID
  • Collection.update(doc_id: int, doc: Dict[str, Any]) -> None - Update document
  • Collection.delete(doc_id: int) -> None - Delete document
  • Collection.query(query_str: str) -> List[Dict[str, Any]] - Execute a query

JavaScript (Node.js, Deno, Bun)

For JavaScript projects, jasonisnthappy is available as an npm package with TypeScript type definitions included.
Terminal
The native library is automatically downloaded during the postinstall step from GitHub releases.

Requirements

  • Node.js: 14 or later
  • Deno: Supported (use npm: specifier)
  • Bun: Supported

Platform support

  • macOS: ARM64 (Apple Silicon) and x86_64 (Intel)
  • Linux: ARM64 and x86_64
  • Windows: x86_64

Quick example (CommonJS)

index.js

Quick example (ES modules)

index.mjs

TypeScript support

Full TypeScript definitions are included. Use generics for type-safe operations:
index.ts

API reference

Key classes and methods from index.d.ts:175-253:
  • Database.open(path: string): Database - Open a database
  • Database.close(): void - Close the database
  • Database.beginTransaction(): Transaction - Start a transaction
  • Database.getCollection<T>(name: string): Collection<T> - Get a typed collection
  • Transaction.insert<T>(collection: string, doc: Omit<T, '_id'>): string - Insert document
  • Transaction.findById<T>(collection: string, id: string): T | null - Find by ID
  • Transaction.commit(): void - Commit changes
  • Transaction.rollback(): void - Rollback changes
  • Collection<T>.insert(doc: Omit<T, '_id'>): string - Insert document
  • Collection<T>.findById(id: string): T | null - Find by ID
  • Collection<T>.find(filter: string): T[] - Query documents
  • Collection<T>.updateById(id: string, updates: Partial<T>): void - Update document
  • Collection<T>.deleteById(id: string): void - Delete document

Building from source

If you need to build the native libraries yourself, clone the repository and use the provided build scripts:
1

Clone the repository

Terminal
2

Quick build (macOS only)

For local testing on macOS:
Terminal
3

Full build (all platforms)

Requires Docker for cross-compilation:
Terminal
This builds for:
  • macOS ARM64 and x86_64
  • Linux ARM64 and x86_64
  • Windows x86_64
Output files are placed in builds/ directory.
The build scripts use Docker containers with the official rust:1.83 image and cross-compilation tools. See bindings/README.md for architecture details.

Troubleshooting

Go: CGO errors

If you encounter CGO-related errors, ensure you have a C compiler installed:
  • macOS: xcode-select --install
  • Linux: apt install build-essential or yum install gcc
  • Windows: Install MinGW-w64

Go: Library download fails

  • Ensure you have internet connectivity
  • Check that the GitHub release exists with the required files
  • Verify your platform is supported (run go env GOOS GOARCH)

Python: Library not found

If the native library is not found, manually download it from the releases page and place it in the appropriate lib/ directory for your platform.

JavaScript: Platform not supported

The error indicates your platform is not supported. Currently supported:
  • macOS: darwin-arm64, darwin-amd64
  • Linux: linux-arm64, linux-amd64
  • Windows: windows-amd64

Database file corruption

If you suspect database corruption, jasonisnthappy includes built-in corruption detection in the LRU page cache. You can verify a backup file using:

Next steps

Quickstart

Get up and running with a working example

Core concepts

Learn about transactions, collections, and MVCC

API reference

Explore the complete API documentation

Examples

Browse more examples in the repository