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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@consensys/create-web3-template

v1.5.7

Published

This is a CLI tool that scaffolds Next.js and React projects with a focus on Web3 development.

Downloads

122

Readme

Create Web3 Template CLI

This is a CLI tool that scaffolds Next.js and React projects with a focus on Web3 development.

Features

  • Framework Options: Choose between Next.js and React with Vite for your frontend application.
  • Blockchain Tooling: Select either Hardhat or Foundry for smart contract development.
  • Package Manager Choice: Use your preferred package manager: npm, yarn, or pnpm.
  • TypeScript Support: Write strongly-typed code with built-in TypeScript support.
  • Tailwind CSS: Style your application with utility-first CSS.
  • Viem and Wagmi: Integrate with Ethereum using Viem and Wagmi libraries.
  • Monorepo Setup: Organize your frontend and smart contracts in a monorepo structure.

Getting Started

Installation

To create a new project using the Web3 Template CLI, run one of the following commands:

Using pnpm:

pnpm create @consensys/create-web3-template [project-name]

Using npx:

npx @consensys/create-web3-template [project-name]

Interactive Setup

After running the command, the CLI will guide you through the setup process with the following prompts:

  1. Project Name: Specify a name for your project if not provided in the command.
  2. Framework Selection: Choose between Next.js and React (Vite).
  3. Blockchain Tooling: Select Hardhat or Foundry for smart contract development.
  4. Package Manager: Choose your preferred package manager: npm, yarn, or pnpm.

Example

npx @consensys/create-web3-template my-web3-project

Project Structure

The generated project will have the following structure:

my-web3-project/
├── packages/
│   ├── blockchain/    # Smart contracts and blockchain tooling
│   └── site/          # Frontend application (Next.js or React)
├── pnpm-workspace.yaml (if using pnpm)
├── package.json
└── .gitignore
  • packages/blockchain: Contains your smart contracts and related tooling.
  • packages/site: Contains your frontend application.

Installing Dependencies

Navigate to your project directory and install the dependencies:

cd my-web3-project

# If you chose pnpm
pnpm install

# If you chose npm
npm install

# If you chose yarn
yarn install

Running the Application

Backend (Smart Contracts)

Navigate to the blockchain package to work on your smart contracts.

cd packages/blockchain
  • Hardhat Users: Refer to the Hardhat documentation for commands to compile, test, and deploy your contracts.
  • Foundry Users: Refer to the Foundry Book for instructions on using Foundry.

Frontend Application

Navigate to the site package to run your frontend application.

cd packages/site

# Start the development server
# Using pnpm
pnpm run dev

# Using npm
npm run dev

# Using yarn
yarn dev

The development server will start, and you can view your application in the browser.

Wagmi Configuration

The project includes a default Wagmi configuration for connecting to the Linea Testnet. You can find this configuration in the wagmi.config.ts file in your frontend application:

import { http, createConfig } from "wagmi";
import { lineaTestnet } from "wagmi/chains";
import { metaMask } from "wagmi/connectors";

export const config = createConfig({
  chains: [lineaTestnet],
  connectors: [metaMask()],
  transports: {
    [lineaTestnet.id]: http(),
  },
});

Feel free to modify this configuration to connect to different networks or use different connectors.

Monorepo Management

This project uses a monorepo structure to keep your frontend and backend code organized and in sync.

  • Package Management: If you selected pnpm, a pnpm-workspace.yaml file is included to manage the monorepo packages.
  • Scripts: Each package (blockchain and site) can have its own scripts. Navigate into each package directory to run and manage scripts specific to that package.

Customization

After project creation, you can customize the setup according to your needs:

  • Add Dependencies: Install additional npm packages as required.
  • Modify Configurations: Update Tailwind CSS, TypeScript, or other configurations.
  • Update Smart Contracts: Write and deploy your own smart contracts using Hardhat or Foundry.

Contributing

Contributions are welcome! If you have suggestions or find issues, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.