Tinytimer is a small web application with which users can create and share small countdown timers.
The application is written using Clojure for both the frontend and backend.
To start working the following tools are necessary:
- npm/yarn
- Leiningen
- shadow-cljs
After cloning the repository run yarn
or npm install
to download all the frontend dependencies. Furthermore, with
lein migrate
a SQLite database can be generated with all necessary tables which the application will use.
Usually during development four terminals are necessary:
- In the first
shadow-cljs
watches for changes concerning the frontend code. It will update theresources/public/js/dev/main.js
file in case it recognizes any change to the code.
shadow-cljs watch dev
- In the second one,
shadow-cljs
provides a REPL which is connected to the browser environment:
shadow-cljs cljs-repl dev
- In the third one, leiningen will serve the application and will reload the code upon change:
lein ring server
- Lastly, for the backend code another REPL is necessary:
lein repl
Executing the tests is fairly simple.
- Create/Migrate the testing database:
lein with-profile test migrate
- Run the tests:
lein test
The easiest way to build and deploy tinytimer is by using docker. Currently the production docker image of tinytimer is build using Github actions. The definition of the jobs is in .github/workflows/ci.yml
. On production the image can be loaded into the local docker registry and run similar to:
sudo docker run \
--name tinytimer \
-d \
--env APP_ENV=production \
--env DATABASE_URL=jdbc:sqlite:/db/production.db \
--env GOOGLE_SITE_VERIFICATION=SITE_VERIFICATION_KEY \
-v /home/tinytimer/db:/db \
-p 8080:8080 \
-t tinytimer:latest