Skip to content

nirwanadoteth/onepulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OnePulse

OnePulse Logo

Daily GM Tracking on Multiple Blockchains

A Base app/Farcaster Mini App for saying "GM" daily across Base, Celo, and Optimism networks


✨ Overview

OnePulse is a Base app/Farcaster Mini App that lets users say "GM" (Good Morning) daily across multiple blockchain networks, track their streaks, and earn rewards in USDC (configurable). Built with modern Web3 technologies, it demonstrates seamless integration between Farcaster, smart contracts, and real-time databases.

πŸš€ Key Features

  • Multi-Chain GM Tracking - Say GM on Base, Celo, and Optimism
  • Real-Time Streaks - Track current and highest streaks
  • ERC-20 Rewards - Automatic token rewards for daily participation
  • Farcaster Integration - Native Mini App experience
  • Live Statistics - Real-time updates via SpacetimeDB

πŸ›  Tech Stack

Category Technology Version
Frontend Next.js, React, TypeScript 16.0, 19.0, 5.0
Styling Tailwind CSS 4.1
Web3 OnchainKit, Wagmi, Viem, AppKit (Reown) latest, 2.19, 2.38, 1.8.14
Database SpacetimeDB 1.7
Farcaster MiniApp SDK 0.2.1
UI Radix UI, Motion latest

πŸ“ Project Structure

app/                   # Next.js App Router
β”œβ”€β”€ api/               # API routes (auth, gm, claims)
β”œβ”€β”€ layout.tsx         # Root layout
β”œβ”€β”€ page.tsx           # Main app page
└── globals.css        # Global styles

components/            # React components
β”œβ”€β”€ gm-chain-card/     # Per-chain GM UI
β”œβ”€β”€ providers/         # Context providers
β”œβ”€β”€ ui/                # Reusable UI components
└── ...

contracts/            # Solidity smart contracts
hooks/                # Custom React hooks
lib/                  # Utilities and configurations
server/               # Rust/SpacetimeDB backend

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ or Bun
  • Coinbase Developer Platform account
  • Farcaster account

Installation

# Clone repository
git clone https://github.com/nirwanadoteth/onepulse.git
cd onepulse

# Install dependencies
npm install

# Configure environment
cp .env.example .env.local
# Edit .env.local with your API keys

# Start development server
npm run dev

Visit http://localhost:3000 to see the app.

Environment Setup

# Required environment variables
NEXT_PUBLIC_ONCHAINKIT_API_KEY=your_cdp_api_key
NEXT_PUBLIC_ONCHAINKIT_PROJECT_ID=your_cdp_project_id
NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id
NEXT_PUBLIC_URL=http://localhost:3000

# Smart contract addresses
NEXT_PUBLIC_DAILY_GM_ADDRESS_BASE=0x...
NEXT_PUBLIC_DAILY_GM_ADDRESS_CELO=0x...
NEXT_PUBLIC_DAILY_GM_ADDRESS_OPTIMISM=0x...
NEXT_PUBLIC_DAILY_REWARDS_V2_ADDRESS_BASE=0x...
NEXT_PUBLIC_DAILY_REWARDS_V2_ADDRESS_CELO=0x...
NEXT_PUBLIC_DAILY_REWARDS_V2_ADDRESS_OPTIMISM=0x...

# Neynar
NEYNAR_API_KEY=

# Database
SPACETIMEDB_HOST_URL=
SPACETIMEDB_MODULE=

# Redis
KV_REST_API_URL=
KV_REST_API_TOKEN=

# Signer PK
BACKEND_SIGNER_PRIVATE_KEY=0x...

# Paymaster endpoint from Coinbase (optional)
PAYMASTER_ENDPOINT=

πŸ— Architecture

Data Flow

graph TD
    A[Farcaster Frame] --> B[Mini App SDK]
    B --> C[React App]
    C --> D[Root Providers]
    D --> E[GM Components]
    E --> F[Smart Contracts]
    F --> G[SpacetimeDB]
Loading

Key Components

  • Server Components - Data fetching and static content
  • Client Components - Interactive UI and wallet connections
  • Custom Hooks - Reusable logic for GM stats, connections
  • Context Providers - Global state management

πŸ“Š Features

Daily GM Tracking

  • One GM per UTC day per network
  • Automatic streak calculation
  • Real-time statistics updates

Multi-Chain Support

  • Base - Ethereum L2 with low fees
  • Celo - Mobile-first blockchain
  • Optimism - Optimistic rollup

Reward System

  • ERC-20 token rewards (currently use USDC)
  • Automatic claiming
  • Reward history tracking

πŸ§ͺ Development

Available Scripts

npm dev              # Start development server
npm run build        # Build for production
npm run typecheck        # Run TypeScript checks
npm run check            # Run ultracite check
npm run format           # Format code with ultracite

Code Quality

The project maintains high code quality with:

  • TypeScript strict mode enabled
  • Biome lint and format tools with ultracite settings
  • Automated import sorting

Naming Conventions

  • Components: PascalCase (UserCard)
  • Hooks: camelCase with use prefix (useGmStats)
  • Utilities: camelCase (normalizeChainId)
  • Constants: UPPER_SNAKE_CASE (API_TIMEOUT)

🚒 Deployment

Vercel Deployment

npm run build
vercel --prod

Mini App Configuration

  1. Deploy to production domain
  2. Generate signed manifest at Farcaster Manifest Tool
  3. Update minikit.config.ts with signed accountAssociation
  4. Redeploy

Environment Variables

Set production environment variables in your hosting platform:

  • NEXT_PUBLIC_ONCHAINKIT_API_KEY
  • NEXT_PUBLIC_ONCHAINKIT_PROJECT_ID
  • NEXT_PUBLIC_URL (production domain)
  • Smart contract addresses

πŸ“š Documentation

πŸ“– Guides

πŸ— API Reference


🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following our coding standards**
  4. Run quality checks (npm check)
  5. Commit your changes (git commit -m 'feat: add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript strict mode
  • Use functional components with proper typing
  • Implement proper error handling
  • Add comments for complex business logic
  • Update documentation for new features

πŸ› Troubleshooting

Common Issues

Manifest Not Loading

# Check manifest is accessible
curl https://your-domain/.well-known/farcaster.json

App Not Initializing

Ensure sdk.actions.ready() is called in your Mini App initialization.

Transaction Failures

  • Verify wallet is connected to correct network
  • Check sufficient balance for gas fees
  • Confirm smart contract addresses are correct

Database Connection Issues

  • Verify SpacetimeDB endpoint accessibility
  • Check subscription queries are properly formatted
  • Ensure event handlers are correctly configured

Note: For detailed troubleshooting, see our Farcaster MiniApp Checklist.


πŸ”— Links


⚠️ Disclaimer

This is a live Farcaster Mini App accessible through Farcaster clients and Base app, as well as via web browsers.

Use at your own risk. This application interacts with blockchain networks and may involve financial transactions.


Built with ❀️ using Next.js, React, OnchainKit, and Reown AppKit

⭐ Star us on GitHub β€’ πŸ› Report Issues

About

A Base App/Farcaster Mini App for saying "GM" onchain daily across multiple networks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •