Overview
Take a look at some sample dapps below and see the possibilities of building on ICP. All samples and further projects can be found in the samples repo. Additional resources can be found in the awesome DFINITY repo, a curated set of open-source projects and examples from our community.
Hello, world!
The dapp equivalent of 'Hello, World!' with a separate backend and frontend canister serving a web page.
Actor classes
A sample dapp that shows a dynamic actor (class) instantiation.
Actor reference
A simple dapp that shows how to import the IC management canister as an actor reference.
Calculator
This example demonstrates a basic calculator dapp. It uses an orthogonally persistent cell variable to store an arbitrary precision integer that represents the result of the most recent calculation.
Certified variables
This dapp provides a frontend and a backend that shows a simple certified variable (a single 32-bit number), with client-side certificate validation.
Counter
A simple dapp that shows a basic (stable) variable demo.
Basic decentralized autonomous organization (DAO)
This sample dapp showcases decentralized governance. It demonstrates how to initialize a set of accounts and corresponding tokens, how account owners can submit proposals for other account owners to vote on, and how a proposal is executed given enough favorable votes.
Basic decentralized exchange (DEX)
To enable DeFi applications on ICP, canisters need to interact with token canisters and the ledger canister. This example dapp illustrates these interactions by showing how to enable an Exchange to take custody of funds, update an internal balance book as users trade, and give custody back to the user as funds are withdrawn.
Encrypted note-taking dapp
Create, access, modify confidential notes from multiple devices using Internet Identity service and end-to-end encryption. The sample code relies upon the web-serving and storage capabilities of ICP, and highlights two key functionalities:
- Client-side, end-to-end encryption.
- Multi-user and multi-device support.
Echo
This sample dapp gives a basic query function demo.
Factorial
This sample dapp shows a basic factorial demo.
Game of Life
A dapp sample that demonstrates Conway’s Game of Life, running in a Motoko canister. Demonstrates upgrades among three versions and state migration using stable variables.
HTTP counter
The example demonstrates a counter dapp and an HTTP interface. It is essentially an iteration on the counter canister which adds native HTTP interfaces.
Hosting a static website
This tutorial shows how to quickly set up a static website structure, add content and basic styling, and deploy to ICP.
Hosting a web game
The example shows how to deploy a web game on ICP, sample code can be found at samples repo.
Token approve and transfer from
This sample code demonstrates how a canister can be approved to transfer funds on behalf of a user.
ICP transfer
This sample code demonstrates how a canister can hold and transfer ICP tokens.
Token transfer
This sample code demonstrates how a canister can hold and transfer ICRC-1 tokens.
Internet Identity integration
Invoice canister
Minimal counter dapp
The example dapp shows how to build a very basic dapp with both backend and frontend, using Motoko for the backend functionality and plain HTML and JavaScript for the frontend. The dapp is a simple counter, which will increment a counter by clicking a button in the frontend.
NFT minting
This NFT minting dapp showcases how easy it can be to create a user generated NFT and share it. This dapp uses the DIP721 NFT standard.
NFT wallet
This is an NFT wallet example dapp that utilizes minted NFTs from the Rust dip721-nft-container. Among some of its essential features, the wallet can register NFTs, transfer out NFTs and check how many NFTs it contains. This dapp includes a frontend UI for interaction.
- Rust.
Periodic tasks
This example demonstrates different ways of scheduling periodic tasks on the Internet Computer: timers and heartbeats. The example shows the difference between the two, and helps to decide which method suits you the best.
- Rust.
Persistent storage
The example dapp shows how to build a simple dapp in Motoko, which will have persistent storage. The dapp is a simple counter, which will increment a counter, retrieve the counter value and reset the counter value by calling backend functions. The functions are exposed through a Candid interface.
Phone book
This simple dapp is a CRUD-like demo service for storing pieces of related information, such as names and phone numbers.
Point of sale (POS)
This app demonstrates a real world use case for ckBTC on the Internet Computer. It is a simple point of sale app that allows users to charge customers using ckBTC. It also demonstrates the HTTPS outcall functionality by sending notifications to users when a payment is received.
PubSub
This sample shows multiple canisters, with publisher-subscriber inter-canister calls.
Quicksort
This example shows how to sort an array, via quicksort, in Motoko.
QR code generator
This example shows that an Internet Computer dapp can perform a long-running computation, like image processing, in a single message execution which is possible due to a unique feature called Deterministic Time Slicing (DTS) that automatically divides long computations into smaller slices executed across multiple blocks.
- Rust.
Random maze
This sample shows how to create a simple frontend in JavaScript where the previous samples did not provide a frontend, this sample provides both a frontend and a backend. It creates a random maze generation, with ICP-based randomness.
Sending and receiving cycles
This sample dapp illustrates how to receive and transfer cycles and check a balance.
Simple to-do
This sample is a CRUD-like demo service, sans a front end; see also: phone book and superheroes.
Superheros
This example is a simple CRUD dapp.
Who am I?
This dapp is a simple canister that reports the Principal of its caller.
Explore further samples in Motoko
This is a collection of repo-links to additional code samples written in Motoko. Most are also available in the Motoko playground. The playground provides the simplest environment for trying out pure Motoko samples without having to download and learn to use the SDK, but does not support dapps with frontends.
Full stack
These samples demonstrate how to build dapps on ICP, with frontends based on React and TypeScript.
- Auth client demo is a simple authentication with Internet Identity.
- IC-avatar is a full-stack Motoko + React with more advanced authentication, image uploads, and optimistic updates.
Advanced
Large samples contributed by the community and not necessarily up-to-date:
Certified asset canister and forum post demonstrates a larger application of Internet Computer certified variables.
IC Vault demonstrates end-to-end content encryption.
QR code generator with accompanying Medium article.
Video guides for building dapps
These videos from the community conversations series cover an introduction to building dapps in Rust, and best practices for building dapps in Rust.
Community conversations | overview of building a dapp in Rust.
Community conversations | best practices for canisters in Rust.
Additional useful video series can be found at coding with Kyle.