Registry / database / kohanajs-start

kohanajs-start

JSON →
library11.11.6jsnpmunverified

KohanaJS is a Node.js ORM framework inspired by PHP Kohana, providing a code generator for database schema, ORM models, and site structure. Current stable version is 11.11.6, released on 2024-01-01 with monthly patch releases. It integrates Fastify as the default web server and Better SQLite3 for database. Key differentiators include automatic model generation from database tables, a modular MVC structure, and support for multiple databases via SQLite3. Unlike other ORMs like Sequelize or Prisma, KohanaJS offers a more opinionated, convention-over-configuration approach.

npm install kohanajs-start
INSTALL
IMPORT
SIG · KOHANAJS-START
K
kohanajs-start
databasejavascriptv11.11.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Kohana
import { Kohana } from 'kohanajs-start'
const Kohlana = require('kohanajs-start')
ESM-only since v10; default export is Kohana class.
Model
import { Model } from 'kohanajs-start'
import Model from 'kohanajs-start'
Model is a named export, not default.
ORM
import { ORM } from 'kohanajs-start'
const orm = require('kohanajs-start').ORM
CommonJS require is not supported in v11+
Database
import { Database } from 'kohanajs-start'
import { DB } from 'kohanajs-start'
Named export Database, not DB.

Shows basic KohanaJS setup with SQLite, model definition with JSON schema, and Fastify server startup.

import { Kohana, Model } from 'kohanajs-start'; // Initialize app const app = new Kohana({ database: { client: 'sqlite3', connection: { filename: ':memory:' } } }); // Define a model class export class User extends Model { static get tableName() { return 'users'; } static get jsonSchema() { return { type: 'object', required: ['name', 'email'], properties: { name: { type: 'string', minLength: 1, maxLength: 255 }, email: { type: 'string', format: 'email' } } }; } } app.listen({ port: 8000 });
Debug
Known issues
breakingRemoved CommonJS require() support in v10+
fix
Use ESM import syntax (import { ... } from 'kohanajs-start') or stay on v9.x.
affects: >=10.0.0
breakingDatabase configuration changed from 'sqlite' to 'sqlite3' in v11
fix
Change client to 'sqlite3' in your config.
affects: >=11.0.0
deprecatedKohana.query() method deprecated since v10.2
fix
Use model static methods like Model.query() instead.
affects: >=10.2.0
deprecatedThe built-in authentication middleware has been deprecated
fix
Use a dedicated auth package like '@fastify/auth'.
affects: >=11.5.0
gotchaModel properties are case-sensitive; 'tableName' vs 'tablename' will not work
fix
Always define tableName as a static getter returns exactly the camelCase name.
affects: >=0.0.0
gotchaDatabase migration files must be placed in 'migrations/' directory
fix
Create a 'migrations/' folder in your project root and place migration files there.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'kohanajs-start'
Package not installed or incorrect import path
fix
Run 'npm install kohanajs-start' and use correct import syntax.
Cannot require CommonJS modules when project is ESM
Package dropped CJS support in v10
fix
Set type: 'module' in package.json and use import syntax.
TypeError: Kohana is not a constructor
Using default import without correct named import
fix
Use import { Kohana } from 'kohanajs-start'.
Unknown database client 'sqlite'
Client name changed in v11
fix
Set client to 'sqlite3' in your database config.
Model 'User' doesn't have static method 'query'
Older version of ORM core installed
fix
Update kohanajs-orm to >=11.0.0.
Upgrade
Version history
11.11.6latest on npm
Audit
Dependencies
fastifyrequiredDefault web server framework
better-sqlite3optionalDefault database driver for SQLite
kohanajs-ormrequiredORM core dependency for model operations
Agent activity
5 hits · last 30 days
node
4
Resources
kohanajs-start — npm install kohanajs-start · libregistry