Sails.js Node.js framework: realtime MVC
Sails.js earns its place when a Node.js app needs realtime — chat, live dashboards, push updates — married to a normal REST API, not bolted on with a separate library. It runs on Express and Socket.io, so the request/response side feels familiar while WebSocket wiring comes free. The catch is Waterline, its bundled ORM: you write queries in its own dialect, not raw SQL. Skip it for a plain API with no realtime need — that overhead buys nothing.
What is Sails.js?
Sails.js is a web framework for Node.js that structures apps around MVC, borrowing the shape of Ruby on Rails but built for the JSON-and-API style of modern web development. It sits on top of Express for HTTP and Socket.io for WebSockets, so the same action can respond to a request or a socket event. Since version 1.0 it supports `await` natively, so a controller can write `var orgs = await Organization.find()` instead of nesting callbacks.
Core features of Sails.js
- ✓MVC structure modeled on Rails but adapted for JSON APIs instead of server-rendered views
- ✓Native `await` support since v1.0 — controllers can call `await Organization.find()` instead of nesting callbacks
- ✓Built on Express, so existing Connect-middleware code often pastes straight into a Sails action
- ✓Socket.io integration lets the same action handle an HTTP request or a WebSocket event
- ✓Waterline ORM with an adapter system — officially supported databases are MySQL, PostgreSQL, MongoDB, Redis, and local disk/memory
- ✓Community adapters extend Waterline to databases like CouchDB, SQLite, Oracle, MSSQL, and DynamoDB, plus a generic REST API adapter
- ✓`sails new` and `sails lift` scaffold and run a project from the CLI
Getting started with Sails.js
Install the CLI globally with `npm install sails -g` once Node.js is set up. From there, `sails new my-app` scaffolds a new project, and `cd my-app && sails lift` starts the development server. The README doesn't state a specific Node.js version requirement, so check the current docs on sailsjs.com if you're on an older Node release.
What Sails.js is built for
- •Node.js apps that need a chat feature or live dashboard alongside a normal REST API
- •Teams porting an existing Express app that want WebSocket support without a rewrite
- •Projects that want Rails-style MVC conventions but need to speak JSON, not render server-side views
- •Apps that might change database backends later, since Waterline's adapter system abstracts the query layer
Strengths
- ✓WebSocket support is integrated, not bolted on — the same action handles HTTP and socket events
- ✓Actions are compatible with Connect middleware, so existing Express code often pastes in and works
- ✓Native `await` support since v1.0 removes a layer of callback nesting from data access
- ✓Waterline's adapter system means the same model code can target MySQL, PostgreSQL, MongoDB, Redis, or local disk/memory without rewriting queries
Known limitations of Sails.js
- △Waterline is a custom ORM, not a wrapper around a well-known one like Prisma or TypeORM, so you're learning its own query syntax and its abstraction over raw SQL
- △The README doesn't state a specific Node.js version requirement or changelog, so compatibility with the newest Node releases isn't clearly documented here
- △MVC-with-realtime is a specific shape; a project that only needs a plain REST API carries Socket.io and Waterline overhead it won't use
- △Community database adapters (SQLite, Oracle, MSSQL, DynamoDB, and others) are separate packages outside the officially supported list, so their maintenance status isn't documented here
Sails.js alternatives
Frequently asked questions
Sails.js's own documentation describes the project as actively maintained, with a core team of three — Mike McNeil, Kelvin Omereshone, and Eric Shaw — plus outside contributors handling issues and pull requests. The repository facts here don't include a specific latest release date, so check the GitHub releases page for the current cadence.
Through its Waterline ORM, Sails.js officially supports MySQL, PostgreSQL, MongoDB, Redis, and local disk or in-memory storage for development. Community-maintained adapters extend that to databases like CouchDB, SQLite, Oracle, MSSQL, and DynamoDB, plus a generic REST API adapter for third-party services, though the official list is the more reliably maintained set.
Sails.js actions are compatible with Connect middleware, which is what Express is built on, so code from an existing Express project can often be pasted directly into a Sails action and work unchanged. The README notes this also adds WebSocket access to that same endpoint, something a plain Express route doesn't get automatically.
Sails.js is released under the MIT License, copyright Mike McNeil, which permits free use, modification, and distribution in commercial projects. The README also mentions professional and enterprise support options exist separately from the open-source framework itself.
Sails.js builds on Socket.io internally, and because its actions are compatible with Connect middleware, the same controller action that answers an HTTP request can also respond to a WebSocket event without separate code paths. That's the core of what the README calls its realtime layer — no bolted-on library or duplicate routing needed for chat or live-update features.
Both Sails.js and Adonis.js are Node.js frameworks with Rails-inspired MVC structure, but Sails.js is built directly on Express and Socket.io, with Waterline as its ORM, while Adonis.js runs its own request pipeline and ORM rather than sitting on top of Express. Sails.js leans on realtime-by-default, since sockets and HTTP share the same actions.
The problem it solves
Building a Node.js API that also needs live features — a chat panel, a real-time dashboard, presence indicators — usually means gluing together a REST framework and a separate WebSocket library by hand, and keeping their auth and routing logic in sync yourself. Sails folds both into one action: the same controller code can answer an HTTP request or a socket event, which is the specific integration problem it's built around, layered on top of Rails-style MVC conventions adapted for JSON-first apps rather than server-rendered ones.
How to use
A new project starts with `sails new my-app`, then `cd my-app` and `sails lift` to boot the server — "lift" is Sails' term for starting the app, a nod to its nautical naming. From there you write actions and controllers the way you'd write Express route handlers, except Waterline models replace direct database calls: `var orgs = await Organization.find()` reads naturally instead of chaining callbacks. Because Sails actions are compatible with Connect middleware, pasting in logic from an existing Express project usually works without changes, and you gain WebSocket access on that same endpoint for free. Beyond the first run, the README points to sailsjs.com's own getting-started guide rather than documenting deeper usage inline.
Who should try it — and who should skip
Reach for Sails.js if you're building a Node.js app that genuinely needs realtime features — chat, live updates, presence — next to a conventional REST API, and you don't mind learning Waterline's query dialect instead of raw SQL. Teams already comfortable with Express who want MVC structure without switching languages fit well too. Skip it if you just need a plain JSON API with no WebSocket requirement — Express or Koa alone is lighter — and skip it if you want an ORM with broader third-party tooling than Waterline offers.
Still deciding about sails?
One click hands the question to an AI along with this page — see what it says about sails.
