Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertohuertasm/solana-dapp-template
Template for Create Solana dApp using Next.js, Tailwind and an Anchor 'voting' program
https://github.com/robertohuertasm/solana-dapp-template
dapp solana template
Last synced: 14 days ago
JSON representation
Template for Create Solana dApp using Next.js, Tailwind and an Anchor 'voting' program
- Host: GitHub
- URL: https://github.com/robertohuertasm/solana-dapp-template
- Owner: robertohuertasm
- License: mit
- Created: 2025-01-06T18:16:33.000Z (20 days ago)
- Default Branch: main
- Last Pushed: 2025-01-06T19:35:18.000Z (20 days ago)
- Last Synced: 2025-01-06T19:46:03.901Z (20 days ago)
- Topics: dapp, solana, template
- Language: TypeScript
- Homepage: https://github.com/solana-developers/create-solana-dapp
- Size: 195 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# voting
## Getting Started
This repo is meant to be used via `npx create-solana-dapp --template robertohuertasm/solana-template`.
It's a template for Solana dApps based on [solana-developers/template-next-tailwind-counter](https://github.com/solana-developers/template-next-tailwind-counter), but with a few improvements:
- Support for Rust Analyzer in VS Code.
- Removes `cfg` warnings.
- Adds a `blink` to the API.
- Voting app with JS and Rust tests.### Prerequisites
- Node v18.18.0 or higher
- Rust v1.77.2 or higher
- Anchor CLI 0.30.1 or higher
- Solana CLI 1.18.17 or higher### Installation
Clone the repo:
```shell
git clone
cd
```or just use `npx create-solana-dapp --template robertohuertasm/solana-template`.
#### Install Dependencies
Go to the `package.json` file and change the name of your app. That's the only thing that you'll need to change as `create-solana-dapp` will replace the `template` string with the name of your app.
Then install the dependencies:
```shell
npm install
```#### Start the web app
```
npm run dev
```## Apps
### anchor
This is a Solana program written in Rust using the Anchor framework.
#### Commands
You can use any normal anchor commands. Either move to the `anchor` directory and run the `anchor` command or prefix the command with `npm`, eg: `npm run anchor`.
#### Sync the program id:
Running this command will create a new keypair in the `anchor/target/deploy` directory and save the address to the Anchor config file and update the `declare_id!` macro in the `./src/lib.rs` file of the program.
You will manually need to update the constant in `anchor/src/voting-exports.ts` to match the new program id.
```shell
npm run anchor keys sync
```#### Build the program:
```shell
npm run anchor-build
```#### Start the test validator with the program deployed:
```shell
npm run anchor-localnet
```#### Run the tests
```shell
npm run anchor-test
```#### Deploy to Devnet
```shell
npm run anchor deploy --provider.cluster devnet
```### web
This is a React app that uses the Anchor generated client to interact with the Solana program.
#### Commands
Start the web app
```shell
npm run dev
```Build the web app
```shell
npm run build
```## Blinks
There's a blink in the `api > vote > routes.ts` file.
## Tests
We have banrun tests, normal tests, and Rust tests (`npm run test-rust`)