Git Product home page Git Product logo

sails's Introduction

Sails.js

NPM version   Gitter   Twitter Follow

Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps. It is designed to resemble the MVC architecture from frameworks like Ruby on Rails, but with support for the more modern, data-oriented style of web app & API development. It's especially good for building realtime features like chat.

Since version 1.0, Sails supports await out of the box. This replaces nested callbacks (and the commensurate error handling) with simple, familiar usage:

var orgs = await Organization.find();

Installation  

With node installed:

# Get the latest stable release of Sails
$ npm install sails -g
Upgrading from an earlier version of Sails?

Upgrade guides for all major releases since 2013 are available on the Sails website under Upgrading.

Your First Sails Project

Create a new app:

# Create the app
sails new my-app

Lift sails:

# cd into the new folder
cd my-app

# fire up the server
sails lift

Screenshot from the original Sails video

For the most up-to-date introduction to Sails, get started here.

Compatibility

Sails is built on Node.js, Express, and Socket.io.

Sails actions are compatible with Connect middleware, so in most cases, you can paste code into Sails from an existing Express project and everything will work-- plus you'll be able to use WebSockets to talk to your API, and vice versa.

The ORM, Waterline, has a well-defined adapter system for supporting all kinds of datastores. Officially supported databases include MySQL, PostgreSQL, MongoDB, Redis, and local disk / memory. Community adapters exist for CouchDB, neDB, SQLite, Oracle, MSSQL, DB2, ElasticSearch, Riak, neo4j, OrientDB, Amazon RDS, DynamoDB, Azure Tables, RethinkDB and Solr; for various 3rd-party REST APIs like Quickbooks, Yelp, and Twitter, including a configurable generic REST API adapter; plus some eclectic projects.

Powered by MySQL                                

For the latest core adapters and notable community adapters, see Available Adapters.

Tutorial Course

Books

Support

Need help or have a question?

Issue submission

Please read the submission guidelines and code of conduct before opening a new issue. Click here to search/post issues in this repository.

Contribute

There are many different ways you can contribute to Sails:

Please carefully read our contribution guide and check the build status for the relevant branch before submitting a pull request with code changes.

Links

Team

Sails is actively maintained with the help of many amazing contributors. Our core team consists of:

Mike McNeil Kelvin Omereshone Eric Shaw
Mike McNeil Kelvin Omereshone Eric Shaw

Our company designs/builds Node.js websites and apps for startups and enterprise customers. After building a few applications and taking them into production, we realized that the Node.js development landscape was very much still the Wild West. Over time, after trying lots of different methodologies, we decided to crystallize all of our best practices into this framework. Six years later, Sails is now one of the most widely-used web application frameworks in the world. I hope it saves you some time! :)

License

MIT License Copyright © 2012-present, Mike McNeil

Sails is built around so many great open-source technologies that it would never have crossed our minds to keep it proprietary. We owe huge gratitude and props to Ryan Dahl (@ry), TJ Holowaychuk (@tj), Doug Wilson (@dougwilson) and Guillermo Rauch (@rauchg) for the work they've done, as well as the stewards of all the other open-source modules we use. Sails could never have been developed without your tremendous contributions to the JavaScript community.

A squid peering inside a book, halation and cosmic Sails.js knowledge emanating from the pages of the substantial tome

sails's People

Contributors

colinwren avatar dangreen avatar danielfttorres avatar davidjconnolly avatar dcbartlett avatar dmarcelino avatar dominuskelvin avatar dzcpy avatar eashaw avatar elizabethforest avatar ghernandez345 avatar globegitter avatar internalfx avatar irlnathan avatar konstantinzolotarev avatar listepo avatar luislobo avatar mikermcneil avatar particlebanana avatar rachaelshaw avatar raqem avatar rwoverdijk avatar sgress454 avatar sleewoo avatar tarlepp avatar techpines avatar tjwebb avatar vicapow avatar xdissent avatar zolmeister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sails's Issues

Provision Mocha tests

Bootstrap HTTP and WS clients and provide easy access to them from /test modules.

Then, automatically generate integration test stubs for each controller/action.
In the future, these could be randomly generated if pre and postconditions are defined with Anchor.

