Skip to content

Small web app demonstrating how to build a web chat app with websockets and Clojure(Script)

License

Notifications You must be signed in to change notification settings

sguessou/chatalaslack

Repository files navigation

alt text

Chat à la Slack

alt text

A simple web chat application built with Clojure(Script).
This small application doesn't include all of the features expected in a real web chat application, but simply demonstrates the use of websockets for real time messaging in a Clojure(Script) environment.

There are 3 predefined rooms where the users can have a group chat.
Users are also able to message eachothers privately.

Technologies used in this project

Backend

Http-kit Http server for Clojure. Used for handling HTTP requests and websocket connections.
Metosin/Reitit Backend side routing libray for Clojure.
Hiccup HTML representation library for Clojure(Script).

Frontend

Reagent React wrapper for Clojurescript.
Re-frame Client state management library for Clojurescript.
Secretary client side routing library for Clojurescript.
Wscljs Lightweight websocket client for Clojurescript.
Bulma CSS framework.

Development

Leiningen was used to bootstrap the project with a starting template.
Figwheel.main is used for frontend side code hot reloading.
I'm using emacs + cider in my workflow for REPL driven development, but I believe that other editors can be used for the same purpose given that the required plugins are installed.

Usage

At the root of the project, launch the following command:

$ lein run 8000.

Leiningen will download and install all the needed dependencies. After that, you can open your browser and navigate to localhost:8000.

To generate a production frontend build run this command: $ clojure -m figwheel.main -O advanced -bo prod

Best Resources for learning Clojure(Script)

PurelyFunctionalTV Clojure Training Online
Learn Reagent + Re-frame Reagent + Re-frame
Lambda Island Clojure screencasts

License

Copyright © 2019 FIXME