Giter Site home page Giter Site logo

cloudnativeentrepreneur / sveltekit-eventsourced-funnel Goto Github PK

View Code? Open in Web Editor NEW
8.0 0.0 1.0 1022 KB

sveltekit eventsourced funnel - demonstates how to build sveltekit app with event sourcing via the sourced lib and svelte stores backed by local storage

JavaScript 64.79% HTML 1.22% CSS 0.49% Svelte 33.50%
event-sourcing svelte sveltekit funnel

sveltekit-eventsourced-funnel's Introduction

sveltekit-eventsourced-funnel

Node.js CI codecov

Example of building a SvelteKit project with event sourcing.

Demonstrates:

  1. POJOs for event sourced models
  2. Repository pattern for persistence via local storage

As with Redux, the logic is external to the components. You can easily hook into every event for analytics and more. See unit test of the "Funnel model" to see that the logic can be tested independently of the UI.

Includes Tailwind with JIT compiler for easy copy and pasting of UIs from Tails, TailwindUI, Shuffle, or etc.

Quick Walkthrough

This project is a marketing and sales funnel - a simple series of web pages where the user can make a choice to proceed deeper into the funnel or not. Each step in the funnel is simply a route, in the src/routes directory. In src/lib/steps.js we create a linked-list like array of step "Value Objects". Index is the starting page.

The whole application is a Funnel, and thus we have a Funnel model in src/lib/models/Funnel.js - this is where the bulk of the logic resides.

There will only be one instance of a Funnel per browser session. To get that instance, the file src/lib/funnel.js provides a load function that will create a new funnel instance and initialize it with steps, or, if an instance already exists, load the existing one.

Each page loads the funnel instance onMount, which is client side only. The user performs some sort of action, which is a method call on the funnel object, and then, using the funnelRepository, the change is persisted to local storage via commit.

Once commits are successful, enqueued events fire, and we can navigate the user to their next step.

Project bootstrapped with create-svelte.

Further Reading

sourced has been around for several years for building event sourced models for backend services. This means with sourced you can build your "model" microservices in the same way you build your front end models.

sveltekit-eventsourced-funnel's People

Contributors

patrickleet avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ocupe

sveltekit-eventsourced-funnel's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency sourced to v4.0.7
  • chore(deps): update dependency sourced-repo-svelte-local-storage-store to v2.0.14
  • chore(deps): update dependency svelte-preprocess to v4.10.7
  • chore(deps): update dependency eslint-config-prettier to v8.10.0
  • chore(deps): update dependency prettier to v2.8.8
  • chore(deps): update dependency prettier-config-standard to v4.1.0
  • chore(deps): update dependency prettier-plugin-svelte to v2.10.1
  • chore(deps): update dependency svelte-jester to v2.3.2
  • chore(deps): update testing-library monorepo (@testing-library/jest-dom, @testing-library/svelte)
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update dependency cssnano to v7
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency eslint-config-prettier to v9
  • chore(deps): update dependency eslint-config-standard to v17
  • chore(deps): update dependency eslint-plugin-svelte3 to v4
  • chore(deps): update dependency postcss-load-config to v5
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency prettier-config-standard to v7
  • chore(deps): update dependency prettier-plugin-svelte to v3
  • chore(deps): update dependency svelte-jester to v3
  • chore(deps): update dependency svelte-preprocess to v5
  • chore(deps): update dependency uuid to v9
  • chore(deps): update jest monorepo to v29 (major) (babel-jest, jest)
  • chore(deps): update testing-library monorepo (major) (@testing-library/jest-dom, @testing-library/svelte)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/node.js.yml
  • actions/checkout v2
  • actions/setup-node v2
  • codecov/codecov-action v2
npm
package.json
  • @babel/core 7.16.5
  • @sveltejs/kit 1.0.0-next.202
  • @testing-library/jest-dom 5.16.1
  • @testing-library/svelte 3.0.3
  • autoprefixer 10.4.0
  • babel-jest 27.4.5
  • babel-plugin-transform-vite-meta-env 1.0.3
  • cssnano 5.0.14
  • debug 4.3.3
  • esbuild-jest 0.5.0
  • eslint 7.32.0
  • eslint-config-prettier 8.3.0
  • eslint-config-standard 16.0.3
  • eslint-plugin-svelte3 3.2.1
  • jest 27.4.5
  • postcss 8.4.5
  • postcss-load-config 3.1.0
  • prettier 2.5.1
  • prettier-config-standard 4.0.0
  • prettier-plugin-svelte 2.5.1
  • sourced 4.0.4
  • sourced-repo-svelte-local-storage-store 2.0.5
  • svelte 3.44.3
  • svelte-jester 2.1.5
  • svelte-preprocess 4.10.1
  • tailwindcss 2.2.19
  • uuid 8.3.2

  • Check this box to trigger a request for Renovate to run again on this repository

Better svelte tests

getting testing working in sveltekit was an adventure of it's own - and jest 27 esm mocking support is brand new and unstable.

Need better tests that do more than simple renders for svelte stuff - model tests are great - 100% there :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.