Smart Contract Project Templates

Info

This is a beta version of the Solana Toolkit, and is still a WIP. Please post all feedback as a GitHub issue here.

Choose from one of the below scaffolds to generate a new project workspace:

  • Anchor - A popular Rust-based framework for creating Solana smart contracts.
  • create-solana-program - In-depth workspace generator for either Anchor smart contract development or Native smart contract, including JavaScript and Rust clients.
  • Web App Templates - Generator for new projects that connects a Solana smart contract to various frontend stacks, includes wallet connector setup.

Anchor #

anchor init

This generates a basic workspace to be able to write an Anchor rust smart contracts, build, test, and deploy. For more information, read the anchor init doc.

Create Solana Program #

npx create-solana-program

This generates an in-depth workspace for either Anchor smart contract development or Native smart contract development with either a Javascript Client, Rust Client, or both. For more information, read the create-solana-program doc.

Web App Template #

npx create-solana-dapp

This initializes a new project that connects a Solana smart contract to a typescript frontend with a wallet connector. For more information, read the web app template doc.

Mobile App Template #

yarn create expo-app --template @solana-mobile/solana-mobile-expo-template

This is initializing a new project using the Expo framework that is specifically designed for creating mobile applications that interact with the Solana blockchain.

Update an Existing Project #

npx create-solana-program

You can add the Solana program scaffold to an existing project by following this guide.

Standard Project Layouts #

For best practices on smart contract file structure, read this guide.