Rust
For Rust projects, add jasonisnthappy as a dependency to yourCargo.toml:
Features
jasonisnthappy supports optional features that can be enabled in yourCargo.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
.a file) from GitHub releases and caches it in lib/<platform>/.3
Build your application
Terminal
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-essentialoryum install gcc - Windows: Install MinGW-w64
- macOS:
- 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
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 pathDatabase.BeginTransaction() (*Transaction, error)- Start a new transactionTransaction.Insert(collection string, doc interface{}) (string, error)- Insert documentTransaction.FindByID(collection, id string, result interface{}) (bool, error)- Find by IDTransaction.UpdateByID(collection, id string, doc interface{}) error- Update documentTransaction.DeleteByID(collection, id string) error- Delete documentTransaction.Commit() error- Commit changesTransaction.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
Quick example
main.py
Using context managers
Python bindings support context managers for automatic resource cleanup:main.py
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 databaseDatabase.close() -> None- Close the databaseDatabase.begin_transaction() -> Transaction- Begin a transactionTransaction.commit() -> None- Commit the transactionTransaction.rollback() -> None- Rollback the transactionTransaction.collection(name: str) -> Collection- Get or create a collectionCollection.insert(doc: Dict[str, Any]) -> int- Insert a documentCollection.find_by_id(doc_id: int) -> Dict[str, Any] | None- Find by IDCollection.update(doc_id: int, doc: Dict[str, Any]) -> None- Update documentCollection.delete(doc_id: int) -> None- Delete documentCollection.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.- npm
- yarn
- pnpm
Terminal
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 fromindex.d.ts:175-253:
Database.open(path: string): Database- Open a databaseDatabase.close(): void- Close the databaseDatabase.beginTransaction(): Transaction- Start a transactionDatabase.getCollection<T>(name: string): Collection<T>- Get a typed collectionTransaction.insert<T>(collection: string, doc: Omit<T, '_id'>): string- Insert documentTransaction.findById<T>(collection: string, id: string): T | null- Find by IDTransaction.commit(): void- Commit changesTransaction.rollback(): void- Rollback changesCollection<T>.insert(doc: Omit<T, '_id'>): string- Insert documentCollection<T>.findById(id: string): T | null- Find by IDCollection<T>.find(filter: string): T[]- Query documentsCollection<T>.updateById(id: string, updates: Partial<T>): void- Update documentCollection<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:This builds for:
Terminal
- macOS ARM64 and x86_64
- Linux ARM64 and x86_64
- Windows x86_64
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-essentialoryum 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 appropriatelib/ 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