Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clark-orm

Package Overview
Dependencies
Maintainers
0
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clark-orm

ClarkORM

  • 4.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
increased by40%
Maintainers
0
Weekly downloads
 
Created
Source

npm version

ClarkORM

If you like this project, please give us a star on Github.

ClarkORM is a Typescript ORM built on top of Lucid ORM (AdonisJS).

Why

AdonisJS is a great framework and it has one of the best ORM. But it works only in its ecosystem. Using ClarkORM you can have all the benefits of Lucid, but in any Node.js project you want.

How it works

ClarkORM is built on top of Lucid ORM and Lucid ORM is built on top of knex. The idea of ClarkORM is let you manage your migrations and seeds with knex the way you already do. But when it comes to Models ClarkORM comes on scene.

Installation

npm install clark-orm @adonisjs/lucid luxon

Usage

Here you can configure your connection like Adonis Lucid

// database.ts
import { defineConfig } from "clark-orm";

export const { BaseModel, Event, Database } = defineConfig({
  connection: "sqlite",
  connections: {
    sqlite: {
      client: "sqlite",
      debug: false,
      useNullAsDefault: true,
      connection: {
        filename: "./db.sqlite",
      },
    },
  },
})
// models/city.ts
import { DateTime } from "luxon";
import { column } from "@adonisjs/lucid/orm";
import { BaseModel } from "../database";

export class CityModel extends BaseModel {
  public static table = "cities";

  @column({ isPrimary: true })
  public id: number;

  @column()
  public name: string;

  @column.dateTime({ autoCreate: true })
  public createdAt: DateTime;

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  public updatedAt: DateTime;
}

You can learn more about the models here.

Extra

To use ClarkORM you need to know at least a little about knex and Lucid

Do you like to learn with examples? We have one here

Remember to add it to your tsconfig.json

"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false

Keywords

FAQs

Package last updated on 03 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc