A comprehensive DeFi education platform that combines portfolio management with charitable giving through interactive journeys. Built on Aptos blockchain with Google OAuth integration and keyless wallet technology.
DeFi Giving is an education-first portfolio application that teaches users about decentralized finance through hands-on experiences. Users can manage their portfolios, participate in lending protocols, and make charitable donations - all while learning about DeFi concepts through guided journeys.
- ๐ Keyless Authentication: Google OAuth integration with Aptos keyless wallet technology
- ๐ Portfolio Management: Real-time portfolio tracking with mock and live data
- ๐ฏ Interactive Journeys: Guided learning experiences for DeFi concepts
- ๐ Charitable Giving: Direct donations to verified nonprofits through smart contracts
- โ๏ธ Aptos Integration: Full blockchain integration with transaction verification
- ๐ฑ Modern UI: Beautiful, responsive interface built with React and Tailwind CSS
- Framework: React 18 with TypeScript
- Routing: Wouter for lightweight client-side routing
- State Management: React Context + TanStack Query
- UI Components: Radix UI primitives with Tailwind CSS
- Authentication: Google OAuth with Aptos keyless wallet
- API Server: Express.js with TypeScript
- Database: Drizzle ORM with PostgreSQL/Neon
- Blockchain: Aptos TypeScript SDK
- Authentication: Passport.js with Google OAuth
- Language: Move on Aptos blockchain
- Modules:
user_vault
: User fund management and donationsnonprofit_registry
: Verified nonprofit managementreceipts
: Transaction receipt trackingjourney_audit
: Journey completion verificationusdc_demo
: Demo USDC token for testing
- Node.js 20 or higher
- Aptos CLI (Installation Guide)
- Google OAuth Client (create via Google Cloud Console)
-
Clone the repository
git clone <repository-url> cd DeFiGiving-1
-
Install dependencies
npm install
-
Set up environment variables
cp ENV.sample .env
Configure your
.env
file with:# Google OAuth VITE_GOOGLE_CLIENT_ID=your-google-client-id # Aptos Configuration VITE_APTOS_NETWORK=testnet VITE_APTOS_REST_URL=https://fullnode.testnet.aptoslabs.com/v1 # Application URLs VITE_APP_BASE_URL=http://localhost:5174
-
Configure Google OAuth
- Create a Web OAuth client in Google Cloud Console
- Add authorized origins:
http://localhost:5173
- Add authorized redirect URIs:
http://localhost:5173
- Copy the client ID to your
.env
file
-
Deploy smart contracts (optional for full functionality)
# Create deployment config cp scripts/deploy.config.sample.json deploy.config.json # Deploy to testnet npm run deploy -- --config deploy.config.json
-
Start the development server
npm run dev
The application will be available at:
- Frontend: http://localhost:5173
- API: http://localhost:5174
- Click "Sign in with Google" on the login screen
- Complete Google OAuth flow
- The app automatically creates an Aptos keyless wallet
- Your wallet address appears in the header
- View your current portfolio balance
- Track lending positions and health factors
- Monitor donation history and receipts
- Simple Start: Basic DeFi concepts and portfolio management
- Collateral Giving: Advanced lending and charitable donation strategies
- Navigate to a journey that includes donation steps
- Select a verified nonprofit
- Choose donation amount
- Confirm transaction (requires live deployment)
- View receipt with blockchain verification
โโโ client/ # React frontend
โ โโโ src/
โ โ โโโ components/ # UI components
โ โ โโโ contexts/ # React contexts
โ โ โโโ hooks/ # Custom hooks
โ โ โโโ journeys/ # Journey modules
โ โ โโโ lib/ # Utilities
โ โ โโโ pages/ # Page components
โโโ server/ # Express backend
โ โโโ routes/ # API routes
โ โโโ data/ # Static data files
โ โโโ index.ts # Server entry point
โโโ aptos/ # Move smart contracts
โ โโโ sources/ # Move source files
โ โโโ tests/ # Move tests
โโโ shared/ # Shared types and schemas
# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
# Testing
npm run test # Run Vitest tests
npm run check # TypeScript type checking
# Database
npm run db:push # Push database schema changes
# Deployment
npm run deploy # Deploy smart contracts
npm run lint:journeys # Lint journey modules
-
Create journey module in
client/src/journeys/
export default function MyJourney({ isOpen, onClose, auth, keyless, aptos, capabilities, telemetry }) { // Journey implementation }
-
Update journeys manifest in
server/data/journeys.json
{ "slug": "my-journey", "title": "My Journey", "level": "beginner", "enabled": true, "importPath": "@/journeys/MyJourney" }
-
Follow journey contract - Use injected capabilities and telemetry functions
# Run Move tests
aptos move test --skip-fetch-latest-git-deps --named-addresses dg_tenant=<tenant>
# Publish contracts
aptos move publish --named-addresses dg_tenant=<tenant> --assume-yes
# Initialize modules
aptos move run --function <tenant>::usdc_demo::init --assume-yes
POST /api/auth/google
- Google OAuth callbackPOST /api/auth/logout
- User logout
GET /api/portfolio
- Get user portfolioPATCH /api/portfolio
- Update portfolio data
GET /api/journeys
- Get available journeysPOST /api/journey-runs/start
- Start journey trackingPOST /api/journey-runs/complete
- Complete journeyGET /api/journey-runs
- Get journey run history
POST /api/chain/bootstrap-vault
- Initialize user vaultGET /api/verify/:txHash
- Verify transaction on-chain
GET /api/receipts
- Get user receiptsPOST /api/receipts
- Create new receipt
npm run test
cd aptos
aptos move test --skip-fetch-latest-git-deps --named-addresses dg_tenant=<tenant>
npm run lint:journeys
-
Configure Aptos CLI
aptos init --profile tenant --network testnet
-
Create deployment config
cp scripts/deploy.config.sample.json deploy.config.json
-
Deploy contracts
npm run deploy -- --config deploy.config.json
-
Build the application
npm run build
-
Set production environment variables
- Update
VITE_APP_BASE_URL
to production URL - Configure production Google OAuth client
- Set
NODE_ENV=production
- Update
-
Start production server
npm start
- Journeys Manifest - Journey system documentation
- Move Deployment Guide - Smart contract deployment
- Feature Assessments - Current feature status
- Keyless Notes - Authentication implementation details
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow TypeScript best practices
- Write tests for new features
- Update documentation for API changes
- Use conventional commit messages
- Ensure all journeys follow the established contract
This project is licensed under the MIT License - see the LICENSE file for details.
- Aptos Labs for blockchain infrastructure
- Google Cloud for OAuth services
- Radix UI for accessible component primitives
- Tailwind CSS for utility-first styling
For support and questions:
- Create an issue in the repository
- Check the documentation in the
/docs
folder - Review the feature assessments for current status
Built with โค๏ธ for DeFi education and charitable giving