icp_template Svelte Themes

Icp_template

A template I use to build dApps with Svelte.

ICP Rust + Svelte Template

Production-ready template for building decentralized applications on the Internet Computer.

Stack

  • Backend: Rust canister with stable memory (ic-stable-structures)
  • Frontend: SvelteKit + TypeScript
  • ICP SDK: dfx for deployment and canister management

Features

✅ Stable storage (persists across upgrades)
✅ Memory manager with auto-incrementing IDs
✅ Principal-based authentication
✅ Full CRUD operations example
✅ Auto-generated TypeScript bindings from Candid
✅ Modular code architecture

Prerequisites

Do you already have Conda?:

# Verify
conda --version

Download Miniconda3 on WSL:

# Download Miniconda installer
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

# Run installer
bash Miniconda3-latest-Linux-x86_64.sh

# Follow prompts, say 'yes' to init conda

# Reload shell
source ~/.bashrc

# Verify
conda --version

# Clean up installer
rm Miniconda3-latest-Linux-x86_64.sh

# Accept ToS
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r

Do you already have dfx & Rust?:

# Verify
dfx --version
cargo --version

Download dfx and Rust on WSL:

# Install dfx & Rust
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Set-up your project:

conda create -n icp_project_name python nodejs -y
conda activate icp_project_name

# Install wasm target
rustup target add wasm32-unknown-unknown

# candid-extractor
cargo install candid-extractor

# Python dependencies (for __mgr__.py)
pip install -r requirements.txt

Quick Start

# 1. Activate env and navigate to root
# 2. Install dependencies
# 3. Stop and start replica
# 4. Start frontend dev server for hot reloading
conda activate env4C && cd 4C-User-Account
npm install && cd frontend && npm install && cd ..
dfx stop && dfx start --background --clean && dfx deploy
cd frontend && npm run dev && cd ..

# Frontend URL will be shown in terminal:
# http://[canister-id].localhost:4943/

# Quick deploy all canisters
python __mgr__.py -qd

# If PocketIC state directory is corrupted
dfx killall && rm -rf ~/.local/share/dfx/pocket-ic
rm -rf ~/.cache/dfinity/versions/0.29.0/pocket-ic
rm -rf ~/.cache/dfinity/ && rm -rf .dfx/
rm -rf ~/.local/share/dfx/pocket-ic

# Deploy Internet Identity
cd vendor/internet-identity
dfx deploy internet_identity --no-wallet --argument '(null)' && cd ../.. 

Development Commands

# Activate environment
conda activate env4C
python __mgr__.py -t     # Display project tree
python __mgr__.py -c     # Clean build artifacts
python __mgr__.py -bb    # Build backend only
python __mgr__.py -fb    # Build frontend only
python __mgr__.py -fd    # Fresh deploy (stops current)
python __mgr__.py -qd    # Quick deploy (overwrites)
# Full rebuild (recommended after any changes)
python __mgr__.py -rb

Top categories

Loading Svelte Themes