npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gradii/fedaco

v3.0.0

Published

[![Build Status](https://github.com/gradii/fedaco/workflows/CI/badge.svg)](https://github.com/gradii/fedaco/actions?query=workflow%3ACI)

Readme

Fedaco ORM

Build Status

Laravel Eloquent-style ORM for TypeScript. Decorator-based models, fluent query builder, eager-loaded relationships, transactions, schema builder.

📚 Full documentation · 🧪 Examples

Install

Install fedaco core plus one driver package per database you want to talk to:

# SQLite (good default for local dev / tests)
npm install @gradii/fedaco @gradii/fedaco-sqlite-driver

| Database | Driver package | | ----------------- | ----------------------------------- | | SQLite | @gradii/fedaco-sqlite-driver | | MySQL / MariaDB | @gradii/fedaco-mysql-driver | | PostgreSQL | @gradii/fedaco-postgres-driver | | SQL Server | @gradii/fedaco-sqlserver-driver |

Enable experimentalDecorators and emitDecoratorMetadata in tsconfig.json.

Quick Start

1. Set up a connection

import { DatabaseConfig } from '@gradii/fedaco';
import { sqliteDriver } from '@gradii/fedaco-sqlite-driver';

const db = new DatabaseConfig();

db.addConnection({
  driver: 'sqlite',
  factory: sqliteDriver(),
  database: ':memory:',
});

db.bootFedaco();
db.setAsGlobal();

The factory field is required — fedaco no longer ships drivers in core, so the driver package supplies its own factory.

2. Create a table

import { schema } from '@gradii/fedaco';

await schema().create('users', (table) => {
  table.increments('id');
  table.string('email').withUnique();
  table.string('name').nullable();
  table.integer('age').nullable();
  table.timestamps();
});

3. Define a model

import {
  Column,
  CreatedAtColumn,
  Model,
  PrimaryGeneratedColumn,
  Table,
  UpdatedAtColumn,
} from '@gradii/fedaco';

@Table({ tableName: 'users' })
export class User extends Model {
  _fillable = ['email', 'name', 'age'];

  @PrimaryGeneratedColumn()
  declare id: number;

  @Column()
  declare email: string;

  @Column()
  declare name: string;

  @Column()
  declare age: number;

  @CreatedAtColumn()
  declare created_at: Date;

  @UpdatedAtColumn()
  declare updated_at: Date;
}

4. CRUD

// create
const user = await User.createQuery().create({
  email: '[email protected]',
  name: 'Ada Lovelace',
  age: 36,
});

// read
const list = await User.createQuery().where('age', '>', 18).get();
const ada = await User.createQuery().where('email', '[email protected]').first();

// update
await ada.Update({ age: 37 });

// delete
await ada.Delete();

5. Transactions

import { db } from '@gradii/fedaco';

await db().transaction(async (tx) => {
  const user = await User.createQuery(tx).create({
    email: '[email protected]',
    name: 'Bob',
    age: 25,
  });
  // every model query inside this callback uses `tx`
});

For long-running or concurrent transactions, opt into isolated: true with a connection pool — see the Connection Pooling guide.

Features

  • Decorator-based model definition (@Table, @Column, @PrimaryGeneratedColumn, @CreatedAtColumn, …)
  • Fluent query builder compiled to SQL
  • All eager-load patterns: HasOne, HasMany, BelongsTo, BelongsToMany, HasOneThrough, HasManyThrough, HasOneOfMany, polymorphic
  • Per-relation onQuery hook for baked-in constraints, custom pivots, "one of many" disambiguation
  • Soft deletes, mass-assignment guards, accessors, casts
  • Multi-connection, read/write split, connection pooling, isolated transactions
  • Schema builder with migration CLI
  • Drivers: SQLite (sqlite3 / better-sqlite3), MySQL, MariaDB, PostgreSQL, SQL Server
  • NestJS module: @gradii/nest-fedaco

TypeScript Note

When target is es2022 or higher, TypeScript emits modern class-field semantics — every declared field is initialised to undefined in the constructor, which clobbers values fedaco populates via decorators.

Workaround — mark every column declaration with declare so TypeScript skips the runtime field initialisation:

@Table({ tableName: 'users' })
class User extends Model {
  @PrimaryGeneratedColumn()
  declare id: number;   // <-- `declare`, not a plain field

  @Column()
  declare email: string;
}

Documentation

License

MIT