node package manager


What is Tiny-Models ?

  • Simple - Tiny Models it's a module that will help you save a lot of time in your process of creating models for your project
  • Automatic - Tiny-Models will read all the modules you have created in an specific folder in order to create the sequelize model associated.
    Important : The name of the models will be the name of the model file
  • Clear - The definition of the modules is really clear and this is the force of Tiny-Models. The models are finally just a Javascript object which makes the creation of models really simple and clear.


npm install tiny-models-sequelize

Sample model models/Users.js

This file will give you a taste of what Tiny-Models does. The name of the model, will be : Users

var Seq = require('sequelize');
//Creating our module 
module.exports = {
    model: {
        first_name: {type : Seq.STRING},
        last_name: {type : Seq.STRING},
        mail: {type : Seq.STRING},
        password: {type : Seq.STRING},
    options : {
        instanceMethods : {
            validPassword : function(password) {
                var ret = cypter.comparePassword(password, this.password)
                return ret;

Initialize Tiny-Models

Here you learn how to initialize the module. For that you have to give the path where your models are defined and the configuration of the database.

var tmS = require('tiny-models-sequelize');
    config_path : path.join(__dirname, 'config', 'database.json'),
    models_path : path.join(__dirname, 'models')

Sample database.json

You can call this file as you like

    "development": {
        "database": "YourBDD",
        "dialect": "mysql",
        "host": "",
        "username": "root",
        "password": ""

Use a model

When you have defined your model, you will be able to use it really easily, and of course have access to all the sequelize methods.
See Sequelize doc

var tmS = require('tiny-models-sequelize');
function findUsers() {
    var Users = tmS.getModel('Users');
    .then(function (data) {
    .catch(function (err) {

If you have any questions or feedbacks, feel free to contact me at :
This module was developed for
This module is inspired by a Jeysson Guevara article