This guide explains how to deploy the Zapcoin project to Netlify.
- A GitHub account
- A Netlify account
- Node.js >= 18.x installed locally
Before deploying, you can build the project locally to ensure everything works:
# Install dependencies
npm install
# Build the project
npm run buildThe build output will be in the dist directory.
- Log in to your Netlify account
- Click "Add new site" > "Import an existing project"
- Connect to your GitHub repository
- Configure the build settings:
- Build command:
npm run build - Publish directory:
dist
- Build command:
- Click "Deploy site"
-
Install the Netlify CLI:
npm install -g netlify-cli
-
Log in to your Netlify account:
netlify login
-
Initialize your site:
netlify init
-
Follow the prompts to configure your site
-
Deploy your site:
netlify deploy --prod
The following environment variables are configured in the netlify.toml file:
VITE_SOLANA_NETWORK: Set to "testnet" for the Solana testnetVITE_PROGRAM_ID: The Solana program ID
If you need to add more environment variables, you can do so in the Netlify UI under Site settings > Build & deploy > Environment.
Netlify automatically sets up continuous deployment from your GitHub repository. Any changes pushed to the main branch will trigger a new build and deployment.
If your build fails, check the build logs in the Netlify UI for errors. Common issues include:
- Missing dependencies
- TypeScript errors
- Environment variable issues
If you encounter routing issues (404 errors when navigating to routes), ensure the netlify.toml file includes the redirect rule for SPA routing:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200If the application can't connect to Solana:
- Check that the
VITE_SOLANA_NETWORKenvironment variable is set correctly - Ensure the
VITE_PROGRAM_IDmatches your deployed program - Verify that the Solana program is deployed to the correct network