A production-ready decentralized chat application built with Web3 technologies
π Live Demo β’ π Documentation β’ π€ Contributing β’ π License
- End-to-End Encryption: X25519 + AES-GCM client-side encryption
- Decentralized Storage: IPFS integration for censorship-resistant content
- Zero-Knowledge Architecture: No central authority controls your data
- Client-Side Key Management: Your keys, your data, your control
- Direct Messaging: Encrypted peer-to-peer conversations
- Group Chats: Multi-participant encrypted group conversations
- File Sharing: Secure file transfer with IPFS storage
- Real-Time Messaging: Instant message delivery via blockchain events
- Message History: Persistent encrypted message storage
- Multi-Wallet Support: MetaMask, WalletConnect, Coinbase Wallet
- Smart Contract Integration: On-chain user profiles and friend management
- Reputation System: Community-driven user scoring
- Gas Optimization: Efficient smart contract interactions
- Cross-Chain Ready: Built for Polygon with multi-chain support
- Responsive Design: Mobile-first approach with TailwindCSS
- Dark/Light Mode: Automatic theme switching
- Real-Time Updates: Live message synchronization
- Intuitive Interface: Clean, modern chat interface
- Accessibility: WCAG compliant design
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js 15 + TypeScript β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β React 19 β’ TailwindCSS 3 β’ Zustand β’ Wagmi β’ Viem β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β TweetNaCl β’ Web3.Storage β’ IPFS β’ Web3Modal β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Solidity 0.8.19 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β OpenZeppelin β’ Hardhat β’ Polygon Amoy β’ TypeChain β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β User Profiles β’ Group Chats β’ Friend System β’ Reputation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
graph TB
A[User Interface] --> B[Wagmi/Wallet]
B --> C[Smart Contract]
C --> D[Blockchain Events]
D --> E[Real-time Updates]
A --> F[Encryption Service]
F --> G[IPFS Storage]
G --> H[Decentralized Content]
A --> I[State Management]
I --> J[Zustand Store]
J --> K[UI Components]
- Node.js 18+ and npm
- MetaMask or compatible Web3 wallet
- Git
git clone https://github.com/deekshith-b48/we3chat.git
cd we3chat
npm installcp .env.example .env.localConfigure your environment variables:
# Web3 Configuration
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
NEXT_PUBLIC_POLYGON_RPC_URL=https://rpc-amoy.polygon.technology
NEXT_PUBLIC_CHAT_CONTRACT_ADDRESS=0x...
# IPFS Configuration
NEXT_PUBLIC_WEB3_STORAGE_TOKEN=your_web3_storage_token
# Optional: Supabase (for enhanced features)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_keycd contracts
npm install
npx hardhat compile
npx hardhat run scripts/deploy.js --network polygonAmoynpm run devOpen http://localhost:3000 to see your application!
- Connect Wallet: Click "Connect Wallet" and select your preferred wallet
- Create Profile: Register your username and bio
- Add Friends: Send friend requests to other users
- Start Chatting: Begin encrypted conversations!
- π Encrypted Messaging: All messages are encrypted client-side
- π₯ Group Chats: Create and manage group conversations
- π File Sharing: Share files securely via IPFS
- β Reputation System: Rate users and build trust
- π Cross-Platform: Works on desktop and mobile
we3chat/
βββ π± Frontend (Next.js)
β βββ src/
β β βββ app/ # Next.js app router
β β βββ components/ # React components
β β βββ lib/ # Utilities & services
β β βββ hooks/ # Custom React hooks
β β βββ store/ # Zustand state management
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
β
βββ π Smart Contracts
β βββ contracts/ # Solidity contracts
β βββ scripts/ # Deployment scripts
β βββ test/ # Contract tests
β βββ hardhat.config.js # Hardhat configuration
β
βββ π₯οΈ Backend Services
β βββ backend/ # Main backend service
β βββ backend-local/ # Local development
β
βββ π Documentation
βββ README.md # This file
βββ docs/ # Additional documentation
# Frontend Development
npm run dev # Start development server
npm run build # Production build
npm run start # Start production server
npm run lint # Run ESLint
# Smart Contract Development
cd contracts
npx hardhat compile # Compile contracts
npx hardhat test # Run tests
npx hardhat deploy # Deploy contracts- Framework: Next.js 15 with App Router
- Language: TypeScript 5.0
- Styling: TailwindCSS 3.4.11
- State Management: Zustand
- Web3 Integration: Wagmi + Viem
- Encryption: TweetNaCl (X25519 + AES-GCM)
- Storage: Web3.Storage + IPFS
- Language: Solidity 0.8.19
- Framework: Hardhat
- Security: OpenZeppelin (Ownable, ReentrancyGuard)
- Network: Polygon Amoy Testnet
- Testing: Hardhat Test Suite
- Runtime: Node.js + TypeScript
- Database: Supabase (PostgreSQL)
- Authentication: SIWE (Sign-In with Ethereum)
- Real-time: WebSocket subscriptions
// contracts/hardhat.config.js
module.exports = {
solidity: "0.8.19",
networks: {
polygonAmoy: {
url: process.env.POLYGON_RPC_URL,
accounts: [process.env.PRIVATE_KEY]
}
}
};// src/lib/wagmi.ts
export const config = createConfig({
chains: [polygonAmoy],
connectors: [injected(), walletConnect(), coinbaseWallet()],
transports: {
[polygonAmoy.id]: http(process.env.NEXT_PUBLIC_POLYGON_RPC_URL)
}
});cd contracts
npx hardhat testnpm testnpm run test:e2enpm run build
vercel --prodcd contracts
npx hardhat run scripts/deploy.js --network polygonAmoydocker-compose up -d- Bundle Size: Tree-shaking and code splitting
- Loading: Lazy loading and dynamic imports
- Caching: Smart contract data caching
- Compression: Gzip compression for assets
- First Contentful Paint: < 1.5s
- Largest Contentful Paint: < 2.5s
- Time to Interactive: < 3.0s
- Bundle Size: < 500KB gzipped
- Audited: OpenZeppelin security patterns
- Access Control: Role-based permissions
- Reentrancy Protection: Secure state management
- Input Validation: Comprehensive parameter checking
- Encryption: Client-side message encryption
- Key Management: Secure key storage
- HTTPS: Enforced secure connections
- CSP: Content Security Policy headers
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- TypeScript: Strict type checking
- ESLint: Code quality enforcement
- Prettier: Code formatting
- Husky: Pre-commit hooks
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenZeppelin for secure smart contract patterns
- Wagmi for Web3 React hooks
- Next.js for the amazing framework
- TailwindCSS for utility-first styling
- Web3.Storage for decentralized storage
- Documentation: docs.we3chat.com
- Discord: Join our community
- Twitter: @We3Chat
- Email: support@we3chat.com
Built with β€οΈ by the We3Chat Team
β Star this repo β’ π Report Bug β’ π‘ Request Feature