Algokit Examples Gallery

React Vite Basic

Codespace Visit Demo

Creator Algorand Foundation

Source

react

vite

frontend

typescript

Install with AlgoKit CLI

    algokit init example react-vite-basic

A baseline React web app for integrating with any ARC56 compliant Algorand smart contracts.

Features

React Vite Typescript Example

This starter React project has been generated using AlgoKit. See below for default getting started instructions.

Setup

Initial Setup

1. Clone the Repository

Start by cloning this repository to your local machine.

2. Install Pre-requisites

Ensure the following pre-requisites are installed and properly configured:

3. Bootstrap Your Local Environment

Run the following commands within the project folder:

Development Workflow

Terminal

Directly manage and interact with your project using AlgoKit commands:

  1. Build Contracts: algokit project run build builds react web app and links with smart contracts in workspace, if any.
  2. Remaining set of command for linting, testing and deployment can be found in respective package.json file and .algokit.toml files.

VS Code

For a seamless experience with breakpoint debugging and other features:

  1. Open Project: In VS Code, open the repository root.
  2. Install Extensions: Follow prompts to install recommended extensions.
  3. Debugging:

Other IDEs

While primarily optimized for VS Code, Jetbrains WebStorm has base support for this project:

  1. Open Project: In your JetBrains IDE, open the repository root.
  2. Automatic Setup: The IDE should configure the Python interpreter and virtual environment.
  3. Debugging: Use Shift+F10 or Ctrl+R to start debugging. Note: Windows users may encounter issues with pre-launch tasks due to a known bug. See JetBrains forums for workarounds.

AlgoKit Workspaces and Project Management

This project supports both standalone and monorepo setups through AlgoKit workspaces. Leverage algokit project run commands for efficient monorepo project orchestration and management across multiple projects within a workspace.

Please note, by default frontend is preconfigured to run against Algorand LocalNet. If you want to run against TestNet or MainNet, comment out the current environment variable and uncomment the relevant one in .env file that is created after running bootstrap command and based on .env.template.

Algorand Wallet integrations

The template comes with use-wallet integration, which provides a React hook for connecting to Algorand wallet providers. The following wallet providers are included by default:

Refer to official use-wallet documentation for detailed guidelines on how to integrate with other wallet providers (such as WalletConnect v2). To see implementation details of the use wallet hook and initialization of extra wallet providers refer to App.tsx.

Tools

This project makes use of React and Tailwind to provide a base project configuration to develop frontends for your Algorand dApps and interactions with smart contracts. The following tools are in use:

Integrating with smart contracts and application clients

Refer to the detailed guidance on integrating with smart contracts and application clients. In essence, for any smart contract codebase generated with AlgoKit or other tools that produce compile contracts into ARC34 compliant app specifications, you can use the algokit generate command to generate TypeScript or Python typed client. Once generated simply drag and drop the generated client into ./src/contracts and import it into your React components as you see fit.