All Projects → martinklepsch → Tenzing

martinklepsch / Tenzing

Licence: epl-1.0
⚡️ Clojurescript application template using Boot

Programming Languages

clojure
4091 projects
clojurescript
191 projects

Projects that are alternatives of or similar to Tenzing

Generator Jekyll Starter Kit
🚀 Jekyll Progressive Web App Generator.
Stars: ✭ 139 (-65.59%)
Mutual labels:  starter-kit, project-template
Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (-7.67%)
Mutual labels:  starter-kit
Fullstack Typescript
FAST FullStack React with TypeScript starter kit.
Stars: ✭ 295 (-26.98%)
Mutual labels:  starter-kit
Cpp Project
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Stars: ✭ 328 (-18.81%)
Mutual labels:  project-template
Project Stub
deps
Stars: ✭ 300 (-25.74%)
Mutual labels:  starter-kit
Gulp Scss Starter
Frontend development with pleasure. SCSS version
Stars: ✭ 339 (-16.09%)
Mutual labels:  starter-kit
Whitestorm Typescript Boilerplate
📦 🚀 TypeScript boilerplate for WhitestormJS using react/redux ⚛
Stars: ✭ 285 (-29.46%)
Mutual labels:  starter-kit
Api
🏁🛠️ SaaS backend & API framework based on @nestjs
Stars: ✭ 390 (-3.47%)
Mutual labels:  starter-kit
Laravel Enterprise Starter Kit
👔 Enterprise Web application starter kit or template using Laravel
Stars: ✭ 356 (-11.88%)
Mutual labels:  starter-kit
Pug Starter
Simple pug (jade) starter [framework] enabling faster delivery of HTML & CSS projects to a private server and/or automatic deployment of GitHub pages.
Stars: ✭ 328 (-18.81%)
Mutual labels:  starter-kit
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+4535.4%)
Mutual labels:  starter-kit
Fullstack Apollo Express Mongodb Boilerplate
💥A sophisticated GraphQL with Apollo, Express and MongoDB boilerplate project.
Stars: ✭ 301 (-25.5%)
Mutual labels:  starter-kit
Nodejsstarterkit
Starter Kit for Node.js v14.x, minimum dependencies 🚀
Stars: ✭ 348 (-13.86%)
Mutual labels:  starter-kit
Flask Api Starter Kit
Start a Flask API in less than 5 minutes
Stars: ✭ 296 (-26.73%)
Mutual labels:  starter-kit
Gatsby Starter
Gatsby 2.0 starter with typescript and many cools dev tools
Stars: ✭ 385 (-4.7%)
Mutual labels:  starter-kit
Angular Spring Starter
Full stack starter kit featuring Angular 7, Spring boot and stateless JWT authentication.
Stars: ✭ 294 (-27.23%)
Mutual labels:  starter-kit
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+735.89%)
Mutual labels:  starter-kit
Aem Project Archetype
Maven template to create best-practice websites on AEM.
Stars: ✭ 337 (-16.58%)
Mutual labels:  project-template
Lein template descjop
A Leiningen template(Clojure/ClojureScript Project) for Web based desktop application with Electron (atom-shell).
Stars: ✭ 394 (-2.48%)
Mutual labels:  project-template
Preact Starter
Webpack3 boilerplate for building SPA / PWA / offline front-end apps with Preact
Stars: ✭ 384 (-4.95%)
Mutual labels:  starter-kit

Tenzing, the awesome Clojurescript application template

rationale | usage | deployment | getting help

Tenzing is a Clojurescript template offering the following features:

  1. Incremental Clojurescript compilation
  2. Live reloading of your Javascript, CSS, etc.
  3. Browser-REPL

In contrast to some of the options out there it is opinionated in the following ways:

  1. Tenzing uses Boot instead of Leiningen (see below)
  2. Tenzing does not provide a backend layer (see below)
  3. Tenzing allows you to choose between Om, Reagent and others

Rationale

Why Boot?

In contrast to Leiningen Boot offers a clear strategy when it comes to composing multi-step build processes such as compiling stylesheets and Javascript whenever a relevant file changes.

Many Leinigen plugins come with an `auto` task that allows similar behavior. If you want to run multiple of those tasks it's usually done by starting multiple JVM instances which can lead to high memory usage. Boot allows this sort of behaviour to reside in one JVM process while making sure that build steps don't interfere with each other.

You can learn more about Boot in a blog post by one of the authors, its github project or a blog post I wrote about it. Mimmo Costanza's modern-cljs tutorial also uses Boot throughout - Tutorial 2 walks through the setup of a typical Boot-based development environment.

Why #noBackend?

Tenzing is designed with prototyping in mind. Instead of writing your own backend you're encouraged to use services like Firebase, Usergrid and others.

If you figure out that you need a Clojure based backend down the road it's simple to either add it yourself or create it as a standalone service that's being used by your clients.

Please, also consider offline first as an approach for building early iterations of your application.

If you're wondering how files are served during development: there is a boot task `serve` that allows you to serve static files.

Usage

Create a Project

To create a new project, install boot and run:

