Fever CLI Quickstart

Learn by deploying a real DeFi lending system. From simple ERC20 tokens to complex Diamond Proxy architectures.

15-20 minutes
Beginner to Advanced

What You'll Learn

By the end of this tutorial, you will:
  • Install and authenticate with Fever CLI
  • Set up a project and connect it to the platform
  • Compile Solidity smart contracts
  • Launch a local blockchain for testing
  • Deploy a StableCoin ERC20 token
  • Track your deployments on the Fever platform
Prerequisites
  • • Node.js v18 or higher
  • • Git installed on your machine
  • • A GitHub or Google account (for platform authentication)

1Install Fever CLI

Install the Fever CLI globally using npm:

npm install -g @fevertokens/cli

Verify the installation:

fever --version

You should see the version number displayed (e.g., v2.0.0).


2Clone the Example Project

We'll use the MicroLoan packages repository as our example project:

git clone https://github.com/FeverTokens/microloan-packages.git
cd microloan-packages

This project contains:

  • StableCoin Contract - A minimal ERC20 token for testing
  • Diamond Proxy System - Upgradeable smart contract architecture
  • Deployment Manifests - Pre-configured YAML files for easy deployment

3Authenticate with Fever Platform

The Fever CLI integrates with the Fever web platform to track your deployments, contracts, and artifacts. Let's authenticate:

fever auth login
What happens next:
  1. A browser window will open with a device code
  2. Choose to sign in with Google or GitHub
  3. Authorize the Fever CLI application
  4. Return to your terminal - you're authenticated!

You can verify your authentication status anytime:

fever auth status

4Create a Project

Projects help you organize your contracts and deployments on the platform. Create a new project for this tutorial:

bash
fever projects create --name "MicroLoan"

The CLI will automatically select this project for you. You can view your current project selection anytime:

fever projects

Pro Tip: Use fever projects select to switch between projects interactively.


5Install Dependencies

Install the project's Node.js dependencies:

npm install

This installs the necessary Solidity compiler and other development tools.


6Compile Contracts

Now let's compile all the smart contracts in the project:

fever compile --all
What happens:
  • Auto-detects Solidity version from pragma statements
  • Compiles all contracts in the contracts/ directory
  • Generates artifacts (ABI, bytecode) in .fever/ directory with a separate directory per contract
  • Generates .fever/combined.json with formatted function selectors for Diamond proxy support

You should see output like:

Info: Compiling all contracts in contracts
Info: Compiling all contracts with Solidity 0.8.26
Info: Compiling all contracts in a single pass...
....
Info: Processed contract: StableCoin
Info: Processed contract: LoanRegistry
Success: Successfully compiled 170 contracts
Info: Generated combined artifact: .fever/combined.json
Info: Contract categories: 47 deployables, 112 interfaces, 6 external dependencies

7Sync Artifacts to Platform

After compiling your contracts, sync the artifacts to the Fever CLI platform for deployment tracking and management:

fever artifacts sync
What happens:
  • Detects changes in compiled artifacts using smart hashing
  • Uploads only modified contracts (70-90% bandwidth savings)
  • Updates platform with latest ABIs and bytecode

Check sync status anytime:

fever artifacts status

8Understanding the StableCoin Contract

Let's examine the contract we'll deploy. The StableCoin contract is located at contracts/StableCoin.sol:

