apprun
TypeScript icon, indicating that this package has built-in type declarations

3.33.9 • Public • Published

AppRun Build NPM version Downloads License twitter Discord Chat

Introduction

AppRun is a lightweight alternative to other frameworks and libraries. It has a unique architecture inspired by the Elm architecture that can help you manage states, routing, and other essential aspects of your web application.

Use a Counter as an example.

// define the initial state
const state = 0;

// view is a function to display the state (JSX)
const view = state => <div>
  <h1>{state}</h1>
  <button onclick="app.run('-1')">-1</button>
  <button onclick="app.run('+1')">+1</button>
</div>;

// update is a collection of event handlers
const update = {
  '+1': state => state + 1,
  '-1': state => state - 1
};

// start the app
app.start(document.body, state, view, update);

  • AppRun is lightweight, only 6KB gzipped, but includes state management, rendering, event handling, and routing.

  • With only three functions: app.start, app.run, and app.on in its API makes it easy to learn and use. And no worries about the incompatibility of version upgrades.

  • One more thing, you can use AppRun with React to simplify state management and routing of your React applications.

At its core, AppRun harnesses the power of the event PubsSub pattern to streamline your application’s state handling and routing. The result? Cleaner, more maintainable code and a smoother development experience.

AppRun Benefits

  • Clean architecture that needs less code
  • State management and routing included
  • No proprietary syntax to learn (no hooks, no reducers, no signals)
  • Use directly in the browser or with a compiler/bundler
  • Advanced features: JSX, Web Components, Dev Tools, SSR, etc.

Getting Started

AppRun is distributed on npm. To get it, run:

npm install apprun

You can also load AppRun directly from the unpkg.com CDN:

<html>
<body>
<script src="https://unpkg.com/apprun/dist/apprun-html.js"></script>
<script>
  const view = state => `<div>${state}</div>`;
  app.start(document.body, 'hello AppRun', view);
</script>
</body>
</html>

Or, use the ESM version:

<html>
<body>
<script type="module">
  import { app, html } from 'https://unpkg.com/apprun/dist/apprun-html.esm.js';
  const view = state => html`<div>${state}</div>`;
  app.start(document.body, 'hello ESM', view);
</script>
</body>
</html>

In addition to run directly in the browser, or with a compiler/bundler like Webpack or Vite.

You can run the npm create apprun-app command to create an AppRun project.

npm create apprun-app [my-app]

Learn More

You can get started with AppRun Docs and the AppRun Playground.

AppRun Book from Apress

Order from Amazon

Contribute

You can launch the webpack dev-server and the demo app from the demo folder with the following npm commands:

npm install
npm start

You can run the unit tests from the tests folder.

npm test

Unit tests can serve as functional specifications.

Finally, to build optimized js files to the dist folder, just run:

npm run build

Have fun and send pull requests.

Contributors

Support

AppRun is an MIT-licensed open-source project. Please consider supporting the project on Patreon. 👍❤️🙏

Thank you for your support

  • Athkahden Asura
  • Alfred Nerstu
  • Gyuri Lajos
  • Lorenz Glißmann
  • Kevin Shi
  • Chancy Kennedy

License

MIT

Copyright (c) 2015-2024 Yiyi Sun

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.33.9133latest
3.28.85es6
3.28.85next
1.26.21es5

Version History

VersionDownloads (Last 7 Days)Published
3.33.9133
3.33.81
3.33.72
3.33.60
3.33.50
3.33.40
3.33.30
3.33.20
3.33.10
3.33.00
3.32.05
3.31.00
3.30.212
3.30.10
3.30.00
3.29.00
3.28.150
3.28.140
3.28.130
3.28.120
3.28.110
3.28.100
3.28.90
3.28.85
3.28.735
3.28.60
3.28.50
3.28.30
2.28.33
2.28.20
2.28.10
2.28.00
2.27.70
2.27.627
2.27.51
2.27.30
3.27.20
2.27.20
2.27.10
2.27.00
2.26.30
1.26.21
3.26.20
2.26.20
2.26.10
2.26.01
3.25.10
2.25.10
1.25.10
1.25.00
2.25.00
1.24.00
2.24.012
2.23.170
2.23.160
2.23.151
1.23.131
2.23.130
2.23.120
2.23.110
2.23.100
2.23.90
2.23.80
2.23.714
2.23.60
2.23.50
2.23.41
2.23.30
3.23.20
2.23.20
3.23.10
1.23.10
2.23.10
2.23.00
3.22.20
3.3.00
1.22.20
2.22.20
1.22.11
2.22.10
2.22.00
1.22.00
1.21.100
2.21.100
2.21.91
1.21.91
1.21.80
2.21.86
2.21.70
1.21.70
1.21.60
2.21.60
1.21.50
2.21.50
2.21.40
1.21.41
2.21.36
2.21.20
1.21.21
1.21.10
2.21.10
1.21.00
2.21.01
1.20.63
2.20.60
2.20.50
2.20.40
2.20.30
2.20.20
2.20.10
1.20.00
2.20.00
2.19.20
1.19.20
1.19.10
2.19.10
1.18.30
2.18.30
1.18.20
2.18.20
1.18.10
2.18.10
2.18.00
1.18.01
2.17.10
1.17.00
2.17.00
2.16.20
1.16.21
1.16.10
2.16.00
1.16.00
1.15.20
1.15.10
1.15.00
2.2.00
3.2.00
3.1.00
1.14.30
1.14.20
1.14.10
1.14.01
2.1.00
3.0.00
2.0.100
1.13.100
1.13.90
2.0.90
2.0.82
1.13.80
1.13.70
2.0.71
1.13.60
2.0.60
1.13.50
2.0.50
1.13.40
2.0.40
1.13.30
2.0.30
2.0.20
1.13.20
2.0.10
1.13.10
1.13.00
1.12.50
1.12.40
1.12.30
2.0.00
1.12.20
1.12.10
1.12.00
1.11.00
1.10.20
1.10.10
1.10.00
1.9.40
1.9.30
1.9.20
1.9.10
1.9.00
1.8.30
1.8.20
1.8.10
1.7.90
1.7.80
1.7.70
1.7.60
1.7.50
1.7.40
1.7.30
1.7.20
1.7.10
1.7.00
1.6.30
1.6.20
1.6.10
1.6.00
1.5.50
1.5.40
1.5.30
1.5.20
1.5.10
1.5.00
1.4.20
1.4.10
1.4.00
1.3.40
1.3.31
1.3.20
1.3.10
1.3.00
1.2.10
1.2.00
1.1.10
1.1.00
1.0.00
0.12.50
0.12.40
0.12.30
0.12.20
0.12.10
0.12.00
0.11.00
0.10.00
0.9.10
0.9.01
0.8.00
0.7.10
0.7.00
0.6.30
0.6.20
0.6.10
0.5.20
0.5.10
0.5.00
0.4.00
0.3.10
0.3.00
0.2.00
0.1.00

Package Sidebar

Install

npm i apprun

Weekly Downloads

247

Version

3.33.9

License

MIT

Unpacked Size

1.35 MB

Total Files

106

Last publish

Collaborators

  • yysun