carno.js README

The project's README from github.com/carnojs/carno.js. As one markdown file: README.md.

Carno.js logo

Carno.js

An opinionated application framework and ORM ecosystem for Bun and TypeScript.

Documentation · Getting started · GitHub

Bun native TypeScript first MIT license

Overview

Carno.js is an opinionated application framework for Bun, shaped for teams that want the familiar structure of NestJS and the enterprise patterns popularized by Spring in the Java ecosystem.

It combines a fast Bun-native HTTP core, dependency injection, decorators, validation, middleware, lifecycle hooks, and optional packages for data access, queues, scheduling, static files, views, WebSockets, and logging. The goal is to keep applications organized as they grow, with clear boundaries between controllers, services, modules, and infrastructure.

This repository is the monorepo for the Carno.js ecosystem. The README is intentionally concise; feature guides, examples, and API details live in the documentation site.

Why Carno.js

Packages

Package Purpose
@carno.js/core HTTP framework, routing, dependency injection, middleware, validation, lifecycle hooks, and testing utilities.
@carno.js/orm Lightweight SQL ORM for PostgreSQL and MySQL, including repositories, query builder, relationships, migrations, identity map, and sessions.
@carno.js/queue Background job processing built around BullMQ.
@carno.js/schedule Cron, interval, and timeout scheduling.
@carno.js/static Static file serving for Bun applications.
@carno.js/views Optional MVC views with Handlebars, EJS, Pug, or a custom engine.
@carno.js/websocket WebSocket gateways, rooms, namespaces, and broadcasting.
@carno.js/live Server-owned reactive state: live resources, dependency-graph invalidation, and framework-native client stores.
@carno.js/logger Logging utilities for Carno.js applications.
@carno.js/client Type-safe HTTP client generated from controllers.
@carno.js/cli Command-line tools, including ORM migration workflows.

Getting Started

Install the core package:

bun install @carno.js/core

On Windows, wrap scoped package names in quotes:

bun install "@carno.js/core"

Then follow the full setup guide in the documentation:

Installation and setup

Documentation

The documentation site is the source of truth for usage examples and API guidance:

Repository Workflow

Install dependencies:

bun install

Run the TypeScript build:

npm run build

Run tests:

bun test

Run ORM tests against PostgreSQL or MySQL:

npm run test:postgres
npm run test:mysql

Documentation Site

The site is built with Docusaurus and lives in docs/carno.

cd docs/carno
npm install
npm run start

Use the site for new guides, examples, and API explanations. Keep this README focused on project positioning, package discovery, and contributor orientation.

Contributing

Issues, pull requests, bug reports, and documentation improvements are welcome. Before opening a large change, prefer starting with an issue or discussion so the scope and expected behavior are clear.

License

Carno.js is released under the MIT License. See LICENSE for details.

carno.js (carnojs/carno.js)

Searching Database…

这是什么东西?一个面向 Bun 和 TypeScript 的应用框架,带有明确的设计主张:采用类似 NestJS 的代码结构和 Spring 风格的企业级模式——控制器、服务、模块、依赖注入——运行在 Bun 的高速运行时之上。
它是单个包还是一整套包?是一整套。这个仓库是一个 monorepo:@carno.js/core 是 HTTP 框架(路由、依赖注入、中间件、校验),其余的一切——ORM、队列、定时任务、视图、WebSocket——都是可选包,需要时才添加。
怎么把它加到新项目里?用你的包管理器安装 @carno.js/core,然后按照文档网站上的设置指南操作。在 Windows 上,请给这个带作用域的包名加上引号。
必须用 Bun 吗,还是 Node.js 也能用?必须用 Bun:这个框架直接构建在 Bun 自身的运行时和 HTTP 服务器之上,它的性能正是来源于此。
内置的 ORM 支持哪些数据库?支持 PostgreSQL 和 MySQL。这个 ORM 自带仓库(repository)、查询构建器、关联关系、数据库迁移、identity map 和会话;迁移相关的工作流程在 @carno.js/cli 包里。
如果我的团队已经在用 NestJS,切换过去容易吗?这正是它的目标用户:它刻意复刻了 NestJS 的开发体验和 Spring 风格的架构,文档里还有一份专门的“从 NestJS 迁移”指南。
这些可选包开箱就能做什么?基于 BullMQ 的后台任务、cron/间隔/超时定时调度、支持房间和广播的 WebSocket 网关、使用 Handlebars、EJS 或 Pug 的 MVC 视图、静态文件服务,以及日志工具。
@carno.js/live 是什么?由服务器托管的响应式状态:带依赖图失效机制的实时资源(live resource),配合框架原生的客户端 store,服务器状态一变化,界面就会自动更新。
它能帮我在前端调用 API 吗?可以——@carno.js/client 直接根据你的控制器生成类型安全的 HTTP 客户端,让前端的调用始终与后端类型保持同步。
为什么不直接在 Bun 上跑 NestJS,非要另做一个?它的既定目标是让应用在规模变大时依然保持条理——控制器、服务、模块和基础设施之间边界清晰——同时性能是 Bun 内生的,而不是为了换取架构而牺牲掉。
What are similar projects?sails, beego, hestjs, laravel, iris, effect-mq, remix, Perfect
Creator
carnojs
Size
5.2 MB
Stars
111
Age
2y
Commits · 90 Days