solidity
/// @title StableCoin
/// @notice Minimal ERC20-like token for testing microloan flows.
/// @dev Implements IERC20 with simple owner-controlled minting.
contract StableCoin is IERC20 {
    string public name;
    string public symbol;
    uint8 public immutable decimals;
    uint256 public override totalSupply;
    
    // ... ERC20 standard mappings

    address public owner;

    /// @notice Set token metadata and initial owner
    /// @param name_ Token name
    /// @param symbol_ Token symbol
    /// @param decimals_ Token decimals (e.g., 18 or 6)
    constructor(string memory name_, string memory symbol_, uint8 decimals_) {
        name = name_;
        symbol = symbol_;
        decimals = decimals_;
        owner = msg.sender;
    }
        
    /// @notice Mint new tokens to an account
    /// @param to Recipient address
    /// @param amount Amount to mint
    function mint(address to, uint256 amount) external onlyOwner {...}
    
    // ... ERC20 standard functions
Key Features:
  • ERC20 token implementation
  • Owner-controlled minting
  • Configurable decimals (6 for USDC-like behavior)

9Review the Deployment Manifest

The deployment configuration is defined in f9s/erc20-config.yaml. Let's examine it:

yaml
apiVersion: beta/v1
kind: Deployment

metadata:
  name: stablecoin-contract
  version: 1.0.0

spec:
  deployer:
    wallet:
      type: privateKey
      value: '${PRIVATE_KEY}'
    gasSettings:
      gasLimit: 3000000

  package:
    name: StableCoin

  constructorArgs:
    - name: 'name_'
      type: 'string'
      value: 'MockUSDC'
    - name: 'symbol_'
      type: 'string'
      value: 'mUSDC'
    - name: 'decimals_'
      type: 'uint8'
      value: 6

  network:
    chainId: '${CHAIN_ID}'
    rpcUrl: '${RPC_URL}'
What this manifest does:
  • Defines the contract to deploy (StableCoin)
  • Uses environment variables for sensitive data (${PRIVATE_KEY})
  • Sets constructor arguments (name: "MockUSDC", symbol: "mUSDC", decimals: 6)
  • Configures network settings (chain ID and RPC URL)

10Launch a Local Blockchain

Before deploying, we need a blockchain to deploy to. Fever CLI includes a built-in local blockchain using Anvil (from Foundry):

fever node
What you'll see:
Starting Fever Local Blockchain...

 Using tool: anvil
 Chain ID: 1337
 Accounts: 10

 Network Information:
   Local:     http://127.0.0.1:8545
   Network:   http://localhost:8545
   JSON-RPC:  http://localhost:8545

Alternative: You can also use hardhat node or any other local blockchain. Fever node uses Anvil under the hood for blazing-fast performance.

Keep this terminal open! Open a new terminal for the next steps.


11Configure Environment Variables

Create a .env file in the project root with the following command:

bash
cat > .env << 'EOF'
CHAIN_ID=1337
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
RPC_URL=http://localhost:8545
EOF
About this configuration:
  • CHAIN_ID: Local network ID (1337 is Anvil's default)
  • PRIVATE_KEY: Anvil's first test account (pre-funded with ETH)
  • RPC_URL: Local blockchain endpoint

Security Note: These are test credentials for local development only. Never use them on mainnet or with real funds!


12Deploy the StableCoin

Now for the exciting part - let's deploy our StableCoin contract!

fever deploy -f f9s/erc20-config.yaml
What happens:
  1. Loads the deployment manifest
  2. Resolves environment variables
  3. Connects to your local blockchain
  4. Deploys the StableCoin contract
  5. Syncs deployment to Fever platform

You should see output like:

Starting deployment from manifest...
Loaded manifest: stablecoin-contract (v1.0.0)
Connected to network (Chain ID: 1337)
Deploying StableCoin...
Deployed StableCoin to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Syncing deployment to platform...
Deployment synced successfully!

Congratulations! You've deployed your first contract with Fever CLI!


13Verify on the Platform

Visit the Fever CLI Platform and sign in with the same account you used for authentication.

You should see:
  • Your "MicroLoan" project
  • The StableCoin deployment
  • Contract address and transaction details
  • ABI and bytecode artifacts

Advanced: Diamond Proxy Deployment

Next Steps: Deploying Complex Systems

The simple Deployment manifest we used works great for single contracts. But what if you need to deploy a sophisticated system with 5-8 interconnected smart contracts?

Real-world challenges:
  • Contracts depend on each other's addresses
  • Need to track deployment order
  • Function routing across multiple contracts
  • Upgradeable architecture using Diamond Proxy pattern

This is exactly what the MicroLoan system demonstrates!

What is a Diamond Proxy?

The Diamond Proxy pattern (EIP-2535) is an upgradeable smart contract architecture that allows you to:

Modular Design

Split functionality across multiple "facet" contracts

Unlimited Size

Bypass the 24KB contract size limit

Upgradeable

Add, replace, or remove functions without redeploying everything

Shared Storage

All facets access the same storage through the diamond proxy

Think of it like this:

  • Diamond = Main entry point (proxy contract)
  • Facets = Specialized contracts with specific functionality
  • Function Selectors = Route calls from diamond to the right facet

The MicroLoan System Architecture

The MicroLoan system is a complete DeFi lending platform with 6 smart contracts:

MicroLoanDiamond (Main Proxy)
    ↓
    ├── PackageViewer        (View storage/configuration)
    ├── PackageController    (Manage system settings)
    ├── LoanRegistry         (Create & track loans)
    ├── LoanFunding          (Fund loan requests)
    ├── LoanRepayment        (Handle installment payments)
    └── LoanTokenManager     (Manage token deposits/withdrawals)

Each contract handles a specific part of the lending workflow while sharing the same storage!

Understanding the Diamond Manifest

The configuration is in f9s/microloan-system-config.yaml:

yaml
apiVersion: beta/v1
kind: Diamond  # ← Different kind: Diamond instead of Deployment

metadata:
  name: microloan-diamond
  version: 1.0.0

spec:
  deployer:
    wallet:
      type: privateKey
      value: '${PRIVATE_KEY}'

  # Step 1: Deploy all dependency contracts first
  dependencies:
    packageViewer:
      name: PackageViewer
    packageController:
      name: PackageController
    loanRegistry:
      name: LoanRegistry
    loanFunding:
      name: LoanFunding
    loanRepayment:
      name: LoanRepayment
    loanTokenManager:
      name: LoanTokenManager

  # Step 2: Deploy the main Diamond proxy
  diamond:
    name: MicroLoanDiamond
    constructorArguments:
      - $dependencies.packageController.address  # ← Reference deployed contracts!
      - $dependencies.packageViewer.address
      - '${ADMIN_ADDRESS}'

  # Step 3: Configure function routing (Diamond Cut)
  packages:
    - name: LoanRegistry
      functions:
        - '0xc19fa698'  # createLoan selector
        - '0x504006ca'  # getLoan selector
      address: $dependencies.loanRegistry.address

    - name: LoanFunding
      functions:
        - '0x846b909a'  # fundLoan selector
      address: $dependencies.loanFunding.address

    - name: LoanRepayment
      functions:
        - '0x84068d15'  # repayNextInstallment selector
      address: $dependencies.loanRepayment.address

    - name: LoanTokenManager
      functions:
        - '0xf7888aec'  # balanceOf selector
        - '0x47e7ef24'  # deposit selector
        - '0xf3fef3a3'  # withdraw selector
      address: $dependencies.loanTokenManager.address

  network:
    chainId: '${CHAIN_ID}'
    rpcUrl: '${RPC_URL}'

How the Diamond Deployment Works

When you run fever compose, here's what happens:

Phase 1: Deploy Dependencies (6 contracts)
Deploying PackageViewer...
   → Address: 0x1234...
Deploying PackageController...
   → Address: 0x5678...
Deploying LoanRegistry...
   → Address: 0x9abc...
Deploying LoanFunding...
   → Address: 0xdef0...
Deploying LoanRepayment...
   → Address: 0x2468...
Deploying LoanTokenManager...
   → Address: 0x1357...
Phase 2: Deploy Diamond with Dependencies
Deploying MicroLoanDiamond...
   Constructor args:
   - packageController: 0x5678...  ← Auto-injected!
   - packageViewer: 0x1234...      ← Auto-injected!
   - admin: 0xYourAdminAddress
   → Diamond Address: 0xABCD...
Phase 3: Diamond Cut (Add Facets)
Executing DiamondCut...
   Adding facet: LoanRegistry (2 functions)
   Adding facet: LoanFunding (1 function)
   Adding facet: LoanRepayment (1 function)
   Adding facet: LoanTokenManager (3 functions)
Diamond configured with 4 facets!
Phase 4: Sync to Platform
Syncing all deployments to platform...
7 contracts synced successfully!

Deploy the MicroLoan System

1. Update your .env file:

bash
cat >> .env << 'EOF'

# Add admin address for the system
ADMIN_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
EOF

2. Run the Diamond deployment:

fever compose -f f9s/microloan-system-config.yaml

3. Watch the magic happen!

You'll see all 7 contracts deployed in the correct order, with addresses automatically cross-referenced.

Comparison: Deployment vs Diamond

FeatureDeployment ManifestDiamond Manifest
Use CaseSingle contractMulti-contract system
ComplexitySimpleAdvanced
Size Limit24KB per contractUnlimited
UpgradeableNoYes (via Diamond Cut)
DependenciesManualAutomatic
Best ForTokens, simple contractsDeFi protocols, DAOs, complex dApps

🐛 Troubleshooting

Issue: "No blockchain tools found"

Solution: Install Anvil (Foundry):

bash
curl -L https://foundry.paradigm.xyz | bash
foundryup
Issue: "Authentication required"

Solution: Login again:

fever auth login --force
Issue: "Contract compilation failed"

Solution: Make sure you ran npm install to get the Solidity compiler.

Issue: "Port 8545 already in use"

Solution: Either stop the existing blockchain or use a different port:

bash
fever node --port 8546
# Update RPC_URL in .env to http://localhost:8546
What You've Learned
  • How to deploy single contracts with Deployment manifests
  • How to deploy complex systems with Diamond manifests
  • Understanding the Diamond Proxy pattern (EIP-2535)
  • Automatic dependency management with $dependencies
  • Function selector routing and Diamond Cut
  • Platform integration for deployment tracking

Welcome to the Fever CLI ecosystem!