Universalize API to controllers

Replace ExpressJS-specific req,res,next arguments with a Sails proprietary context to execute controller actions from.

Instead of:

exports.sample = function (req,res,next) {
req.render({
title: 'The page'
});
}

sample: function () {
this.view.title = 'the page'
}

Smarter room management for models

For instance. a job might run every few minutes which does the following:

  • If < 100 instances exist:
    • subscribe sockets to the static class room
    • migrate existing sockets to use the static class room if they're not already
  • otherwise,
    • subscribe sockets to paginated rooms which broadcast events for up to 100 instances
    • migrate existing sockets to use the appropriate paginated room

This could go further in multi-tiered environments to manage rooms based on # of connected sockets (but we should probably use an existing solution for that piece, like Guillermo's new solution )

Update command line tool

Update to automatically generate the new, correct authentication policy that sends a 403 if this is an ajax or socket request, and redirects to the login page otherwise

Remove bias towards Sequelize

JugglingDB should probably be the default, because of its in-memory database support (so you don't have to have mySQL installed just to get started)

As for notation, we should enforce an agnostic standard. My biggest beef with sequelize is the promise interface notation for success and error callbacks. This doesn't fit in well with the cb(error,result)-style notation used by our other dependencies (namely async) or our unit testing framework of choice (vows).

I also rather like using the standard Sails CRUD synonyms.

Proposed notation:

Model.create(attributes,callback) (or generate, or add, or new)
Model.find(options,callback) (or read, or view, or show, or detail, or findAll)
Model.update(id,newAttrs,callback) (or edit, or set, or modify, or update)
Model.destroy(id,callback) (or delete, or remove)

`````` Model.findAndUpdate(options,newAttrs,callback) Model.findAndDelete(options,callback)```
```Model.findOrCreate(options,attrsToMatchAgainst,callback)```

Build in static roles and dynamic roles

At build time, specify various role strings that can be attached to Accounts. These role strings will be converted into Role objects at runtime and attached to accounts via a join table.

Remove bias towards ejs templating

Because of the added websocket support, ejs is required as of now. However other users of the framework may very well like Jade or Haml.

Adapters (virtual models)

Allows for client-side manipulation of shared data source. Pull code that would normally go into controllers into a model which loosely corresponds w/ client-side.

Definitely can't be the only option (doesn't fit in to the philosophy of SOA) , but the idea is to simplify server-side code which is client-specific. The standard REST API can still exist.

i.e. FileSystemNode is a virtual model
FileSystemNode.create:
creates a Directory or File, assigns permissions based on the session, and (if passed a binary) uploads a file to OpenStack. Also cascades permission from parent File or Directory to children.

Add ACO support with built-in Policy model

In addition to assigning custom middleware to a particular controller and action at build time, the application should be able to modify permissions for specific Accounts to access specific instances of a model using a specific controller and action during runtime.

App-relative filesystem api

It would be nice to able to do things like:

...
upload: function (req,res) {
  _.each(req.files,function(file) {
    File.create({
      filename: file.filename,
      extension: file.extension,
      mime: file.mime
    }).success(function(fileModel) {
      file.save({
        path: '/public/files',
        name: file.id + "." + file.extension
      });
    });
  });
  res.json({success:true});
}
...

Instead of having to use __dirpath and then navigate back upwards to the appropriate place. Might also make sense to create the specified directory if it doesn't exist.

Automatic role dictionary

Automatically determine all statically defined roles from access control policy rules and populate the database accordingly

Automatically render, use best guess for view if not specified

If res.render, res.redirect, res.json, or some other response method has not already been called, automatically render the best guess view for a controller at the end of the method.

Instead of:

sample: function () {
this.res.render('pages/sample',{
title: 'the page'
});
}

sample: function () {
this.view.title = 'the page'
}

Support for Express 3.x

Starting this tonight on a separate branch, express3.

This will get us up to date with the latest Express has to offer, including the much better bodyParser.

Bundle SQLite installation

Allow for immediate, credential-less, setup-less development using the Sails platform by bundling an installation of SQLite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.