npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

peasy-js

v2.3.0

Published

A business logic micro-framework for javascript

Downloads

238

Readme

peasy-js

What's a business logic micro-framework?

A business logic framework is code that facilitates creating business logic in a consistent, predictable, reusable, extensible, maintainable, scalable, 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.

Why peasy-js?

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.

peasy-js offers/addresses the following:

Where can I get it?

  • 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.

Getting started

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)

  • Sample application: This sample application is an order entry / inventory management system written with peasy-js, react, angular (with TypeScript), mongoDB, nodejs, and express.

  • 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

The main actors

Business Service

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.

Command

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.

Rule

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.

Data Proxy

The data proxy is responsible for data storage and retrieval, and serves as an abstraction layer for data stores (database, web services, cache, etc.).

peasy-js actors at work

What's new in version 2.0?

You can see all changes introduced with peasy-js 2.0 here.

Contributing

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.

Like what you see?

Please consider showing your support by starring the project.