Giter VIP home page Giter VIP logo

tree-king's Introduction

Cedar Dynasty

A small app to play the game Cedar Dynasty based on the old card game Kings & Scoundrels and inspired by Great Dalmuti.

Instructions

Setup a Cognito Instance

Create a new AWS Cognito instance and set up the user pool as you desire. Create an app client set up as a "Confidential Client". Set http://localhost:8090/oauth2-return as part of the Allowed Callback URLs.

Once created, create the .env file and set the client id, client secret, and hosted UI url variables as follows:

COGNITO_CLIENT_ID='<client_ud>'
COGNITO_CLIENT_SECRET='<client_secret>'
COGNITO_UI_URL='<cognito_domain>'

Dev build:

Prod build:

clj -X:build:prod build-client
clj -M:prod -m prod

Uberjar (optional):

clj -X:build:prod uberjar :build/jar-name "target/app.jar"
java -cp target/app.jar clojure.main -m prod

Deployment example:

Integrate it in an existing clojure app

  1. Look at src-prod/prod.cljc. It contains:
    • server entrypoint
    • client entrypoint
    • necessary configuration
  2. Look at src/great_dalmuti/server_jetty.clj. It contains:
    • an example Jetty integration
    • required ring middlewares

Build documentation

Electric Clojure programs compile down to separate client and server target programs, which are compiled from the same Electric application source code.

  • For an Electric client/server pair to successfully connect, they must be built from matching source code. The server will reject mismatched clients (based on a version number handshake coordinated by the Electric build) and instruct the client to refresh (to get the latest javascript artifact).
  • [src-build/build.cljc](src-build/build.clj bakes the Electric app version into both client and server artifacts.
    • server Electric app version is baked into electric-manifest.edn which is read in src-prod/prod.cljc.
    • client Electric app version is baked into the .js artifact as hyperfiddle.electric-client/ELECTRIC_USER_VERSION

Consequently, you need robust cache invalidation in prod!

  • In this example, complied js files are fingerprinted with their respective hash, to ensure a new release properly invalidates asset caches. index.html is templated with the generated js file name.
  • The generated name comes from shadow-cljs's manifest.edn file (in resources/public/great_dalmuti/js/manifest.edn), produced by clj -X:build:prod build-client. Watch out: this shadow-cljs compilation manifest is not the same manifest as electric-manifest.edn!
  • Notice that src/great_dalmuti/server_jetty.clj -> wrap-index-page reads :manifest-path from config. The config comes from src-prod/prod.cljc.

tree-king's People

Contributors

dustingetz avatar ggeoffrey avatar donyorm avatar xificurc avatar nottmey avatar cj-price avatar elken avatar filipesilva avatar noonian avatar mf-kimo avatar vollcheck avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.