Skip to content
/ simpatico Public template

Simpatico is an umbrella term for several data-structures and algorithms written in JavaScript

License

Notifications You must be signed in to change notification settings

javajosh/simpatico

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Simpatico

Literate markdown server for a local codepen-like experience

License MIT PRs Welcome GitHub commit activity GitHub closed issues

VPS deployable - Running Locally - Experiments


Use a text editor and browser you already know and a simple server process to create literate programs that execute immediately and without a build. Tiny, privacy respecting, readable and short JavaScript source. No front-end build!

Features

  • Offline development

    • Have a codepen/observablehq/jsfiddle-like experience without being connected to the internet.
    • Use the text editor that you're comfortable with.
    • Use local source-code control
    • Have full control over the html, including head content.
    • Debug one top-level context rather than an embedded iframe context.
    • Speed up your build-test-debug (BTD) loop by eliminating the front-end build. No webpack, grunt, or anything else!
  • Publish

    • Publish your work in a way that protects your users. No cookies. No 3rd party resources are permitted.
    • The Reflector server is very small in terms of source (450LOC total), dependencies (only 3 and they have no transitive dependencies).
    • The Reflector server at simpatico.io takes 200MB of RAM and can handle 10k requests-per-second on a $5 VPS.
    • Extremely fast, single process operation. TLS terminates in node, nginx proxy is not needed.

Experiments

These are sample experiments users have created that show how Simpatico works. Feel free to fork them and start experimenting yourself.

  1. core. Very generic, convenience functions that smooth over the JavaScript runtime. Of particular importance is the definition of a comprehensive set of predicates/assertions. Nothing in this module is specific to Simpatico, although it is a good example of my preferred style of ES6 programming -> functional and minimal.
  2. combine. The function used to produce a new state from a previous state plus an input. combine() is a generalization of Object.assign() and previously published as combine-keys. Defines handler invocation and the message cascade.
  3. stree. A data structure that organizes inputs into chains that result in different, related states. Unifies previous distinct concepts like instantiation vs inheritance. Provides natural "collections" support.
  4. friendly. A very simple runtime type system, accessed through validate(), that helps functions help their callers call them correctly.
  5. svg SVG and SVG animation using only very small primitives. Visually interesting!

More detail about each module is available in the test harness html file, and the module source code itself.

Running Locally

  1. Install a recent version of NodeJS (See nvm, the best way to install node with $ nvm install 20 && nvm use 20)
  2. Clone this repository: git clone https://github.com/javajosh/simpatico
  3. Install the dependencies: cd simpatico && npm install
  4. Generate self-signed certificate to run local TLS (see devops/deploy.sh)
  5. Run the reflector node reflector.js
  6. Navigate to https://localhost:8080