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 🙏

© 2026 – Pkg Stats / Ryan Hefner

anchor-init

v1.1.1

Published

Scaffold a custom Solana Anchor program in seconds

Readme

About

anchor-init is a command-line tool designed to quickly scaffold Solana Anchor programs with best practices. It generates a new project with a custom programId, sets up the proper directory structure for Anchor development, and provides an interactive setup experience to get you coding faster.

Features

  • Fast project scaffolding with custom programId generation
  • Handlebars template system for easy customization
  • Automatic initial build process
  • Interactive setup with customizable steps
  • Optional Git repository initialization
  • Smart project name validation and conversion
  • One-c0mmand full setup with --all flag
  • Enhanced error detection and helpful suggestions

Installation

From npm

npm install -g anchor-init

From Source

  1. Clone the repository
    git clone https://github.com/priyanshpatel18/anchor-init.git
    cd anchor-init
  2. Install dependencies
    npm install
  3. Link globally
    npm link

Usage

Basic Usage

anchor-init my_project

Advanced Usage

Full automated setup

anchor-init my_project --all --git

Available Options

  • --all: Run all setup steps automatically (keys sync, build, install, deploy, test)
  • --git: Initialize a Git repository automatically
  • -h, --help: Display help information

What happens when you run anchor-init?

  1. Project Creation: Creates a new directory with your project name (converted to snake_case if needed)
  2. Program ID Generation: Generates a unique Solana program ID using a new keypair
  3. Template Processing: Copies and processes Handlebars templates with your project context
  4. Initial Build: Runs anchor build to ensure everything compiles
  5. Interactive Setup: Prompts you to select additional steps to run:
    • anchor keys sync - Sync program keys
    • anchor build - Build the program
    • yarn install - Install dependencies
    • yarn deploy:local - Deploy to local validator
    • yarn test:local - Run tests
  6. Git Initialization: Optionally initialize a Git repository

Examples

Basic project creation

anchor-init cool_project

Full setup with Git

anchor-init my-awesome-program --all --git

Manual step selection

anchor-init my_project
# Then select which steps to run from the interactive menu

Project Structure

After running anchor-init, you'll get a complete Anchor project structure:

my_project/
├── programs/
│   └── my_project/
│       ├── src/
│       │   └── lib.rs
│       └── Cargo.toml
├── tests/
│   └── my_project.ts
├── migrations/
├── app/
├── Anchor.toml
├── .gitignore
├── Cargo.toml
├── package.json
└── tsconfig.json

Error Handling

anchor-init includes intelligent error detection:

  • Connection Issues: Detects when Solana test validator isn't running
  • WebSocket Errors: Identifies validator connectivity problems
  • Test Issues: Helps troubleshoot missing test files
  • Build Failures: Provides clear error messages and suggestions

Development

Local Testing

git clone https://github.com/priyanshpatel18/anchor-init.git
cd anchor-init
npm install
npm link
anchor-init test_project

Template Development

The tool uses Handlebars templates located in the templates/ directory. Available template variables:

  • {{projectName}} - Snake case project name
  • {{programId}} - Generated program ID
  • {{PascalCase projectName}} - Pascal case helper
  • {{camelCase projectName}} - Camel case helper

Prerequisites

  • Node.js (v14 or higher)
  • Anchor CLI installed and configured
  • Solana CLI tools
  • Yarn package manager

Troubleshooting

Common Issues

"anchor build failed"

  • Ensure Anchor CLI is properly installed
  • Check that Rust toolchain is up to date

"Connection refused" during deploy

  • Start the Solana test validator: solana-test-validator
  • Or use: anchor test-validator

"No test files found"

  • Ensure test files exist in tests/**/*.ts
  • Check that test files follow proper naming convention

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

MIT - see the LICENSE file for details.