Active Record Model


2170.10.0a year ago3 years agoMinified + gzip package size for @foxify/odin in KB



Odin is an implementation of Active Record pattern in TypeScript.

NPM Version Node Version TypeScript Version Tested With Jest Pull Requests License Build Status Coverage Status Package Quality Dependencies Status NPM Total Downloads NPM Monthly Downloads Open Issues Closed Issues known vulnerabilities Github Stars Github Forks

Table of Content


Before installing, download and install Node.js. Node.js 8 or higher is required.

npm i -s @foxify/odin


const Odin = require("@foxify/odin");

const { Types } = Odin;

class User extends Odin {

User.schema = {
  email: Types.String.email.required,
  name: {
    first: Types.String.min(3).required,
    last: Types.String.min(3),


  1. Written in ES6
  2. TypeScript ready
  3. Active Record pattern
  4. Schema validation
  5. GraphQL Schema generator (based on model schema)
  6. JSON Schema generator (based on model schema)

TODO (RoadMap to version 1.0.0)

  • Schema validation
  • Model
    • Hooks
      • create
      • update
      • delete
      • restore
    • Relationships
      • embedMany
      • hasMany
      • hasOne
      • hasManyThrough
      • hasOneThrough
      • Polymorphic
        • morphMany
        • morphOne
        • morphTo
        • morphManyThrough
        • morphOneThrough
        • morphToThrough
      • CRUD operations
        • Create operation
        • Read operation
        • Update operation
        • Delete operation
    • GraphQL support
    • JSON Schema support
  • Migrations
  • Seeding
  • Tests


We use SemVer for versioning. For the versions available, see the tags on this repository.


See the CHANGELOG.md file for details


See also the list of contributors who participated in this project.


This project is licensed under the MIT License - see the LICENSE file for details


If my work helps you, please consider

Buy Me A Coffee Become A Patron

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.