A comprehensive starter kit for learning Web3 development with React, Wagmi, Foundry, and Civic authentication.
- Node.js (v18 or higher)
- npm or yarn
- Git
- Foundry (for smart contract development)
-
Clone the repository
git clone <your-repo-url> cd starter-kit
-
Install Foundry (if not already installed)
curl -L https://foundry.paradigm.xyz | bash foundryup -
Install dependencies
make install
-
Set up environment variables
cp .env.example .env # Edit .env with your Civic client ID and other configurations -
Start development
make dev
- Visit Civic Dashboard
- Sign up or log in to your account
- Create a new application
- Copy your Client ID
Update your .env file with your Civic credentials:
VITE_CIVIC_CLIENT_ID=your_civic_client_id_here
VITE_CIVIC_REDIRECT_URI=http://localhost:3000/auth/callbackmake civic-testThe Civic authentication is now integrated and ready to use! Users can:
- Sign in with Google, Apple, X, Facebook, Discord, GitHub
- Use email authentication
- Access embedded wallet capabilities
- Connect across multiple blockchains
starter-kit/
βββ frontend/ # React application
β βββ src/
β β βββ components/ # React components
β β β βββ civic/ # Civic authentication components
β β β βββ layout/ # Layout components
β β β βββ web3/ # Web3-specific components
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ utils/ # Utility functions
β β βββ wagmi/ # Wagmi configuration
β β βββ styles/ # Global styles
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
β βββ vite.config.ts # Vite configuration
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ index.html # Main HTML file
βββ contracts/ # Smart contracts
β βββ src/ # Solidity contracts
β β βββ SimpleStorage.sol
β βββ test/ # Contract tests
β β βββ SimpleStorage.t.sol
β βββ script/ # Deployment scripts
β β βββ Deploy.s.sol
β βββ foundry.toml # Foundry configuration
βββ docs/ # Documentation
β βββ smart-contracts.md # Smart contract guide
β βββ frontend.md # Frontend development guide
β βββ civic.md # Civic authentication guide
β βββ deployment.md # Deployment guide
β βββ troubleshooting.md # Troubleshooting guide
βββ .cursorrules # Cursor AI context
βββ Makefile # Build automation
βββ env.example # Environment variables template
βββ README.md # This file
make install- Install all dependenciesmake dev- Start development servermake build- Build for productionmake test- Run all testsmake lint- Run linting
make compile- Compile smart contractsmake test-contracts- Test smart contractsmake deploy- Deploy contracts to local networkmake deploy-sepolia- Deploy to Sepolia testnet
make civic-setup- Set up Civic authenticationmake civic-test- Test Civic integration
The project uses two separate environment files:
Create a .env file in the frontend/ directory:
cp frontend/.env.example frontend/.envThis file contains all Vite-specific variables (prefixed with VITE_):
- Civic authentication settings
- Blockchain configuration
- Contract addresses
- UI/UX settings
- Feature flags
Create a .env file in the root directory:
cp env.example .envThis file contains deployment and contract-related variables:
- Private keys for deployment
- API keys for verification
- Network configuration
- Foundry settings
Note: Frontend variables must be in frontend/.env and prefixed with VITE_ to be accessible by the Vite application.
- Go to Civic Dashboard
- Create a new application
- Add your redirect URI:
http://localhost:3000/auth/callback - Enable Embedded Wallet: In your Civic dashboard, go to Settings β Embedded Wallet and enable it for your users
- Copy your Client ID to
frontend/.env
- React: Frontend framework
- Wagmi: React hooks for Ethereum
- Foundry: Smart contract development toolkit
- Civic: Web3 authentication with SSO and embedded wallets
- Start with
contracts/src/SimpleStorage.sol - Learn about state variables, functions, and events
- Run tests with
make test-contracts
- Explore
frontend/src/components/for examples - Learn Wagmi hooks in
frontend/src/hooks/ - Understand Civic authentication flow
- Custom hooks for Web3 interactions
- Error handling and user experience
- Gas optimization
- Security best practices
make test-frontendmake test-contractsmake test-integration- Configure your deployment network in
foundry.toml - Set your private key in environment variables
- Run
make deploy-sepolia
- Build the application:
make build - Deploy to your preferred hosting service
- Update environment variables for production
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Check the troubleshooting guide
- Open an issue for bugs or feature requests
- Join our Discord community
By the end of this starter kit, you should be able to:
- β Set up a complete Web3 development environment
- β Write and deploy smart contracts with Foundry
- β Build React applications with Wagmi
- β Implement Web3 authentication with Civic (SSO + embedded wallets)
- β Handle user interactions with blockchain
- β Test smart contracts and frontend applications
- β Deploy applications to testnets and mainnet
Happy Building! π