
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
nukak-express
Advanced tools
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
Learn more about nukak
at its website https://nukak.org
nukak
is a powerful and efficient ORM, featuring serializable JSON
syntax and intelligent type-inference. It enables you to write queries in the frontend (browser/mobile), or any other client, which can then be safely sent to the server. Additionally, you can use nukak
solely in the server, or even in a mobile application with an embedded database (such as SQLite
).
JSON
syntax for all the queries.TypeScript
to get smart type-safety everywhere.$project
, $filter
, $sort
, $limit
works at multiple levels (including deep relations and their fields).transactions
.connection pooling
.MySQL
, MariaDB
, SQLite
, Postgres
, MongoDB
.
Install the core package:
npm install nukak --save
Install one of the specific adapters for your database:
Database | Driver | Nukak Adapter |
---|---|---|
MySQL | mysql2 | nukak-mysql |
MariaDB | mariadb | nukak-maria |
SQLite | sqlite sqlite3 | nukak-sqlite |
PostgreSQL | pg | nukak-postgres |
MongoDB | mongodb | nukak-mongo |
For example, for Postgres
:
npm install pg nukak-postgres --save
Additionally, your tsconfig.json
may need the following flags:
"target": "es2020",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
A default querier-pool can be set in any of the bootstrap files of your app (e.g. in the server.ts
).
import { setQuerierPool } from 'nukak';
import { PgQuerierPool } from 'nukak-postgres';
export const querierPool = new PgQuerierPool(
{
host: 'localhost',
user: 'theUser',
password: 'thePassword',
database: 'theDatabase',
},
// optionally, a logger can be passed to log the generated SQL queries
{ logger: console.log }
);
// the default querier pool that `nukak` will use
setQuerierPool(querierPool);
Take any dump class (aka DTO) and annotate it with the decorators from nukak/entity
.
import { v4 as uuidv4 } from 'uuid';
import { Id, Field, Entity } from 'nukak/entity/index.js';
@Entity()
export class User {
@Id({ onInsert: uuidv4 })
id?: string;
@Field()
name?: string;
@Field()
email?: string;
@Field()
password?: string;
}
import { getQuerier } from 'nukak';
import { User } from './shared/models/index.js';
async function findLastUsers(limit = 10) {
const querier = await getQuerier();
const users = await querier.findMany(User, {
$project: ['id', 'name', 'email'],
$sort: { createdAt: -1 },
$limit: limit,
});
await querier.release();
return users;
}
async function createUser(body: User) {
const querier = await getQuerier();
const id = await querier.insertOne(User, body);
await querier.release();
return id;
}
Learn more about nukak
at its website https://nukak.org
FAQs
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
The npm package nukak-express receives a total of 18 weekly downloads. As such, nukak-express popularity was classified as not popular.
We found that nukak-express demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.