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].