GithubHelp home page GithubHelp logo

dat's Introduction

License

dat (Digital Asset Tokens social network)

This Daml application allows users to mint NFT-like "Tokens" and post them to their social network for their followers to take. Users have complete control over who follows them. The Daml code guarantees that a Token was authored by the author party (though no guarantees are made about the underlying URL ๐Ÿ˜‰).

Daml

See documentation for details.

Please ask for help on the Daml forum if you encounter any issue!

Development Quick Start

You need to have Node.js and Daml installed.

First, start the Daml components:

daml start

This will:

  • Build you Daml code once.
  • Generate JavaScript code (and TypeScript definitions) for your Daml types.
  • Start a Daml sandbox gRPC server (on 6865).
  • Start a Daml HTTP JSON API server (on 7575).
  • Watch for the r key press (r + Enter on Windows); when pressed, rebuild all of the Daml code, push the new DAR to the ledger, and rerun the JS/TS code generation.

Next, start the JS dev server:

cd ui
npm install
npm start

This starts a server on http://localhost:3000 which:

  • Builds all of your TypeScript (or JavaScript) code (including type definitions from the codegen).
  • Serves the result on :3000, redirecting /v1 to the JSON API server (on localhost:7575) so API calls are on the same origin as far as your browser is concerned.
  • Watch for changes in TS/JS code (including codegen), and immediately rebuild.

Deploying to Daml Hub

To build everything from scratch:

daml build
daml codegen js .daml/dist/dat-0.1.0.dar -o ui/daml.js
cd ui
npm install
npm run-script build
zip -r ../dat-ui.zip build

Next you need to create a ledger on Daml Hub, upload the files .daml/dist/dat-0.1.0.dar (created by the daml build command) and dat-ui.zip (created by the zip command based on the result of npm run-script build).

Once both files are uploaded, you need to tell Daml Hub to deploy them. A few seconds later, your website should be up and running.

Auth0 Authentication

This template comes with out-of-the-box support for Auth0 authentication. You can still test your app locally with no authentication, using the default configuration. You can run just the UI server locally, against a deployed, authenticated JSON API server running on a remote host, by starting the development server with:

REACT_APP_AUTH=auth0 \
REACT_APP_AUTH0_DOMAIN=$YOUR_AUTH0_DOMAIN \
REACT_APP_AUTH0_CLIENT_ID=$YOUR_AUTH0_CLIENT_ID \
REACT_APP_HTTP_JSON=$JSON_API_ADDRESS \
npm start

where:

  • REACT_APP_AUTH explicitly activates the Auth0 login screen.
  • REACT_APP_AUTH0_DOMAIN is the domain corresponding to your Auth0 tenant. You can find it as the Domain field on the Settings tab of your Auth0 application.
  • REACT_APP_AUTH0_CLIENT_ID is the Client ID of your Auth0 "single page applications" application.
  • REACT_APP_HTTP_JSON is the base URL of the JSON API, including scheme (always) and port (if different from default: 80 for http and 443 for https).

For this setup to work, you need a properly setup Auth0 tenant where localhost:3000 is listed as a valid callback URL in the application settings.

To build your application with Auth0 enabled, run:

REACT_APP_AUTH=auth0 \
REACT_APP_AUTH0_DOMAIN=$YOUR_AUTH0_DOMAIN \
REACT_APP_AUTH0_CLIENT_ID=$YOUR_AUTH0_CLIENT_ID \
npm start

dat's People

Watchers

 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.