A production-ready template for building Quantum Fusion Network (QFN) dApps with polkadot-api, React 19, and TypeScript. QFN is a solochain built on the Polkadot SDK.
✨ Pre-built Infrastructure
- Wallet connection (Polkadot.js, Talisman, SubWallet support)
- Chain connection with auto-reconnect
- Transaction lifecycle management
- Comprehensive error handling
- Toast notifications
- TanStack Query integration
🎨 Modern Stack
- React 19 + TypeScript
- Vite build system
- Tailwind CSS + Radix UI
- polkadot-api (type-safe blockchain interactions)
📦 Included Example
- Full asset management implementation (create, mint, transfer, destroy)
- Ready to customize or extend
npx degit user/polkadot-dapp-template my-polkadot-app
cd my-polkadot-apppnpm installThis will automatically:
- Install all dependencies
- Generate type descriptors via
papi(postinstall hook)
pnpm devOpen http://localhost:5173 in your browser.
Install a wallet extension for QFN (compatible with Polkadot.js ecosystem):
This template is designed to work with the QFN dApp workflow generator:
- Complete the wizard at [wizard-url] to generate your config
- Run the provided
npx degitcommand - Open in Claude Code:
claude-code . - Run:
/setup
The workflow will customize the template based on your selections.
- Clone this template
- Create
polkadot-config.json(seepolkadot-config.example.json) - Open in Claude Code
- Run:
/setup
.
├── src/
│ ├── components/ # React components
│ │ ├── ui/ # Reusable UI components (buttons, cards, etc.)
│ │ └── ... # Feature components
│ ├── contexts/ # React Context providers
│ │ ├── WalletContext.tsx
│ │ ├── ConnectionContext.tsx
│ │ └── TransactionContext.tsx
│ ├── hooks/ # Custom React hooks
│ │ ├── useWallet.ts
│ │ ├── useTransaction.ts
│ │ └── ...
│ ├── lib/ # Business logic & utilities
│ │ ├── assetOperations.ts
│ │ ├── errorParsing.ts
│ │ └── utils.ts
│ ├── App.tsx # Main application
│ └── main.tsx # Entry point
├── .papi/ # polkadot-api configuration
│ ├── polkadot-api.json
│ └── metadata/
├── .claude/ # Claude Code workflow assets
│ ├── commands/
│ └── docs/
├── public/ # Static assets
├── CLAUDE.md # Project documentation for AI assistants
└── package.json
Edit .papi/polkadot-api.json to connect to different chains:
{
"version": 0,
"descriptorPath": ".papi/descriptors",
"entries": {
"qfn": {
"wsUrl": "wss://test.qfnetwork.xyz",
"metadata": ".papi/metadata/qfn.scale"
}
}
}# From WSS URL
pnpm papi add mychain -w wss://my-chain-url
# From well-known chain
pnpm papi add dot -n polkadotThen update src/hooks/useConnectionStatus.ts to use the new descriptor.
import { useTransaction } from '@/hooks'
const { executeTransaction } = useTransaction(toastConfig)
// Execute transaction
await executeTransaction('operationType', observable, params)import { useQuery } from '@tanstack/react-query'
import { useConnectionContext } from '@/hooks'
const { api } = useConnectionContext()
const query = useQuery({
queryKey: ['key', param],
queryFn: async () => await api.query.Pallet.Storage.getValue(param),
staleTime: 30_000,
})All errors are automatically parsed and displayed with user-friendly messages. See src/lib/errorParsing.ts for implementation.
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm lint- Lint and fix codepnpm lint:check- Check linting without fixingpnpm typecheck- Type check without emittingpnpm format- Format code with Prettier
- CLAUDE.md - Comprehensive project documentation following best practices
- polkadot-api - Official docs
- React 19 - React docs
MIT
This is a template repository. For issues or improvements, please visit [repo-url].