simonneutert / clojurescript-web-app-demo

I wanted to see how far I can push it, having dabbled with Clojure/-Script for a few weeks after work. So, there you have it: an example of an artisinal (most probably bad ๐Ÿซ ) NodeJS-independent Frontend Project ๐Ÿป ๐Ÿ˜Ž

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fully functional everything clojurescript example

What is this and what will I see, when I run the Dockerfile?

A simple, but interactive event calendar for the city of Mainz, Germany. With search and filters and xhr calls in the background and such โ˜ฎ๏ธ


When you walk to the edge of all the light you have and take that first step into the darkness of the unknown, you must believe that one of two things will happen. There will be something solid for you to stand upon or you will be taught to fly.โ€
- Patrick Overton, The leaning tree

Rationale

I wanted to see how far I can push it, having dabbled with Clojure/-Script for a few weeks after work.

So, there you have it: an example of an artisinal (most probably bad ๐Ÿซ ) NodeJS-independent Frontend Project ๐Ÿป ๐Ÿ˜Ž

what's in for me learning clojure(-script?)
- everyone not writing lisp

well, if you thought Elm was cool, but you struggled with the types... or maybe you think types hinder from greatness... Rich never said this, but I heard it anyways in his talks.

What you have at hand, when going through this codebase

  • firing and receiving a http json request
    • json extraction
    • process data, extract information
  • dynamic data binding / state management
  • DOM creation/manipulation
  • state management
  • very basic Browser Event Management
    • user interaction
    • filtering
  • parameterized build for dev/prod scenarios

Run with Docker ๐Ÿณ

$ docker build . -t clj-events-spa
$ docker run --rm -p 8080:80 clj-events-spa

then open http://localhost:8080

Pre-Conditions (if you want to get your hands dirty ๐Ÿ‘)

I code clojure in VS Code using VSCode with Calva or a similar Editor supporting Clojure(-Script)

Compile the sources and view them

./build-production.sh and then http-serve the files

I solve that task using node's http-server
other may use Python for that

What's good, what could be easily improved, what did I learn?

improvements needed

  • state management abstraction, faster filtering may (see medium low hanging fruits)

medium low hanging fruits

  • lookup table for the calendar events
  • memoizing results ๐Ÿคทโ€โ™‚๏ธ

what was learned

  • clojure(-script) isn't witchcraft and has some really nice docs/api/reference
  • almost no dependencies needed ๐Ÿคฏ
  • one language to rule them all

Development (with VSCode and Calva)

  • start a REPL deps.edn + ClojureScript build for Browser
  • a Browser will open, then
  • evaluate core.cljs line by line
  • evaluate requirements in events.cljs and inspect the events in state

About

I wanted to see how far I can push it, having dabbled with Clojure/-Script for a few weeks after work. So, there you have it: an example of an artisinal (most probably bad ๐Ÿซ ) NodeJS-independent Frontend Project ๐Ÿป ๐Ÿ˜Ž


Languages

Language:Clojure 78.7%Language:HTML 14.7%Language:Shell 4.4%Language:Dockerfile 2.2%