A high-performance, Laravel-inspired backend framework built exclusively for Bun.
Ninots aims to provide the Developer Experience (DX) of Laravel without the bloat:
- Bun Native First: Optimized specifically for the Bun Runtime
- Zero Dependencies: If Bun can do it, we use Bun
- Laravel-like DX: Familiar ergonomics for Laravel developers
- Performance: High throughput and low memory footprint
| Package | Description |
|---|---|
| @ninots/orm | Eloquent-inspired ORM with zero dependencies |
| @ninots/container | IoC Service Container (coming soon) |
| @ninots/routing | Express-like Router (coming soon) |
| @ninots/http | Request/Response helpers (coming soon) |
bun installimport { Model, DatabaseManager, HasTimestamps, SoftDeletes } from '@ninots/orm';
// Configure database
const db = new DatabaseManager();
db.addConnection('default', { driver: 'sqlite', url: './database.db' });
Model.setConnectionResolver(db);
// Define a model
class User extends HasTimestamps(SoftDeletes(Model)) {
protected static table = 'users';
protected static fillable = ['name', 'email'];
posts() {
return this.hasMany(Post, 'user_id');
}
}
// CRUD Operations
const user = new User({ name: 'John', email: 'john@example.com' });
await user.save();
const users = await User.query()
.where('status', '=', 'active')
.with('posts')
.orderBy('created_at', 'desc')
.paginate(10, 1);# Run all tests
bun test
# Run tests with Docker (PostgreSQL + MySQL)
bun run test:dbframework/
├── packages/
│ └── orm/ # @ninots/orm - Eloquent-inspired ORM
├── scripts/
│ └── test-with-db.ts # Docker test runner
├── docker-compose.yml # PostgreSQL + MySQL for testing
└── index.ts # Main entry point
- Runtime: Bun (v1.3.9+)
- Language: TypeScript (native execution)
- Testing: Bun's native test runner
- Databases: SQLite, PostgreSQL, MySQL (via Bun SQL)
- Package Management: Bun with Catalogs + Hoisted installs
Ninots uses Bun Catalogs to centralize dependency versions across the monorepo:
{
"workspaces": {
"packages": ["packages/*"],
"catalog": {
"@types/bun": "latest",
"typescript": "^5.0.0"
},
"catalogs": {
"build": {
"@biomejs/biome": "^2.3.13",
"typedoc": "^0.28.16"
}
}
}
}Packages reference catalog versions using the catalog: protocol:
{
"devDependencies": {
"@types/bun": "catalog:", // Uses default catalog
"@biomejs/biome": "catalog:build" // Uses named catalog
}
}Ninots uses hoisted installs (linker = "hoisted" in bunfig.toml) because:
- Zero runtime dependencies: Only
@types/bunand build tools - Simpler structure: Single
framework/node_modules/directory - No phantom dependencies risks: All deps are cataloged and shared safely
This eliminates the complexity of isolated installs while maintaining dependency consistency across all packages.
The @ninots/orm package provides a full-featured ORM:
- Model: Active Record pattern with Proxy-based attribute access
- Relations: HasOne, HasMany, BelongsTo, BelongsToMany
- Query Builder: Fluent API for building SQL queries
- Concerns: HasTimestamps, SoftDeletes, HasEvents, HasScopes
- Eager Loading:
with()andload()for N+1 prevention - Accessors/Mutators: Transform attributes on get/set
- Pagination:
paginate()andchunk()for large datasets - Transactions: Native Bun SQL transactions with
begin() - Decorators: Optional
@Tableand@Columndecorators - Multi-Database: SQLite, PostgreSQL, MySQL support
See ORM Documentation for full details.
80 tests passing
0 failures
126 expect() calls
MIT
Contributions are welcome! Please follow the project's coding standards defined in GEMINI.md.