Getting Started

To compile and run the program, use:

Getting Started — React + ICP (Rust) Project

This project combines a React frontend with a Rust-based Internet Computer (ICP) backend using the DFX SDK. Below are the steps to set up, build, and run the project locally.


1️⃣ Prerequisites

Make sure you have the following installed:

  • Node.js (v16+ recommended) or Yarn

  • Rust and Cargo

  • DFX SDK (Internet Computer SDK)

  • Git

  • Ollama (for AI integration, if applicable)


2️⃣ Installation & Setup

2.1 Clone the repository

git clone https://github.com/CoFi-Xyntra/copilot-finance.git
cd copilot-finance

2.2 Install DFX

If you don’t have DFX installed yet:

sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

Verify the installation:

dfx --version

2.3 Install Rust & Cargo

If you don’t have Rust installed:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Load Rust environment variables:

source ~/.cargo/env

Add the WebAssembly target:

rustup target add wasm32-unknown-unknown

Check Cargo version:

cargo --version

3️⃣ Project Structure Overview

After cloning, check the project structure:

ls -la

Make sure the following files/folders exist:

  • dfx.json → DFX configuration file

  • package.json → Frontend dependencies

  • src/ → Rust backend code

  • frontend/ or similar → React frontend source code


4️⃣ Install Dependencies

4.1 Rust dependencies (optional, if required by backend)

rustup target add wasm32-unknown-unknown

4.2 Frontend dependencies

Using npm:

npm install

Or using yarn:

yarn install

5️⃣ Running the Project

5.1 Start the local Internet Computer replica

dfx start --background

5.2 Deploy backend canisters

dfx deploy

(Optional for testing playground mode):

dfx deploy --playground

5.3 Start the frontend development server

npm start

Or:

npm run dev

(depending on your package.json setup)


6️⃣ Additional Commands

Stop the local DFX replica:

dfx stop

Manually create canisters:

dfx canister create backend
dfx canister create frontend

Build the project:

dfx build

7️⃣ Installing Candid Extractor

The Candid Extractor tool can be useful for extracting Candid interface definitions from Rust canisters:

cargo install candid-extractor

Terminal 1 — Build & Start replica:

dfx build
dfx start

Terminal 2 — Deploy canisters:

dfx deploy

Or for playground:

dfx deploy --playground

Terminal 3 — Start frontend:

npm start

9️⃣ Ollama + DeepSeek Integration

This project also integrates Ollama with DeepSeek for AI-powered features.

9.1 Install Ollama

Follow installation instructions from https://ollama.ai.

9.2 Pull the DeepSeek model

ollama pull deepseek

9.3 Running DeepSeek locally

ollama run deepseek

Last updated