A fully decentralized, mobile-first diary application with Thirdweb Smart Accounts, Farcaster integration, and gasless transactions on Celo.
- Multi-Method Authentication: Farcaster, Email, Phone, Google, Apple, or Web3 Wallet
- Smart Account Abstraction: Every user gets an ERC-4337 smart account via Thirdweb
- Gasless Transactions: All writes sponsored by Thirdweb Paymaster
- Decentralized Storage: Diary entries on IPFS (Pinata), indexed by The Graph
- Daily Rewards: One reward per day for consistent diary writing
- Image Support: Optimized image uploads with free tier (5 images) and premium tier
- Volume Management: Automatic JSON volume creation when entries exceed 25MB
┌─────────────────────────────────────────────────────────────┐
│ Frontend │
│ Next.js 15 + Thirdweb SDK │
│ (Email/Phone/Social/Farcaster/Wallet Login) │
└───────────────────────┬─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ TypeScript Backend │
│ Thirdweb AA + Paymaster + Pinata IPFS │
└──────┬──────────────────────┬───────────────────────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────────┐
│ Python │ │ Smart Contract │
│ Compression │ │ (Celo Network) │
│ Service │ │ CeloDiary.sol │
└──────────────┘ └──────────┬───────────┘
│
▼
┌──────────────────────┐
│ The Graph │
│ Subgraph │
│ (Event Indexing) │
└──────────────────────┘
- Network: Celo (Mainnet + Alfajores Testnet)
- Smart Contracts: Solidity, Hardhat, OpenZeppelin
- Account Abstraction: Thirdweb Smart Accounts (ERC-4337)
- Gas Sponsorship: Thirdweb Paymaster
- Thirdweb Embedded Wallet
- Farcaster Login (Frames)
- Email/Phone/Google/Apple Social Login
- Traditional Web3 Wallet Support
- IPFS: Pinata for decentralized storage
- The Graph: Event indexing and querying
- TypeScript: Node.js + Express/Fastify
- Python: FastAPI compression service
- Image Processing: Pillow (WEBP compression <5MB)
- Framework: Next.js 15 + TypeScript
- Auth: Thirdweb React SDK
- UI: Shadcn UI + TailwindCSS
- State: Zustand
- Data: GraphQL client for Subgraph
- Node.js 18+
- Python 3.9+
- Git
- Clone the repository
git clone https://github.com/TYDev01/Chain-Diary.git
cd Chain-Diary- Install Smart Contract Dependencies
cd smart-contracts
npm install
cp .env.example .env
# Configure your .env file- Install Backend Dependencies
cd ../backend
npm install
cp .env.example .env
# Configure your .env file- Install Frontend Dependencies
cd ../frontend
npm install
cp .env.example .env.local
# Configure your .env.local file- Setup Python Compression Service
cd ../compression-service
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env- Setup The Graph Subgraph
cd ../subgraph
npm installPRIVATE_KEY=your_private_keyCELO_RPC_URL=https://forno.celo.orgALFAJORES_RPC_URL=https://alfajores-forno.celo-testnet.orgCELOSCAN_API_KEY=your_celoscan_api_keyTHIRDWEB_CLIENT_ID=your_thirdweb_client_idTHIRDWEB_SECRET_KEY=your_thirdweb_secret_keyPINATA_API_KEY=your_pinata_api_keyPINATA_SECRET_KEY=your_pinata_secret_keyPINATA_JWT=your_pinata_jwtCOMPRESSION_SERVICE_URL=http://localhost:8000CONTRACT_ADDRESS=deployed_contract_addressCELO_RPC_URL=https://forno.celo.orgPORT=3001NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your_thirdweb_client_idNEXT_PUBLIC_CONTRACT_ADDRESS=deployed_contract_addressNEXT_PUBLIC_CHAIN_ID=42220NEXT_PUBLIC_BACKEND_URL=http://localhost:3001NEXT_PUBLIC_SUBGRAPH_URL=your_subgraph_urlPORT=8000MAX_FILE_SIZE=5242880cd smart-contracts
npm run test
npm run deploy:alfajores # Testnet
npm run deploy:celo # Mainnetcd backend
npm run devcd compression-service
source venv/bin/activate
python main.pycd frontend
npm run devcd subgraph
npm run codegen
npm run build
npm run deployCreates or recovers a Thirdweb embedded wallet session.
{
"authMethod": "farcaster|email|phone|google|wallet",
"credential": "fid|email|phone|walletAddress"
}Uploads and compresses an image to IPFS.
{
"image": "base64_encoded_image",
"userAddress": "0x..."
}Creates a new diary entry.
{
"text": "diary entry text",
"imageCIDs": ["Qm...", "Qm..."],
"userAddress": "0x..."
}Returns user status information.
# Smart Contract Testscd smart-contracts
npm run test# Backend Testscd backend
npm run test# Frontend Testscd frontend
npm run test- User selects auth method (Farcaster/Email/Phone/Social/Wallet)
- Thirdweb creates/recovers embedded wallet
- Smart account is automatically provisioned
- User gains gasless access to write diary entries
- User writes text entry + optionally uploads images
- Images sent to Python service → compressed to <5MB WEBP
- Compressed images uploaded to Pinata IPFS
- Text + image CIDs appended to JSON volume
- If volume >25MB, new volume created
- Updated JSON uploaded to IPFS
- Smart account calls
updateDiary(newCID)(gasless) - The Graph indexes the event
- Frontend updates via GraphQL query
- One reward per 24 hours
- Automatic check on
updateDiarycall - Reward timestamp tracked on-chain
- Streak calculated via The Graph queries
- No private keys exposed to frontend
- Thirdweb manages wallet security
- Pinata API keys server-side only
- Smart contract access controls
- Image size validation
- Rate limiting on backend endpoints
MIT License - see LICENSE file for details
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
For issues and questions:
- GitHub Issues: Chain-Diary Issues
- Documentation: See
/docsfolder
Built with ❤️ using Celo, Thirdweb, and IPFS