English | 한국어
Disclaimer : All of the design decisions below are based on the current situation(November 2016).
elm is used for web client-side code. Other tools being used are:
- yarn & elm-package : Dependency Installation
- stylus : CSS Preprocessor
- webpack : Module Bundling & Packaging
The client-side code is directly built into and served from the server
directory.
▾ client/
▾ src/ # Client-side codes (elm, stylus, ...)
main.js # Entry point for webpack
...
package.json # Libraries from "npm", build dependencies
elm-package.json # Libraries from "package.elm-lang.org"
webpack.config.js
...
As for now, elm shows the best performance as a tool for SPA. Also, the strong type system of the language makes it suitable for the fast development by a small team, which can't afford a lot of person-hour() being spent on debugging.
yarn is a package manager which is better than npm in almost every way. Above all, it supports the concept of lock file, so we can avoid a build failure caused by other library author's mistake.
webpack does require fairly complex configuration, but still it's the best one among the front-end code build solutions for now. It supports bundling, compression, and loader and plugin system. Also, upcoming webpack 2 provides even more powerful features such as tree-shaking. LibreIRC will probably stick with webpack unless very compelling alternative shows up.
stylus is chosen because it is the most familiar CSS preprocessor for LibreIRC developers. Nevertheless, if someone wants to contribute in desing-wise and favor othe CSS preprocessor over stylus, we are more than willing to change it. For now, there aren't much stylus code as our current goal is to make a working MVP.
python 3.5 is used for server-side development. On top of that, we used sanic as a web framework, and perl and
venv
module (which is embedded in the language) for the initialization script for the python dev envirionment.
▾ server/
▾ public/ # Files that will be statically served
▸ build/ # Build results of web-client
index.html
▸ src/ # Server-side codes (python)
requirements.txt # Server-side dependencies
install # Development environment initialization script
run # Execution script
...
sanic is chosen because of async
/await
syntax (PEP 492) support. Though there aren't much of
async
/await
usage in server-side code yet, we certainly need it for actual communication with MQTT, which requires
the handling of a huge amount of requests. We don't need our web framework to be feature-rich, so it is reasonable to
stick with sanic, which shows the best performance than others.
Most of our scripts regarding server-development are written in perl. The reason behind that is, perl is easier to use compared to shell script, and it's also available from almost all environment. Unless the script logic gets too complex, we will stick to the choice.
venv
embedded in python is used instead of Virtualenv because LibreIRC forces developers to use Python 3.5+
anyway. In that case, using Virtualenv only introduces unnecessary, additional setup for developers.