All Projects → postlight → Lux

postlight / Lux

Licence: mit
Build scalable, Node.js-powered REST JSON APIs with almost no code.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Lux

mojo.js
🦄 The Mojolicious real-time web framework for Node.js
Stars: ✭ 145 (-73.92%)
Mutual labels:  mvc, backend
Cppwebframework
​The C++ Web Framework (CWF) is a MVC web framework, Open Source, under MIT License, using C++ with Qt to be used in the development of web applications.
Stars: ✭ 348 (-37.41%)
Mutual labels:  framework, mvc
cart
Simple Symfony 4 shopping cart application. App boilerplate
Stars: ✭ 18 (-96.76%)
Mutual labels:  mvc, backend
Quiz App
A repository reflecting the progress made on the "How to Build iOS Apps with Swift, TDD & Clean Architecture" YouTube series, by Caio & Mike.
Stars: ✭ 230 (-58.63%)
Mutual labels:  framework, mvc
Para
Open source back-end server for web, mobile and IoT. The backend for busy developers. (self-hosted or hosted)
Stars: ✭ 389 (-30.04%)
Mutual labels:  json-api, backend
Leaf
🍁 The easiest way to create clean, simple but powerful web apps and APIs quickly
Stars: ✭ 248 (-55.4%)
Mutual labels:  framework, mvc
Jsblocks
Better MV-ish Framework
Stars: ✭ 2,795 (+402.7%)
Mutual labels:  framework, mvc
Woowahanjs
웹 어플리케이션 개발을 위한 JS프레임워크
Stars: ✭ 171 (-69.24%)
Mutual labels:  framework, mvc
Saturn
Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
Stars: ✭ 540 (-2.88%)
Mutual labels:  mvc, backend
Raxx
Interface for HTTP webservers, frameworks and clients
Stars: ✭ 378 (-32.01%)
Mutual labels:  framework, backend
Elefant
Elefant, the refreshingly simple PHP CMS and web framework.
Stars: ✭ 188 (-66.19%)
Mutual labels:  framework, mvc
Jsonapidotnetcore
JSON:API Framework for ASP.NET Core
Stars: ✭ 465 (-16.37%)
Mutual labels:  json-api, mvc
Lumber
Install Forest Admin in minutes.
Stars: ✭ 2,077 (+273.56%)
Mutual labels:  framework, backend
Jsonapiframework
JsonApiFramework is a fast, extensible, and portable .NET framework for the reading and writing of JSON API documents. Currently working on ApiFramework 1.0 which is a new framework that supports the many enhancements documented in the 2.0 milestone of this project while being media type agnostic but will support media types like {json:api} and GraphQL for serialization/deserialization purposes.
Stars: ✭ 85 (-84.71%)
Mutual labels:  json-api, framework
Sifrr
⚡️ Set of tiny, independent libraries for creating modern and fast webapps with javascript/typescript
Stars: ✭ 174 (-68.71%)
Mutual labels:  framework, backend
Zen
zen is a elegant and lightweight web framework for Go
Stars: ✭ 257 (-53.78%)
Mutual labels:  framework, mvc
Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (+279.86%)
Mutual labels:  framework, mvc
Goldeneye
The CQRS flavoured framework that will speed up your WebAPI and Microservices development
Stars: ✭ 171 (-69.24%)
Mutual labels:  framework, backend
Wpemerge
A modern, MVC-powered WordPress as a CMS workflow. 🚀
Stars: ✭ 348 (-37.41%)
Mutual labels:  framework, mvc
Iris
The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |
Stars: ✭ 21,587 (+3782.55%)
Mutual labels:  framework, mvc

Lux

CircleCI branch AppVeyor Codecov branch David npm Gitter

Lux by Postlight is an MVC-style framework for building highly performant, large scale JSON APIs that anybody who knows the JavaScript language and its modern features will understand,inspired by Rails, Ember, and React. Read about it in this handy introduction.

Disclaimer:

This isn't another wrapper around Express or a framework for building frameworks. This also isn't a replacement for server-side frameworks that render DHTML.

What?

Features

  • Automatic CRUD actions in controllers
  • Automatic pagination, sorting, filtering via query params in controllers
  • CLI for eliminating boiler plate
  • JSON API 1.0 compliant out of the box
  • Optimized database queries based on serialized attributes and associations
  • Highly extensible - just write reusable JavaScript functions
  • Pairs nicely with client-side JavaScript applications 🍷
  • Easy to contribute
  • Routes are stored and accessed via a Map not an Array
  • Embraces ES2015 and beyond
    • Classes
    • Modules
    • Promises & async/await
    • Arrow Functions
    • etc.

Philosophies

Minimal API surface area

Lux uses JavaScript's standard library rather than creating a ton of functions you'll have to learn and remember.

After your learn how to use it, you'll rarely need to look at the docs.

Pure functions are awesome

Or more appropriately somewhat pure functions are awesome.

Serving content is done by returning objects, arrays, or other primitives rather than calling res.end(/* content */); and returning nothing.

Convention over configuration

Rails and Ember are great because they make hard decisions for you and make it possible to submit a PR on your first day at a new company. This is rare with Node server frameworks.

Why?

Frameworks like Rails are pretty great. You can build amazing applications in a reasonable amount of time without a ton of developers working on a project. They have their limitations though. They can be slow and sometimes hard to scale. Not to mention WebSocket support being so-so.

Node to the rescue.

It's fast, it allows the developer to get low level with a relatively simple API, WebSockets are stable and supported out of the box, and last but not least it's just JavaScript.

Not so fast (metaphorically speaking).

The last bit there "It's just JavaScript" has actually been somewhat of a double-edged sword. This has positioned Node as a "great prototyping tool" or "only used for micro services."

I can somewhat see why people would think that when returning a list of the first 10 records from a SQL database table looks like this:

app.get('/posts', (req, res) => {
  Post.findAll()
    .then(posts => {
      res.status(200).json(posts);
    }, err => {
      console.error(err);
      res.status(500).send(err.message);
    });
});

Could you imagine how ugly that gets when you have to implement pagination, filtering, sorting, or—better yet—formatting the response for JSON API?

Also, where does that code live? In what file and folder would I find it? What pattern do you use for organizing this code?

😲 Ok ok give me back Rails I'll worry about performance and scaling later. After all, premature optimization is the root of all evil.

Problem.resolve();

Shouldn't there be a better way to do this? Can't I just return a promise or a JavaScript primitive instead of basically using the native Node http server API?

Fortunately ES2015+ has introduced great new features to the JavaScript language, especially when it comes to meta programming.

With Lux your code from before can now look like this:

class PostsController extends Controller {
  index(req, res) {
    return Post.all();
  }
}

Except CRUD actions are taken care of automatically so it would actually look like this:

class PostsController extends Controller {

}

It's about time a Node server framework learned something from client-side JS frameworks.

How?

Installation

npm install -g lux-framework

Creating Your First Project

Use the new command to create your first project.

lux new <app-name>

Running

To run your application use the serve command.

cd <app-name>
lux serve

For more information checkout out the Guides.

Benchmarks

postlight/lux-benchmarks

Contribution

See CONTRIBUTING.md.

Useful Links


🔬 A Labs project from your friends at Postlight. Happy coding!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].