-
Notifications
You must be signed in to change notification settings - Fork 10
Home
A middle tier micro-framework for javascript
You can see all changes introduced with peasy-js 2.0 here.
A middle tier framework is code that facilitates creating business logic in a reusable, extensible, maintainable, and testable manner. It promotes creating business logic that is completely decoupled from its consuming technologies and helps to ensure that separation of concerns (SoC) are adhered to.
- Business and validation rules engine
- Asynchronous support via promises or callbacks
- ES5 and later support
- TypeScript support
- Multiple client support
- Multiple deployment scenario support
- Reusability (decouples business and validation logic from consuming code and frameworks)
- Scalability
- Testability
Because the javascript ecosystem changes at a pace much more rapid than your business logic. UI frameworks change: Backbone one day, Angular the next day, React the following... Backend frameworks change: Express one day, Koa the next day, Hapi the next... Data frameworks and ORMS change...
Why couple your code with technologies that are hot today and gone tomorrow? Why not focus on your business logic and abstract out everything else into truly reusable code that can be consumed by javascript in the browser, backend, or both, and by any UI or backend framework?
peasy-js makes it trivial to whimsically swap out UI, backend, and data frameworks in your applications by creating your business logic in a composable, reusable, scalable, and testable manner.
The data proxy is responsible for data storage and retrieval, and serves as an abstraction layer for data stores (database, web services, cache, etc.).
A rule can be created to represent a business rule (authorization, price validity, etc.) or a validation rule (field length, required, etc.). Rules are consumed by commands and can be chained, configured to execute based on a previous rule’s execution, etc. Rules can also be configured to invoke code based on the result of their execution.
The command is responsible for orchestrating the execution of initialization logic, business and validation rule execution, and other logic (data proxy invocations, workflow logic, etc.), respectively, via the command execution pipeline.
A business service implementation represents an entity (e.g. users, or projects) and is responsible for exposing business functionality via commands. These commands encapsulate CRUD and other business related logic.
- Download the latest release
- Clone the repo:
git clone https://github.com/peasy/peasy-js.git
- Install with npm:
npm install peasy-js
- Install with yarn:
yarn add peasy-js
You can also download and add the peasy.js file to your project and reference it accordingly.
You can get started by reviewing the walk throughs below.
- Run it in a client (browser)
- Run it on a server (Node.js)
- Run it with TypeScript (Node.js)
An additional sample can be viewed using promises or using callbacks that showcases creating a business service, custom command, business rules, and wiring them up. The sample also showcases how to consume the service. To see it in action, run one or both from a command line:
node src/sampleWithPromises.js
node src/sampleWithCallbacks.js
All contributions are welcome, from general framework improvements to sample client consumers, proxy implementations, and documentation updates. Want to get involved? Please hit us up with your ideas. Alternatively, you can make a pull request and we'll get to it ASAP.
Please consider showing your support by starring the project.