Skip to content

hayleigh-dot-dev/lustre-universal-component-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lustre universal component demo

In Lustre, applications are built around the MVU architecture with a model representing program state, a view function to render that state, and an update function to handle events and update that state.

These three building blocks are encapsulated by the App type. Lustre's secret weapon is that the same app can be run multiple ways without changing the core app code.

This project showcases how that works. The common/ directory contains a Lustre application for a simple counter example. All the Lustre application logic lives here, and is agnostic to the platform it runs on. This counter application has been exported as a custom element using Lustre's dev tools and saved in server/priv/counter.mjs.

The client/ directory takes that counter application and runs it as a typical client-side web application. The code in this directory is only responsible for the boilerplate necessary to run the app in the browser.

The server/ directory takes that same counter application and runs it as a server component. The code in this directory is only responsible for setting up the server and acting as a bridge between the server component's client runtime and the BEAM actor running the counter app.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published