A modern, full-stack decentralized todo application built with Ripple.js and Shogun Core (GunDB). This application demonstrates real-time, peer-to-peer data synchronization with user authentication, showcasing how to build decentralized applications with modern web technologies.
- π― Ripple.js Framework: Modern reactive UI framework with TypeScript support
- π Decentralized Storage: Built on GunDB for peer-to-peer data synchronization
- π Authentication System: Multiple auth methods via Shogun Core (username/password, WebAuthn, Web3, OAuth)
- β‘ Real-time Sync: Automatic data synchronization across all connected peers
- π± Modern UI: Clean, responsive design with vanilla CSS
- π οΈ TypeScript: Full type safety and IntelliSense support
- π§ Vite: Fast development server and optimized builds
- π¦ Complete Implementation: Fully functional todo app with all features implemented
This application is a complete decentralized todo app featuring:
- User Authentication: Login/signup with username and password
- Real-time Data: Todos sync instantly across all connected devices
- User Space: Each user has their own private data space
- Peer Network: Connects to multiple GunDB relay servers for redundancy
- Modern Hooks: Custom Ripple.js hooks for GunDB operations
- Node.js 18+
- npm, yarn, or pnpm
- Modern web browser with ES2020+ support
-
Clone and install dependencies:
git clone <repository-url> cd my-app npm install # or yarn install
-
Start the development server:
npm run dev
-
Open your browser:
Navigate to
http://localhost:5173to see the application running. -
Build for production:
npm run build
App.ripple: Main application component with authentication and todo managementuseGunInstance.ripple: Hook for initializing GunDB connectionuseGunAuth.ripple: Hook for user authentication operationsuseGunData.ripple: Hook for data collection management
-
Authentication Flow
- User registration with username, email, and password
- Secure login with session management
- Logout functionality
-
Real-time Data Management
- Create, read, update, and delete todos
- Automatic synchronization across peers
- Optimistic UI updates
-
User Space Operations
- Private user data storage
- Collection-based data organization
- Real-time updates
The application connects to multiple GunDB relay servers for redundancy:
const peers = [
'https://relay.shogun-eco.xyz/gun',
'https://peer.wallie.io/gun',
'https://v5g5jseqhgkp43lppgregcfbvi.srv.us/gun'
];The application uses Shogun Core's Simple API for easy GunDB operations:
import { quickStart, Gun } from "shogun-core";
// Initialize Gun instance
const gun = Gun({ peers: ['https://relay.shogun-eco.xyz/gun'] });
// Quick start with simple API
const shogun = quickStart(gun, 'my-app');
await shogun.init();npm run dev- Start development server with hot reloadnpm run build- Build for productionnpm run preview- Preview production build locallynpm run format- Format code with Prettiernpm run format:check- Check code formatting
This template includes Prettier with the Ripple plugin for consistent code formatting.
Prettier is configured in .prettierrc with the following settings:
- Uses tabs for indentation
- Single quotes for strings
- 100 character line width
- Includes the
prettier-plugin-ripplefor.ripplefile formatting
For the best development experience, install these extensions:
Initializes and manages GunDB connection:
const shogun = useGunInstance({
peers: ['https://relay.shogun-eco.xyz/gun']
});Handles user authentication:
const { user, isLoggedIn, login, signup, logout } = useGunAuth(shogun);Manages data collections with real-time sync:
const { items, loading, error, add, update, remove } = useGunCollection(
shogun,
'todos',
[]
);- Automatic Synchronization: Data changes sync instantly across all connected peers
- Offline Support: Works offline and syncs when connection is restored
- Conflict Resolution: GunDB handles data conflicts automatically
- Redundancy: Multiple relay servers ensure data availability
- End-to-End Encryption: User data is encrypted using GunDB's SEA (Security, Encryption, Authorization)
- Private User Space: Each user has their own encrypted data space
- No Central Server: No single point of failure or data control
src/
βββ App.ripple # Main application component
βββ hooks/
β βββ useGunInstance.ripple # GunDB connection hook
β βββ useGunAuth.ripple # Authentication hook
β βββ useGunData.ripple # Data management hook
βββ main.ts # Application entry point
- Add new todo features like categories, due dates, or priorities
- Create additional components as
.ripplefiles - Use Shogun Core API for more complex data operations
- Leverage Ripple.js reactivity for real-time UI updates
The project includes full TypeScript support with:
- Type definitions for all Shogun Core APIs
- Ripple.js component typing
- GunDB type safety
- Custom hook type definitions
npm run buildThe build output will be in the dist/ directory, ready for deployment to any static hosting service.
- Vercel: Connect your repository for automatic deployments
- Netlify: Deploy from Git with continuous integration
- GitHub Pages: Host directly from your repository
- Any Static Host: Upload the
dist/folder to any web server
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Ripple.js - Modern reactive UI framework
- Shogun Core - Decentralized authentication and data management
- GunDB - Peer-to-peer database
- Vite - Fast build tool and dev server