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

@the-better-collective/hardhat-template

v2.0.4

Published

A comprehensive Hardhat template with TypeScript, multi-network deployment, example contracts, and complete testing setup for VeChain development

Readme

TBC Hardhat Template Creator

A comprehensive CLI tool for creating new Hardhat projects with The Better Collective's (TBC) template. This tool quickly sets up a complete VeChain development environment with TypeScript, multi-network deployment, example contracts, and comprehensive testing.

✨ Features

  • 🚀 Quick project initialization with customizable settings
  • 📦 Complete TypeScript setup with proper configurations
  • 🌐 Multi-network deployment (Local, Testnet, Mainnet)
  • 📝 Example smart contract with comprehensive tests
  • 🔧 Environment management with detailed .env.example
  • 🧪 Full testing suite with coverage reports
  • 📚 OpenZeppelin integration for secure development
  • 🎯 VeChain-optimized configurations and scripts
  • 📖 Comprehensive documentation and usage examples

Quick Start

Using npx (Recommended)

  1. Create a new project:
npx @the-better-collective/hardhat-template <project-name>
  1. The tool will automatically:
    • Create a new directory with your project name
    • Copy all template files to the new project
    • Update package.json with your project details
    • Create a .env file from the template

Example Usage

# Create a new project called "my-vechain-dapp"
npx @the-better-collective/hardhat-template my-vechain-dapp

# Create a project with spaces (will be normalized to kebab-case)
npx @the-better-collective/hardhat-template "My VeChain DApp"

Post-Setup Steps

  1. Navigate to your project directory:
cd your-project-name
  1. Install dependencies:
npm install
# or
yarn install
  1. Set up environment variables:
# The .env file is already created, just update it with your settings
# Edit .env with your mnemonic and other settings
  1. Start developing:
# Compile contracts
npm run compile

# Run tests
npm run test

# Deploy to local network
npm run deploy:local

# Deploy to testnet
npm run deploy:testnet

📁 Project Structure

The template includes a complete, production-ready structure:

your-project/
├── contracts/                    # Smart contracts
│   ├── SimpleStorage.sol         # Example contract with comprehensive features
│   ├── openzeppelin/             # OpenZeppelin contracts library
│   └── openzeppelin-upgradeable/ # Upgradeable contracts
├── scripts/                      # Deployment and utility scripts
│   ├── init/
│   │   └── deploy.ts             # Multi-network deployment script
│   └── utils/                    # Deployment utilities
├── test/                         # Comprehensive test suite
│   └── SimpleStorage.test.ts     # Example contract tests
├── hardhat.config.ts             # VeChain-optimized Hardhat config
├── tsconfig.json                 # TypeScript configuration
├── package.json                  # Scripts and dependencies
├── .env                          # Environment variables (auto-created)
├── .env.example                  # Environment variables template
└── README.md                     # Detailed project documentation

⚙️ Configuration

Hardhat Configuration

The template includes a VeChain-optimized hardhat.config.ts with:

  • TypeScript support with proper type generation
  • Multi-network configurations (Local, Testnet, Mainnet)
  • VeChain SDK integration for native VeChain development
  • Gas optimization and compiler settings
  • OpenZeppelin upgrades plugin support

Environment Variables

The env.example template includes:

  • MNEMONIC: 12-word mnemonic phrase for wallet derivation
  • Optional custom RPC endpoints
  • Development and debugging settings
  • Security guidelines and examples

Pre-configured Networks

  • hardhat: Local development network
  • vechain_testnet: VeChain Thor Testnet
  • vechain_mainnet: VeChain Thor Mainnet

🛠 Available Scripts

Development

  • npm run compile: Compile smart contracts
  • npm run test: Run comprehensive test suite
  • npm run coverage: Generate test coverage reports
  • npm run clean: Clean artifacts and generated types

Deployment

  • npm run deploy:local: Deploy to local Hardhat network
  • npm run deploy:testnet: Deploy to VeChain Testnet
  • npm run deploy:mainnet: Deploy to VeChain Mainnet

Network Interaction

  • npm run node: Start local Hardhat node
  • npm run console:local: Interactive console (local)
  • npm run console:testnet: Interactive console (testnet)
  • npm run console:mainnet: Interactive console (mainnet)

📝 Example Contract: SimpleStorage

The template includes a comprehensive SimpleStorage contract that demonstrates:

  • State management with private and public variables
  • Access control using OpenZeppelin's Ownable
  • Events for transparency and off-chain monitoring
  • Mappings for user-specific data storage
  • Multiple function types (external, view, owner-only)
  • Constructor parameters for initialization
  • NatSpec documentation for professional code quality

Contract Features

// Store and retrieve values
function storeValue(uint256 _value) external
function getStoredValue() external view returns (uint256)

// Owner-only message management
function updateMessage(string memory _newMessage) external onlyOwner

// User-specific value tracking
function getUserValue(address _user) external view returns (uint256)

// Comprehensive contract information
function getContractInfo() external view returns (uint256, string memory, address)

🧪 Testing

The template includes a comprehensive test suite with:

  • 143 lines of tests covering all contract functionality
  • Event emission testing for proper event handling
  • Access control testing for security validation
  • Multiple user scenarios for real-world usage
  • Edge cases and error conditions for robustness
  • TypeScript support with proper type checking

🆕 What's New in v2.0

  • Multi-network deployment with safety warnings
  • Complete example contract with comprehensive tests
  • TypeScript configuration for better development experience
  • Enhanced documentation with step-by-step guides
  • Network-specific scripts for easy deployment
  • Interactive console support for all networks
  • Environment template with security guidelines
  • Production-ready project structure

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 About The Better Collective (TBC)

The Better Collective is a team of blockchain developers specializing in building secure and scalable smart contract solutions. We focus on creating tools and templates that make blockchain development more accessible and efficient.

📦 Version History

  • v2.0.0: Complete overhaul with multi-network deployment, example contracts, comprehensive testing, and enhanced documentation
  • v1.0.x: Initial release with basic Hardhat template

🛟 Support

  • 📚 Check the generated project's README for detailed usage instructions
  • 🐛 Report issues on GitHub
  • 💬 Join our community discussions
  • 📧 Contact us for enterprise support

🙏 Acknowledgments

  • Hardhat for the excellent development framework
  • OpenZeppelin for secure smart contract standards
  • VeChain for the blockchain platform and tooling
  • The blockchain development community for inspiration and feedback