A collection of code project templates
Before starting with this project, please make sure you have the following tools installed:
To create a new project based on a template in this project:
clojure -Sdeps \
'{:deps {io.github.athomasoriginal/templates {:git/sha "912cae498697231f0366ea149ee5b6e4fd0c1f91"}}}' \
-Tnew create \
:template athomasoriginal/reagent \
:name myusername/my-app-name
The above will get you started with a clojuresript
SPA app.
The above is a lot to type. See the usage section below for how I run it.
To avoid typing all the above out, I create a Clojure CLI Tools
alias. Here's
how you do that.
The following assumes you've gone through the Housekeeping steps
- Open your global
.clojure
directoryvim ~/.clojure/deps.edn
Note that
vim
is my editor. If you're not usingvim
, replacevim
with the CLI command for your editor of choice. Or just open~/.clojure
from inside of your fav' editor. - Open my clojure global alias file
The above link should auto-highlight the
:new
alias - Copy the
:new
aliascopy all the highlighted lines
- Add the
:new
alias to yourdeps.edn
file in~/.clojure
Reference my
~/.clojure/deps.edn
if you're not sure what it should look like. - Create a new template
clj -T:new :name nike/app-name
nike
is your organization name.app-name
is the name of your app and will be the name of your top level folder.
The following will provide examples of the available templates, what they are for and examples commands to create them.
This encapsulates the kinds of apps I would build and how I would start them. A quick run through:
- Am I building a
quick demo
code project? see bb - Am I building a
multi-page
/backend
web app? see app - Am I building a
SPA
frontend? see reagent - Am I building a
Static Site
web app? see eleventy - Am I building a
Native App
? see c_app
Create app
clj -T:new :template athomasoriginal/app :name app-name
This is a clojure
web app backend. I use this as a starting point for
creating fullstack clojure web apps.
Create bb
clj -T:new :template athomasoriginal/bb :name app-name
This is a bb
app. I use this as a starting point for creating a bb app.
bb
is often what I will use when I'm experimenting with an idea and
don't require a full clojure setup. It's helpful because the startup is fast
and it contains a lot of built-in tools.
Create c_app
clj -T:new :template athomasoriginal/c_app :name app-name
This is a c
app. I use this as a starting point for creating c
apps. It's
currently built to support macos/linux.
Create eleventy
clj -T:new :template athomasoriginal/eleventy :name app-name
This is a static site generator app using eleventy
. I use this as a
starting point for any project which should be a static app (e.g. a marketing
site). What makes this special is that it comes with a custom templating
engine for clojurescript
.
Create reagent
clj -T:new :template athomasoriginal/reagent :name app-name
This is a SPA app using reagent
(clojurescript) app. If I start a SPA, this
is how I do that.
- Clone this repo
- Move into this repo
- Modify the contents
- Build a template from local repo
clojure -Sdeps '{:deps {athomasoriginal/templates {:local/root "."}}}' \ -Tnew create \ :template athomasoriginal/reagent \ :name mygithubhandle/myreagent
Copyright © 2023 Thomas Mattacchione
Distributed under the Eclipse Public License version 1.0.