A modern, opinionated boilerplate for building Safe Apps with React, TypeScript, and TailwindCSS. This template provides everything you need to start building high-quality Safe Apps with best practices baked in.
- ⚡️ Vite with Fast Refresh
- 🔒 Safe Apps SDK with React bindings
- ⛓️ WAGMI + Viem for Ethereum interactions
- 🎨 TailwindCSS + shadcn/ui for beautiful UIs
- 🔄 TanStack Query for data fetching
- 🔍 Biome for linting and formatting
- 💪 TypeScript for type safety
src/
├── components/ # Reusable components
│ └── ui/ # shadcn/ui components
├── hooks/ # Custom hooks including Safe transaction helpers
├── lib/ # Utilities and configurations
└── types/ # TypeScript types
pnpm dev
- Start development serverpnpm build
- Build for productionpnpm check
- Run Biome checkspnpm lint
- Run Biome linterpnpm format
- Format code
- Use this template:
# With degit
npx degit pythonpete32/safe-app-boilerplate my-safe-app
# Or clone directly
git clone https://github.com/pythonpete32/safe-app-boilerplate.git my-safe-app
- Install dependencies:
pnpm install
- Start developing:
pnpm dev
- Add to Safe:
- Open Safe{Wallet}
- Go to Apps -> Manage Apps -> Add Custom App
- Enter
http://localhost:3000
- Start building!
Safe Apps require a manifest.json
file in the root directory. This boilerplate includes a pre-configured manifest at public/manifest.json
:
{
"name": "Safe App",
"description": "Describe your Safe App here",
"iconPath": "logo.svg",
// ... other configurations
}
Important Manifest Fields:
name
: Your app's name as it will appear in Safedescription
: A brief description of your app's functionalityiconPath
: Path to your app's icon (relative to public directory)
The boilerplate includes a default set of icons and logos in the public/
directory. Replace them with your own assets while maintaining the same filenames, or update the paths in manifest.json
.
The boilerplate comes with a pre-configured Safe integration. Check src/hooks/send-safe-transaction.ts
for an example of how to send transactions through Safe:
const { mutate: sendTx } = useSendSafeTx({
onSuccess: (data) => console.log("Transaction sent:", data),
onError: (error) => console.error("Error:", error),
});
// Send a transaction
sendTx([{
to: contractAddress,
value: 0n,
data: encodeFunctionData({/*...*/})
}]);
- Update
src/lib/wagmi.ts
to add or modify supported networks - Default configuration uses Sepolia testnet
- Update
manifest.json
with your app's details - Replace the icons in
public/
directory with your own - Update
package.json
name and version
This template uses Tailwind CSS with shadcn/ui components. Add new shadcn/ui components with:
npx shadcn-ui add button
npx shadcn-ui add card
# etc
Found a bug or have a feature suggestion? Please open an issue! PRs are also welcome.
- Safe Apps Documentation
- Build Your First Safe App Tutorial
- shadcn/ui Documentation
- TanStack Query Documentation
- wagmi Documentation
MIT
Happy building! 🚀