Comprehensive technical README for the PixelMart monorepo. This repository contains a Next.js frontend and an Anchor-based Solana program (on-chain marketplace). The README documents architecture, developer setup, build & deploy steps, testing, and troubleshooting.
- Project Overview
- Repository Layout
- Architecture
- Prerequisites
- Local Development
- Frontend (Next.js)
- Solana Program (Anchor)
- Building for Production
- Deploying Contracts & Frontend
- Testing
- Common Tasks & Scripts
- Environment Variables
- Project Conventions
- Troubleshooting
- Contributing
- Appendix: Helpful File Links
This project implements a simple NFT marketplace on Solana. It includes:
- A Next.js TypeScript frontend that interacts with the Solana program and on-chain marketplace.
- An Anchor (Rust) program that defines marketplace logic (listings, buys, marketplace state).
- Scripts for deployment, automated tests, and IDL/type generation.
Use cases:
- Create/list NFTs for sale
- Browse and purchase listed NFTs
- Query listings and ownership via the frontend
frontend/— Next.js application (TypeScript, React, pnpm workspace)- Key files:
app/,components/,lib/,hooks/,providers/
- Key files:
solana-program/— Anchor program (Rust) and migrations- Key files:
programs/marketplace/src/lib.rs,Anchor.toml,migrations/
- Key files:
tests/— on-chain integration tests (nearsolana-program/testsfolder)
See these locations in the tree for details: frontend and solana-program.
- On-chain: Anchor program
marketplacehandles listings, escrow, and transfers. - Off-chain: Next.js frontend talks to Solana via wallet adapters and Anchor-generated client types.
- Data flow: Users sign transactions in their wallet (Phantom / Solflare). Marketplace state is stored in program accounts.
- Node.js (v18+ recommended)
- pnpm (used by frontend workspace)
- Rust toolchain (stable) and
cargo - Solana CLI (
solana) — compatible version recommended by Anchor - Anchor (Rust +
anchor-cli) for building and deploying the program - Irys + Metaplex for NFT Minting logic
Install notes (macOS):
# Node + pnpm
brew install node
npm install -g pnpm
# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Solana CLI (check Anchor docs for compatible versions)
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Anchor
cargo install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --lockedAdjust versions as required by Anchor.toml and Cargo.toml in solana-program/.
Preamble: run the frontend locally and run Anchor program on localnet/test validator.
- Install dependencies
cd frontend
pnpm install- Environment variables
Copy .env.example (if present) or set required vars described below in Environment Variables.
- Run dev server
pnpm dev
# or
pnpm next devThe app will typically be available at http://localhost:3000.
Important frontend locations:
- UI components: frontend/components
- Wallet provider: frontend/providers/WalletProvider.tsx
- Program helpers & marketplace client: frontend/lib/program.ts
This project uses Anchor for program development. Common flows:
- Start
solana-test-validator(local cluster):
solana-test-validator --reset- Configure Solana CLI to localnet:
solana config set --url http://127.0.0.1:8899- Fund your local wallet (optional for specific wallets):
solana airdrop 10- Build and deploy Anchor program locally
cd solana-program
anchor build
anchor deploy --provider.cluster localnetNotes:
Anchor.tomlcontrols program ID and cluster config. Afteranchor build, the IDL is generated totarget/idl/and TypeScript types totarget/types/(if usinganchor-client-gen/ build steps configured).- After deploying, update frontend config (
frontend/lib/constants.tsorfrontend/lib/program.ts) with the program ID if it differs.
Frontend:
cd frontend
pnpm build
pnpm start # or use hosting platform commandsSolana program:
- For mainnet deployment compile with
anchor build -- --releaseand deploy withanchor deploy --provider.cluster mainnet(ensure careful audits & funding).
- Program deployment
- Configure
Anchor.tomlwith the correctclusterandprogramsentries. - Ensure the deployer keypair is funded for the chosen cluster.
- Run
anchor buildandanchor deploy.
- Frontend deployment
- Build the Next.js app:
pnpm build. - Deploy to Vercel / Netlify / any provider that supports Next.js. Ensure env vars are set in hosting provider.
Anchor-based tests are typically in the tests/ directory under the solana-program workspace. Run them with:
cd solana-program
anchor testThis boots a local validator, runs migrations, deploys the program, runs tests, and tears down.
If present, run the frontend test scripts (pnpm test or pnpm jest). This project scaffold may not include frontend tests by default.
pnpm build— build the Next.js frontend (run fromfrontend/).pnpm dev— run Next.js in development.anchor build— compile the Anchor program.anchor test— run Anchor tests.anchor deploy— deploy to configured cluster.
The project may require the following env vars (example names — check frontend code for exact names):
NEXT_PUBLIC_SOLANA_CLUSTER— cluster RPC URL (e.g.,http://127.0.0.1:8899or mainnet-beta RPC)NEXT_PUBLIC_PROGRAM_ID— deployed Marketplace program IDRPC_URL— optional RPC override for backend calls
Store secrets (private keys) securely. Do not check private key files into source control.
- Code style: TypeScript + ESLint (see
eslint.config.mjsinfrontend/). - Monorepo uses
pnpmworkspace infrontend. - Anchor program follows Rust/Anchor idioms: account structs, handlers, and events.
- Anchor build/deploy errors: ensure
anchor-cli,solanaCLI, and Rust toolchain versions are compatible withAnchor.tomlandCargo.toml. - Wallet connection issues: ensure the wallet adapter is configured for the same cluster as the program and the wallet is funded.
- Missing IDL/types in frontend: confirm
anchor buildproducedtarget/idl/marketplace.jsonand that frontend is reading the correct path.
Common debug commands:
# Show solana config
solana config get
# Show anchor info
anchor --version
# Inspect program logs after sending a tx
solana logs --program <PROGRAM_ID>See the contribution guidelines in CONTRIBUTING.md.
- Review on-chain program logic carefully before deploying to mainnet.
- Ensure appropriate access controls and checks exist in the program (e.g., ownership, authority checks, safe token transfers).
- Frontend entry: frontend/app/page.tsx
- Frontend wallet provider: frontend/providers/WalletProvider.tsx
- Program source: solana-program/programs/marketplace/src/lib.rs
- Anchor config: solana-program/Anchor.toml
- Program IDL / types: solana-program/target/idl
If you want, I can:
- Add an
.env.examplefile tofrontend/listing required env vars. - Run a local smoke test: start validator, deploy program, run the frontend.
- Generate a short developer quick-start checklist.
Tell me which you'd like next.