Skip to main content

CRUD example

View this sample's code on GitHub

Overview

This example demonstrates how to build a CRUD application on ICP using Motoko and React.

This is a Motoko example that does not currently have a Rust variant.

Prerequisites

This example requires an installation of:

  • Install the IC SDK.
  • Clone the example dapp project: git clone https://github.com/dfinity/examples

Begin by opening a terminal window.

Step 1: Navigate into the folder containing the project's files and start a local instance of the replica with the command:

cd examples/motoko/superheros
dfx start --background

Step 2: Build the frontend of the application:

npm install

Step 3: Deploy the canister:

dfx deploy

Step 4: Take note of the URL at which the canister is accessible.

echo "http://127.0.0.1:4943/?canisterId=$(dfx canister id www)"

Step 5: Open the aforementioned URL in your web browser.

Security considerations and best practices

If you base your application on this example, we recommend you familiarize yourself with and adhere to the security best practices for developing on the Internet Computer. This example may not implement all the best practices.

For example, the following aspects are particularly relevant for this app: