All Projects → kawasima → darzana

kawasima / darzana

Licence: other
a DSL for backends-for-frontends (BFF)

Programming Languages

clojure
4091 projects
java
68154 projects - #9 most used programming language
HTML
75241 projects
CSS
56736 projects

Labels

Projects that are alternatives of or similar to darzana

AspNetCore6Experiments
ASP.NET Core Blazor BFF with Azure AD and Razor page
Stars: ✭ 43 (+22.86%)
Mutual labels:  bff
bff
A proxy to help your team adopt the Backend for Frontend (BFF) cloud pattern
Stars: ✭ 17 (-51.43%)
Mutual labels:  bff
trouble-training
FullStack DDD/CQRS with GraphQL workshop including distributed tracing and monitoring. This shows the configuration from React frontend to .Net backend.
Stars: ✭ 271 (+674.29%)
Mutual labels:  bff
microservice-style-guide
There are several articles on ‘internet’ including large companies, showing their microservices using REST, this guide has how to show some good practices and standards so that you have a microservice architecture that is the best possible, totally decoupled and scalable.
Stars: ✭ 93 (+165.71%)
Mutual labels:  bff
microservices-go-grpc
Go microservices with REST, and gRPC for demonstrating the BFF pattern. This repository contains backend services. Everything is dockerized and ready to "Go" :-)
Stars: ✭ 151 (+331.43%)
Mutual labels:  bff

darzana

Darzana is a DSL for backends-for-frontends (BFF). Darzana has some features as follows:

  • Call APIs Asynchronously
  • Define APIs by describing the Swagger specifications
  • Validate form parameters by BeanValidation
  • Render a HTML template

Examples

(control/defroute "category/create" :post
  (mapper/read-value {:var "category"} {:type io.swagger.model.Category :var :category})
  (control/if-success
   (-> (api/call-api {:id :petstore :path "/category" :method :post})
       (control/redirect "/category"))
   (renderer/render {:template "/petstore/category/new"})))

Commands specification

Darzana has some commands for describing specification of endpoints.

defroute

Define routing.

(control/defroute "/pet" :get ... )

call-api

Call multiple APIs in parallel.

(api/call-api [{:id :petstore :path "/pet/{petId}" :method :get}
               {:id :petstore :path "/user/{userId}" :method :get}])

read-value

read-value is a command that converts to an another darzana scope variable.

(mapper/read-value {:var "pet"} {:scope :page, :var :pet, :type io.swagger.model.Pet})

If type parameter exists, validate automatically.

Add an authenticated user to session.

(mapper/read-value {:var :login-user} {:scope :session})

render

Render a HTML template.

(renderer/render {:template "pet/show"})

if-success

This is a command for conditional processing. If the error scope is empty,

(control/if-success
 (renderer/render {:template "pet/show"})
 (renderer/render {:template "error"}))

Developing

Setup

Create a deps.edn.

{:deps
 {net.unit8.darzana/darzana {:mvn/version "1.0.0-SNAPSHOT"}}}

application.edn

{:duct.core/environment :development

 :duct.core/include ["darzana/config"]
 :darzana.api-spec/swagger {:swagger-path "swagger"}
 :darzana.template/freemarker {:template-path "ftl"}
 :darzana.http-client/okhttp {}
 :darzana/runtime {:routes-path "scripts"}}

Run server using by clj command.

% clj -m darzana.main application.edn

Legal

Copyright © 2017-2018 kawasima Distributed under the Eclipse Public License, the same as Clojure.

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].