• Stars
    star
    735
  • Rank 61,652 (Top 2 %)
  • Language
    HTML
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A powerful Clojure web library, full HTTP, full async - see https://juxt.pro/yada/index.html

yada

CircleCI

yada is a web library for Clojure, designed to support the creation of production services via HTTP.

It has the following features:

  • Standards-based, comprehensive HTTP coverage (content negotiation, conditional requests, etc.)
  • Parameter validation and coercion, automatic Swagger support
  • Rich extensibility (methods, mime-types, security and more)
  • Asynchronous, efficient interceptor-chain design built on manifold
  • Excellent performance, suitable for heavy production workloads

yada is a sibling library to bidi - whereas bidi is based on routes as data, yada is based on resources as data.

The user-manual for the latest (1.x) release is available at https://juxt.pro/yada and offline (see below).

The user-manual is also available as an e-book or PDF, at Leanpub.

Installation

For the latest stable release, add the following dependency to your project.clj or build.boot file:

[yada "1.2.15"]

For the latest alpha release, add the following dependency to your project.clj or build.boot file:

[yada "1.3.0-alpha9"]

Build Status

Create a yada handler

Typically, yada handlers are created from a configuation expressed in data.

(require '[yada.yada :as yada])

(yada/handler
  {:methods
    {:get
      {:produces "text/html"
       :response "<h1>Hello World!</h1>"}}})

This is a simple example, there are a lot more options in yada than can be expressed here, but the approach is the same. The data configuration can be hand-authored, or generated programmatically leading enabling creation of consistent APIs at an industrial scale.

Dependencies

yada requires the following :-

  • a Java JDK/JRE installation, version 8 or above
  • Clojure 1.8.0

Support for other web-servers, such as undertow, are on the road-map.

Future compatibility

If you want to ensure that your code will not break with future releases of yada, you should only use functions from the yada.yada namespaces.

You are free to use other public functions in yada, but please be warned that these can and do change between releases.

Lean yada

By default, yada is batteries-included, bringing in a large number of dependencies.

However, a leaner version of yada is available which cuts out Swagger, swagger-ui, JSON (cheshire), Transit, buddy, core.async, SSE and other fat.

The following differences apply:

  • yada doesn't automatically encode/decode JSON bodies, or render JSON as HTML
  • no parameter validation or coercion
  • no Swagger
  • no SSE (currently)
  • no JWT
  • no Transit

To use the lean (or any other) variant of yada, specify the appropriate classifier in your project.clj or build.boot file:

[yada/lean "1.2.15"]

Running documentation and examples offline

Although yada is a library, if you clone this repo you can run the documentation and examples from the REPL.

cd yada
lein repl

Once the REPL starts, type in and run the following :-

user> (dev)
dev> (go)

Now browse to http://localhost:8090.

Troubleshooting FAQ

Q. I'm migrating from a version before yada 1.1 and my async multipart and other uploads are not working, sometimes throwing NullPointerExceptions or other errors.

A. Either use yada's built-in yada.server function or make sure you have started aleph's server with the option raw-stream? :true. Previous versions of yada left these settings up to the user but it's very important in yada 1.1 that raw-stream? is set.

Support

yadarians mostly chat in the Slack channel plus there is also a dedicated Gitter channel channel

Join the chat at https://gitter.im/juxt/yada

Also, there is a discussion group yada-discuss to discuss ideas.

Contributing

Feel free to raise GitHub issues on this repository.

Pull requests are welcome. Please run the test suite and check that all tests pass prior to submission.

$ lein test

If you want to build and test your own version of yada, you need to be aware how to locally install your own version. Since yada is broken into multiple Maven jars, each with their own version declaration, there is a script that allows you to set the version to whatever you need it to be.

$ ./set-version 1.3.0-MS-SNAPSHOT

Rather than use lein install, you should replace lein with ./treelein.

For example:

$ ./treelein install

This will install all the yada jars into your local Maven repository.

Acknowledgments

Thanks to the following people for inspiration, contributions, feedback and suggestions.

  • Malcolm Sparks
  • Martin Trojer
  • Philipp Meier
  • David Thomas Hume
  • Zach Tellman
  • Stijn Opheide
  • Frankie Sardo
  • Jon Pither
  • Håkan Råberg
  • Ernestas Lisauskas
  • Thomas van der Veen
  • Leandro Demartini
  • Craig McCraig of the clan McCraig
  • Imre Kószó
  • Luo Tian
  • Joshua Griffith
  • Joseph Fahey
  • David Smith
  • Mike Fikes
  • Brian Olsen
  • Stanislas Nanchen
  • Nicolas Ha
  • Eric Fode
  • Leon Mergen
  • Greg Look
  • Tom Coupland
  • Mikkel Gravgaard
  • Lucas Lago
  • Johannes Staffans
  • Michiel Borkent
  • James Laver
  • Marcin Jekot
  • Daniel Compton
  • Yoshito Komatsu
  • Bor Hodošček
  • Ivar Refsdal
  • Josh Graham
  • Joshua Ballanco
  • Steven Harms
  • Ryan Smith
  • Alexis Lee

Also, see the dependency list. In particular, yada would certainly not exist without the considerable efforts of those behind the following libraries.

  • Manifold & Aleph - Zach Tellman
  • Prismatic Schema - Jason Wolfe (and others)
  • Ring-swagger - Tommi Riemann (and others)

Copyright & License

The MIT License (MIT)

Copyright © 2015-2016 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.

More Repositories

1

bidi

Bidirectional URI routing
Clojure
991
star
2

aero

A small library for explicit, intentful configuration.
Clojure
743
star
3

tick

Time as a value.
Clojure
599
star
4

edge

A Clojure application foundation from JUXT
Clojure
503
star
5

joplin

Flexible datastore migration and seeding for Clojure projects
Clojure
316
star
6

juxt-accounting

Double-entry accounting software written in Clojure with Datomic.
Clojure
281
star
7

pack.alpha

Package clojure projects
Java
258
star
8

mach

A remake of make (in ClojureScript)
Clojure
246
star
9

jig

Jig is an application harness providing a beautifully interactive development experience for Clojure projects.
Clojure
229
star
10

clip

Light structure and support for dependency injection
Clojure
228
star
11

iota

Infix operators for test assertions
Clojure
150
star
12

site

A web and API server, powered by xtdb.com
Clojure
135
star
13

modular

JavaScript
128
star
14

apex

A compendium of Clojure libraries for implementing web backends.
Clojure
123
star
15

bolt

An integrated security system for applications built on component
Clojure
123
star
16

jinx

jinx is not xml-schema (it's json-schema!)
Clojure
99
star
17

pull

Trees from tables
Clojure
96
star
18

roll

AWS Blue/Green deployment using Clojure flavoured devops
Clojure
77
star
19

reap

A Clojure library for decoding and encoding strings used by web protocols.
Clojure
74
star
20

dirwatch

A Clojure directory watcher, wrapping the JDK 7 java.nio.file.WatchService.
Clojure
67
star
21

skip

Skippy McSkipface - A general Clojure dependency tracker
Clojure
34
star
22

snap

Snapshot testing for Clojure and Clojurescript
Clojure
30
star
23

pack-datomic

Datomic Packer and Terraform setup
HCL
26
star
24

qcon2014

JavaScript
26
star
25

stoic

Marrying the Component Lifecycle pattern with distributed config.
Clojure
20
star
26

spin

Unbundling the web application-tier
Clojure
19
star
27

pick

A Clojure library for HTTP server-driven content negotiation.
Clojure
18
star
28

prop

Clojure
17
star
29

grab

A Clojure library for parsing and executing GraphQL queries.
Clojure
16
star
30

rest

A guide to coding a REST service
CSS
15
star
31

chatserver

Clojure
13
star
32

shop

The JUXT Shop - a sample application built on Crux
Clojure
11
star
33

fuzz

Example ClojureScript Project that happens to wrap Slack
Clojure
9
star
34

dotfiles

Recommended dotfiles used by JUXT
Emacs Lisp
9
star
35

ramp

Shell
8
star
36

card

Not sure what this is. A kind-of Zettelkasten?
TypeScript
8
star
37

chatclient

Clojure
8
star
38

hire

A technical interview test for potential employees
Clojure
7
star
39

rock

Hardened AMIs for Clojure deployments (Arch Linux)
Shell
7
star
40

clip-example

Example of using Clip
Clojure
7
star
41

datomic-extras

Clojure
7
star
42

lein-dockerstalk

Clojure
7
star
43

docker

Docker files
Makefile
7
star
44

plain-clojure-lambda

A recipe for building AWS Lambdas using plain clojure
Clojure
7
star
45

draw

A DSL for SVG diagrams
Clojure
6
star
46

trag

Graph transduction
Clojure
5
star
47

radar

JUXT Clojure Technology Radar
Clojure
5
star
48

pack-ek

HCL
4
star
49

adoc

A Clojure wrapper for asciidoctorj
Clojure
4
star
50

msf

Volunteer work for MSF
Clojure
4
star
51

astro-website

Source for the main JUXT website
JavaScript
3
star
52

vext

Clojure
3
star
53

azondi

MQTT goes reactive
CSS
3
star
54

pack-riemann

HCL
3
star
55

yada.cookbook

A cookbook of yada recipes
3
star
56

component-utils

Clojure
2
star
57

blip

Small library for fetching/injecting graphql definitions
Clojure
2
star
58

ping

Clojure
2
star
59

modular.co-dependency

Co-dependency support for com.stuartsierra.component
Clojure
2
star
60

http

2
star
61

lein-deploy-tar

A Leiningen plugin to upload tars to a Maven repository.
Clojure
2
star
62

aleph-issue

Testing aleph
Clojure
1
star
63

mksmarthack

A Clojure data hack on MK:Smart
Clojure
1
star
64

eventing-examples

Clojure
1
star
65

flow

Clojure
1
star
66

training-exercises-webapp

Training exercises
Clojure
1
star
67

example-code

Example code for a recent client course
Clojure
1
star
68

home-apps

Monorepo for SPAs that use home.juxt.site as a backend
TypeScript
1
star
69

sail

Clojure
1
star
70

clojars-mirrors

Re-releasing Clojars libraries onto Maven Central
Clojure
1
star
71

XT20.conf

Public materials for XT20
1
star
72

asciidoctor-stylesheet-factory

CSS
1
star