{"id":13518159,"url":"https://github.com/postlight/lux","last_synced_at":"2025-06-10T14:40:18.398Z","repository":{"id":54530202,"uuid":"52821833","full_name":"postlight/lux","owner":"postlight","description":"Build scalable, Node.js-powered REST JSON APIs with almost no code.","archived":false,"fork":false,"pushed_at":"2020-02-11T14:04:17.000Z","size":1789,"stargazers_count":568,"open_issues_count":48,"forks_count":59,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-06-04T05:18:45.747Z","etag":null,"topics":["backend","framework","javascript","json-api","labs","lux","mvc","nodejs"],"latest_commit_sha":null,"homepage":"https://lux.postlight.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postlight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-29T20:21:18.000Z","updated_at":"2025-05-31T11:31:50.000Z","dependencies_parsed_at":"2022-08-13T18:50:35.592Z","dependency_job_id":null,"html_url":"https://github.com/postlight/lux","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postlight%2Flux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postlight%2Flux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postlight%2Flux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postlight%2Flux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postlight","download_url":"https://codeload.github.com/postlight/lux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postlight%2Flux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259093957,"owners_count":22804262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","framework","javascript","json-api","labs","lux","mvc","nodejs"],"created_at":"2024-08-01T05:01:41.458Z","updated_at":"2025-06-10T14:40:18.374Z","avatar_url":"https://github.com/postlight.png","language":"JavaScript","readme":"# [![Lux](https://lux.postlight.com/src/components/Sidebar/logo.svg)](https://lux.postlight.com)\n\n[![CircleCI branch](https://img.shields.io/circleci/project/github/postlight/lux/master.svg?style=flat-square)](https://circleci.com/gh/postlight/lux/tree/master) [![AppVeyor](https://img.shields.io/appveyor/ci/zacharygolba/lux/master.svg?style=flat-square)](https://ci.appveyor.com/project/zacharygolba/lux/branch/master) [![Codecov branch](https://img.shields.io/codecov/c/github/postlight/lux/master.svg?style=flat-square)](https://codecov.io/gh/postlight/lux)\n [![David](https://img.shields.io/david/postlight/lux.svg?style=flat-square)](https://david-dm.org/postlight/lux) [![npm](https://img.shields.io/npm/v/lux-framework.svg?style=flat-square)](https://www.npmjs.com/package/lux-framework) [![Gitter](https://img.shields.io/gitter/room/postlight/lux.svg?style=flat-square)](https://gitter.im/postlight/lux)\n\nLux by [Postlight](https://postlight.com) 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](https://github.com/rails/rails/), [Ember](http://emberjs.com/), and [React](https://facebook.github.io/react/). Read about it in [this handy introduction](https://postlight.com/trackchanges/not-another-node-js-framework).\n\n**Disclaimer:**\n\nThis isn't another wrapper around [Express](http://expressjs.com/) or a framework for building frameworks. This also isn't a replacement for server-side frameworks that render DHTML.\n\n## What?\n\n### Features\n\n*   Automatic CRUD actions in controllers\n*   Automatic pagination, sorting, filtering via query params in controllers\n*   CLI for eliminating boiler plate\n*   [JSON API](http://jsonapi.org/) 1.0 compliant out of the box\n*   Optimized database queries based on serialized attributes and associations\n*   Highly extensible - just write reusable JavaScript functions\n*   Pairs nicely with client-side JavaScript applications 🍷\n*   Easy to contribute\n*   Routes are stored and accessed via a `Map` not an `Array`\n*   Embraces ES2015 and beyond\n    *   Classes\n    *   Modules\n    *   Promises \u0026 async/await\n    *   Arrow Functions\n    *   etc.\n\n\n### Philosophies\n\n##### Minimal API surface area\n\nLux uses JavaScript's standard library rather than creating a ton of functions you'll have to learn and remember.\n\nAfter your learn how to use it, you'll rarely need to look at the docs.\n\n##### Pure functions are awesome\n\nOr more appropriately somewhat pure functions are awesome.\n\nServing content is done by returning objects, arrays, or other primitives rather than calling `res.end(/* content */);` and returning nothing.\n\n##### Convention over configuration\n\n[Rails](http://rubyonrails.org/) and [Ember](http://emberjs.com/) 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.\n\n\n## Why?\n\nFrameworks 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.\n\n##### Node to the rescue.\n\nIt'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.\n\n##### Not so fast (metaphorically speaking).\n\nThe 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.\"\n\nI 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:\n\n```javascript\napp.get('/posts', (req, res) =\u003e {\n  Post.findAll()\n    .then(posts =\u003e {\n      res.status(200).json(posts);\n    }, err =\u003e {\n      console.error(err);\n      res.status(500).send(err.message);\n    });\n});\n```\n\nCould you imagine how ugly that gets when you have to implement pagination, filtering, sorting, or—better yet—formatting the response for JSON API?\n\nAlso, where does that code live? In what file and folder would I find it? What pattern do you use for organizing this code?\n\n😲 Ok ok give me back Rails I'll worry about performance and scaling later. After all, premature optimization is the root of all evil.\n\n##### Problem.resolve();\n\nShouldn'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?\n\nFortunately ES2015+ has introduced great new features to the JavaScript language, especially when it comes to meta programming.\n\nWith Lux your code from before can now look like this:\n\n```javascript\nclass PostsController extends Controller {\n  index(req, res) {\n    return Post.all();\n  }\n}\n```\n\nExcept CRUD actions are taken care of automatically so it would actually look like this:\n\n```javascript\nclass PostsController extends Controller {\n\n}\n```\n\nIt's about time a Node server framework learned something from client-side JS frameworks.\n\n\n## How?\n\n### Installation\n\n```bash\nnpm install -g lux-framework\n```\n\n### Creating Your First Project\n\nUse the `new` command to create your first project.\n\n```bash\nlux new \u003capp-name\u003e\n```\n\n### Running\n\nTo run your application use the `serve` command.\n\n```bash\ncd \u003capp-name\u003e\nlux serve\n```\n\nFor more information checkout out the [Guides](https://lux.postlight.com/).\n\n\n## Benchmarks\n\n[**postlight/lux-benchmarks**](https://github.com/postlight/lux-benchmarks)\n\n\n## Contribution\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Useful Links\n\n*   [JSON API](http://jsonapi.org/)\n*   [Knex.js](http://knexjs.org/)\n*   [Jest](https://facebook.github.io/jest/)\n\n---\n\n🔬 A Labs project from your friends at [Postlight](https://postlight.com). Happy coding!\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostlight%2Flux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostlight%2Flux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostlight%2Flux/lists"}