How to build your own project upon Edge

Our docs are on GitHub, and all contributions are welcome. Suggest an edit or report a problem.

Edge is designed to be built upon. You are free to make whatever changes you like (additions and deletions), in accordance with the License (MIT).

Create a repository

If you don’t have a remote repository already (e.g. on GitHub), here’s how to create a new local one:

src$ mkdir acme
src$ cd acme
acme$ git init

If you already have a repository, you can clone it like so:

src$ git clone git@github.com:acme/acme.git
src$ cd acme

Add Edge to your project

Once you have your repository, you can add Edge as a remote, and incorporate it in:

acme$ git remote add edge https://github.com/juxt/edge.git
acme$ git pull --allow-unrelated-histories --no-rebase edge master

Add a remote later (optional)

It’s a good idea to have somewhere to back up your commits.

For example, if you create a new repository on GitHub called acme under the organisation acme, you could add the repository to your project like this:

Create a git remote
acme$ git remote add origin git@github.com:acme/acme.git
acme$ git push -u origin master

Create a new app

With your new project created, you’re ready to create an app. Apps are deps.edn projects within Edge which are intended to be run as a server.

From the root of the repo, run the ./bin/app script. It can be run with an optional flags which add support for Sass or Clojurescript, these are --sass and --cljs respectively.

Your project name should be namespaced to match your application. If your company was named "Acme" you might use "acme/api" or "com.acme/api".

If you’re unsure, use your company name at work, or your github username for hobby projects. There’s a low chance of conflicts in an application.

The project namespace will determine the Clojure namespaces within your application.

The below commands will create a folder based on your project name. If you don’t like the folder name, you can safely rename it (e.g. via mv) without any adverse affects.

edge$ ./bin/app acme/api
edge$ ./bin/app acme/blog --sass
edge$ ./bin/app acme/dashboard --cljs
edge$ ./bin/app acme/radar --sass --cljs

License

The MIT License (MIT)

Copyright © 2016-2019 JUXT LTD.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Last updated 2019-07-06 08:45:23 +0100