Skip to content

Unlock the power of Pi Network with in-depth developer guides, API documentation, blockchain resources, and Pi app tutorials. Explore comprehensive docs at our wiki: https://github.com/alxspiker/Pi-Developer-Handbook/wiki

Notifications You must be signed in to change notification settings

alxspiker/Pi-Network-Developer-Docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯§ Pi Developer Handbook

Massive overhaul to this project!

The Complete Resource for Building Pi Network Applications

Pi Network Documentation Examples Hybrid Apps

Build applications that work seamlessly in both Web2 and Web3 environments

πŸ“– View Documentation β€’ πŸš€ Get Started β€’ πŸ’» Examples β€’ πŸ”„ Migration Guide


🌟 What's New: Hybrid App Architecture

Revolutionary Update! This handbook now includes comprehensive support for hybrid applications that provide seamless experiences across both regular browsers and Pi Browser:

  • βœ… Smart Pi Browser Detection - Automatically detect user environment
  • βœ… Graceful Fallbacks - Clean UI for non-Pi Browser users
  • βœ… No Scary Popups - Better authentication flows
  • βœ… Broader Reach - Support both Web2 and Web3 users
  • βœ… Future-Proof - Ready for Pi Network mainstream adoption

πŸš€ Quick Start

For New Developers

# 1. Clone this repository
git clone https://github.com/alxspiker/Pi-Developer-Handbook.git
cd Pi-Developer-Handbook

# 2. Explore the examples
cd examples/

# 3. Check out the hybrid app guide
# Visit: wiki/Pi-Browser-Detection

For Existing Pi Apps

Need to upgrade your app to hybrid architecture? πŸ“š Migration Guide - Step-by-step upgrade instructions

πŸ“š Documentation Structure

Core Guides

Guide Description Best For
Pi Browser Detection Build hybrid apps for Web2 & Web3 Essential for all new apps
SDK Reference Complete Pi SDK documentation API integration
Authorization User authentication patterns Login systems
Payments Payment integration guide Monetization

Platform Understanding

πŸ’» Code Examples

Updated Examples with Hybrid Support

Example Description Technologies
basic-login-and-pay Simple authentication + payments Vanilla JS, HTML
python-login-pay-subscriptions Subscription service with Flask Python, Flask, JavaScript
Pi-Network-SDK-Example Comprehensive SDK showcase HTML, JavaScript

All examples now include:

  • πŸ” Pi Browser detection
  • 🎨 Fallback UI for regular browsers
  • πŸ‘€ User-initiated authentication
  • πŸ’³ Conditional payment flows
  • πŸ›‘οΈ Proper error handling

Quick Example - Hybrid Authentication

// Modern hybrid app approach
async function initializeApp() {
  const isPiBrowser = await detectPiBrowser();
  
  if (!isPiBrowser) {
    // Show fallback for regular browsers
    showPiBrowserRequired();
    return;
  }

  // Only show Pi features in Pi Browser
  enablePiFeatures();
}

async function handleLogin() {
  try {
    const auth = await Pi.authenticate(['payments'], onIncompletePaymentFound);
    console.log('βœ… Authentication successful:', auth);
  } catch (error) {
    console.error('❌ Authentication failed:', error);
  }
}

πŸ—οΈ Architecture Benefits

Traditional Approach vs Hybrid Approach

Aspect Traditional Hybrid (Recommended)
Browser Support Pi Browser only All browsers with smart fallbacks
User Experience Scary popups in regular browsers Clean, professional experience
Market Reach Pi Network users only Web2 + Web3 audiences
Authentication Auto-login (poor UX) User-initiated (better UX)
Payments Hard failures Graceful degradation

πŸ› οΈ Developer Tools

Utility Functions

  • Pi Browser Detection - Smart detection with fallbacks
  • Authentication Helpers - User-initiated login patterns
  • Payment Wrappers - Conditional payment flows
  • Fallback UI Generators - Professional non-Pi Browser experiences

Testing Checklist

  • Works in regular browsers (Chrome, Firefox, Safari)
  • Works in Pi Browser with full functionality
  • No authentication popups in regular browsers
  • Clear messaging for non-Pi Browser users
  • Proper error handling and cleanup

🀝 Contributing

We welcome contributions! Here's how you can help:

  1. Documentation - Improve guides and tutorials
  2. Examples - Add new code samples
  3. Bug Reports - Report issues with existing examples
  4. Feature Requests - Suggest new guides or improvements

πŸ“– Contributing Guidelines - Detailed contribution instructions

πŸ“ž Community & Support

πŸ“„ Resources

Official Pi Network

Developer Resources


πŸš€ Ready to build the future of Pi Network applications?

πŸ“– Start with the Documentation β€’ πŸ’» Explore Examples β€’ πŸ”„ Upgrade Existing Apps

Let's build amazing Pi Network applications together!

Contributors 2

  •  
  •