npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

create-fhevm-nextjs

v1.5.9

Published

Create a NextJS app with FHEVM SDK integration

Readme

create-fhevm-nextjs

A CLI to create a Next.js app with FHEVM SDK integration.

✨ Updated for FHEVM 0.9.1: This package now uses FHEVM 0.9.1 with the new self-relaying decryption pattern, decryptMultipleHandles support, ZamaEthereumConfig, FHE.checkSignatures, and updated contract addresses on Sepolia testnet.

Usage

npx create-fhevm-nextjs my-app
cd my-app
npm install
npm run dev

Environment Setup

Before deploying contracts, you need to set up your environment variables:

1. Create a .env file in the hardhat directory:

cd hardhat
touch .env

2. Add your environment variables to .env:

# Your wallet mnemonic (12 or 24 words)
MNEMONIC=your wallet mnemonic phrase here

# Your Infura API key (get one at https://infura.io)
INFURA_API_KEY=your_infura_api_key_here

# Optional: Etherscan API key for contract verification
ETHERSCAN_API_KEY=your_etherscan_api_key_here

3. Get your Infura API key:

  • Visit https://infura.io
  • Sign up for a free account
  • Create a new project
  • Copy your project API key

4. Deploy your contracts:

# Deploy to Sepolia testnet
npm run deploy:sepolia

What you get

  • Complete React application with FHEVM SDK integration
  • Bundled FHEVM SDK (no external dependencies)
  • Beautiful Zama-branded UI
  • TypeScript support
  • Tailwind CSS styling
  • Working FHEVM operations (encryption, decryption, contract interactions)
  • Three Complete FHE Contracts for testing on Sepolia testnet:
    • FHECounter: Encrypted counter with increment/decrement
    • ReviewCardsFHE: Encrypted rating system with public decryption
    • SimpleVoting: Encrypted voting system with tally reveal
  • Public decryption demo with hardcoded ciphertexts
  • Ready-to-use React hooks
  • Complete Hardhat development environment with:
    • All three FHE smart contracts
    • Deployment scripts for Sepolia testnet
    • Contract testing utilities
    • TypeScript support for contracts
  • Universal FHEVM SDK (FHEVM 0.9.1) with utilities for:
    • FHEVM initialization
    • Encrypted inputs creation
    • User decryption with EIP-712 signing
    • Public decryption flows
    • decryptMultipleHandles for batch decryption with proofs
    • Self-relaying decryption pattern for contract callbacks

Deployed FHE Contracts (FHEVM 0.9.1)

The generated app includes pre-deployed FHE Contracts on Sepolia testnet for testing:

  • FHECounter Contract: 0x7A14b454D19A4CB4c55E0386d04Eb0B66e6717EC (FHEVM 0.9.1)
  • ReviewCardsFHE Contract: 0xf80A030984a0AB6111B6e60973A6c16C668ede7a (FHEVM 0.9.1)
  • SimpleVoting Contract: 0x4189777Eb42f68Ce959E498a171e328BfDA90C46 (FHEVM 0.9.1)
  • Network: Sepolia testnet (Chain ID: 11155111)
  • Features:
    • Get encrypted count from contract
    • Increment/decrement with encrypted inputs
    • User decryption with EIP-712 signing
    • Public decryption with decryptMultipleHandles
    • Self-relaying decryption pattern for voting tallies

Features

  • Self-contained: No need to install FHEVM SDK separately
  • Cross-platform: Works on Windows, Mac, Linux
  • Zero configuration: Works out of the box
  • Production ready: Includes all necessary files and configurations
  • Beautiful UI: Zama design system with Tailwind CSS
  • Real FHEVM operations: Actual encryption/decryption functionality
  • Live contract: Pre-deployed FHE counter for immediate testing
  • Complete development environment: Includes Hardhat for smart contract development

Smart Contract Development

The generated app includes a complete Hardhat development environment with all necessary files for FHEVM smart contract development:

📁 Hardhat Directory Structure:

hardhat/
├── contracts/
│   ├── FHECounter.sol          # FHE Counter smart contract
│   ├── ReviewCardsFHE_uint32.sol # FHE Rating system contract
│   └── SimpleVoting_uint32.sol  # FHE Voting system contract
├── deploy/
│   └── deploy.ts              # Deployment script for all contracts
├── hardhat.config.js          # Hardhat configuration (JavaScript)
├── package.json               # Hardhat dependencies
└── tsconfig.json             # TypeScript configuration

🔧 Available Commands:

# Navigate to the hardhat directory
cd hardhat

# Install dependencies
npm install

# Compile contracts
npm run compile

# Start local hardhat node
npm run chain

# Deploy to hardhat network
npm run deploy:hardhat

# Deploy to Sepolia testnet (requires INFURA_API_KEY)
npm run deploy:sepolia

📋 What's Included:

  • FHE Counter Contract - Complete Solidity smart contract
  • Deployment Scripts - Ready-to-use deployment scripts
  • TypeScript Support - Full type safety for contracts
  • Network Configuration - Pre-configured for hardhat and sepolia
  • FHEVM Integration - Built-in FHEVM contract support
  • Simplified Scripts - Clean, focused deployment commands
  • JavaScript Config - No TypeScript compilation issues

Requirements

  • Node.js 16 or higher
  • npm or yarn

License

MIT