Skip to content
On this page

Getting started

Sutando is an object-relational mapper (ORM) that makes it enjoyable to interact with your database. When using Sutando, each database table has a corresponding "Model" that is used to interact with that table. In addition to retrieving records from the database table, Sutando models allow you to insert, update, and delete records from the table as well.

Sutando is highly inspired by Eloquent as the behaviour is pretty much the same.

Quick Started

Install Sutando and mysql database library

npm install sutando mysql2 --save

The easiest way to make SQL queries is to use the Database query builder. It allows you to construct simple and complex SQL queries using JavaScript methods.

In the following example, we select all the posts from the users table.

const { sutando, Model } = require('sutando');

// Add SQL Connection Info
  client: 'mysql2',
  connection: {
    host : '',
    port : 3306,
    user : 'root',
    password : '',
    database : 'test'

const db = sutando.connection();

// Using The Query Builder
const users = await db.table('users').where('votes', '>', 100).get();

// Using The Schema Builder
await sutando.schema().createTable('users', table => {

// Using The ORM
class User extends Model {}
const users = await User.query().where('votes', '>', 100).get();

Released under the MIT License. (dev)