$ boot -d boot/new new -t tenzing -n your-app

Template options are specified using the -a switch. For example:

$ boot -d boot/new new -t tenzing -n your-app -a +reagent -a +test

Alternatively, if you have leiningen installed, you can run

$ lein new tenzing your-app

or to specify options:

$ lein new tenzing your-app +reagent +test

There are a bunch of options that determine what your newly created project will contain:

  • +om provides a basic Om application and adds relevant dependencies
  • +reagent provides a basic Reagent application and adds relevant dependencies
  • +rum provides a basic Rum application and adds relevant dependencies
  • +garden sets up Garden and integrates into the build process
  • +sass sets up Sass and integrates into the build process (requires libsass)
  • +less sets up Less and integrates into the build process.
  • +test adds a cljs test-runner and adds a test task.
  • +devtools adds a cljs-devtools through boot-cljs-devtools
  • +dirac adds a dirac through boot-cljs-devtools.

If you want to add an option, pull-requests are welcome.

Running it

After you installed Boot you can run your Clojurescript application in "development mode" by executing the following:

$ boot dev

After a moment of waiting you can head to localhost:3000 to see a small sample app. If you now go and edit one of the Clojurescript source files or a SASS file (if you've used the +sass option) this change will be picked up by Boot and the respective source file will get compiled. When a compiled file changes through that mechanism it will get pushed to the browser.

If you used the +test option, then you'll be able to run unit tests via boot test. Use boot auto-test to have tests automatically rerun on file changes.

Connecting to the browser REPL

After you started your application with boot dev there will be a line printed like the following:

nREPL server started on port 63518 on host 0.0.0.0

This means there now is an nREPL server that you can connect to. You can do this with your favorite editor or just by running boot repl --client in the same directory.

Once you are connected you can get into a Clojurescript REPL by running (start-repl). At this point I usually reload my browser one last time to make sure the REPL connection is properly setup.

Now you can run things like (.log js/console "test"), which should print "test" in the console of your browser.

How it works

If you look at the build and run tasks in the build.boot file of your newly created project you will see something like the following:

(deftask build [] (comp (speak) (cljs) (sass :output-dir "css")))

(deftask run [] (comp (serve) (watch) (cljs-repl) (reload)
    (build)))

Basically this composes all kinds of build steps into a unified run task that will start our application. From top to bottom:

The build task consists of three other tasks:

  • speak gives us audible notifications about our build process
  • cljs will compile Clojurescript source files to Javascript
  • sass will compile Sass source files to CSS

Now if we just run boot build instead of the aforementioned boot dev we will compile our Clojurescript and Sass exactly once and then the program will terminate.

This is where the run task comes in:

  • serve starts a webserver that will serve our compiled JS, CSS and anything else that is in resources/
  • watch will watch our filesystem for changes and trigger new builds when they occur
  • cljs-repl sets up various things so we can connect to our application through a browser REPL
  • reload will watch the compiled files for changes and push them to the browser
  • build does the things already described above

Please note that all tasks, except the one we defined ourselves have extensive documentation that you can view by running boot <taskname> -h (e.g. boot cljs-repl -h).

Writing build artifacts to disk

By default, none of the tasks in projects generated by tenzing output any files.

For example, when running the dev task, your project's source and resources are compiled to a temporary boot fileset and served from there. When boot quits, the fileset is no longer available.

This is actually boot's default and, at first, might sound like a strange choice for a build tool! However, these managed filesets are at the core of boot's philosophy and provide it with many advantages over declarative, stateful build tools. See the boot homepage or the [filesets wiki entry] (https://github.com/boot-clj/boot/wiki/Filesets) for more info on these concepts.

So how do you output your built project to disk so that you can deploy it for example? Simple! Boot has a [built-in target task] (https://github.com/boot-clj/boot/blob/master/doc/boot.task.built-in.md#target) that you can can compose with other tasks to output their results to a given directory (by convention the directory is named target).

To build a tenzing project with the production settings and output the results to disk you would run the following:

$ boot production build target

If you look in your project directory now, you will see a target directory containing the output of all of the tasks in this chain. By default, this directory is cleaned every time you run boot, unless you pass the no-clean option to the target task.

Should you need to filter, copy, move or rename the output files, or change the directory structure, the sift task will help you do this. If you have complex post-processing needs or want to save typing at the command line, it's a simple matter to define your own tasks.

Deployment

Since Tenzing comes without a backend you can easily deploy your app to Amazon S3 or even host it in your Dropbox. To do that just copy the files in target/ to your desired location.

confetti logo

PS. I'm also working on a tool called Confetti 🎉 that helps you setting up static sites on AWS infrastructure. It's a bit more aimed at people that deploy and manage many static sites but you should probably check it out either way :)

Getting Help

If you run into any problems feel free to open an issue or ping me (martinklepsch) in the ClojureScript room on Riot.im (no signup required).

Credits

The initial release of Tenzing was prompted by the urge to have something like the awesome Chestnut template but built on top of Boot. Many props to Arne Brasseur for making getting started with ClojureScript a lot easier at the time!

License

Copyright © 2014 Martin Klepsch

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].