Skip to content

A template to get started with developing full-stack DAML applications

License

Notifications You must be signed in to change notification settings

garyverhaegen-da/create-daml-app

 
 

Repository files navigation

DISCLAIMER: This work in progress!

DAML logo

Download License

Welcome to Create DAML App

This repository contains a template to get started with developing full-stack DAML applications. The demo application covers the following aspects:

  1. A DAML model (of a simplistic social network)
  2. Automation using DAML triggers
  3. A UI written in TypeScript

The application showcases a variety of experimental DAML SDK features such as DAML triggers and the HTTP JSON API service.

The UI is developed using React, Semantic UI and its official React integration. The whole project was bootstrapped with Create React App. Regardless of these choices, all DAML specific aspects of the UI client are written in plain TypeScript and the UI framework should hence be easily replacable.

Getting started

Before you can run the application, you need to install the DAML SDK and a package manager for JavaScript. For the development of this project we have used yarn, but others might work equally well.

First, you need to obtain a copy of this project, either by clicking the "Use this template" button above or by cloning this repository directly via

git clone https://github.com/hurryabit/create-daml-app.git

Once you have copy of this project, you need to install its dependencies by calling

yarn install

at the root of the repository.

To start the application, first start a DAML ledger using

./daml-start.sh

After this, start the UI server via

yarn start

This should open a browser window with a login screen. If it doesn't, you can manually point your browser to http://localhost:3000.

A quick tour

You can log into the app by providing a user name, say Alice, clicking on the calculator icon to generate an access token for the DAML ledger, and finally clicking on "Sign up". You will be greeted by a screen indicating that you don't have any friends yet. You can change this by adding a friend in the upper box, say Bob. Both boxes on the screen then reflect the fact that you consider Bob a friend. After that, let's log out in the top right corner and sign up as Bob.

As Bob, we can see that we don't have any friends yet and that Alice considers us a friend nevertheless. We can make Alice a friend by clicking the plus symbol to the right of here name.

Using the automation

If you are a very popular and friendly person who is considered a friend by many other people and wants to reciprocate that friendship in the application, adding all these other people as friends can become quite tedious. That is where the automation with DAML triggers mentions above becomes handy. To fire up the trigger, we need to execute

./daml-trigger.sh Alice

at the root of the repository.

To see the automation in action, we need to sign up as a new person, say Charlie and add Alice as our friend. If we log out and then log in as Alice again, we will see that we reciprocate Charlie's friendship and consider him our friend too. We didn't have to do anything to get there, our DAML trigger has done that for us.

Next steps

There are many directions in which this application can be extended. Regardless of which direction you pick, the following files will be the most interesting ones to familiarize yourself with:

Useful resources

TBD

How to get help

TBD

About

A template to get started with developing full-stack DAML applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.9%
  • Haskell 2.1%
  • HTML 1.8%
  • Dockerfile 1.0%
  • JavaScript 1.0%
  • Shell 0.8%
  • CSS 0.4%