Skip to content

psam21/cb

Repository files navigation

Culture Bridge

Preserve Heritage, Empower Communities

A decentralized platform built on Nostr protocol to permanently preserve cultural practices, languages, and traditions. Empowering indigenous and minority communities to self-document their heritage without relying on centralized institutions.

🌐 Live: https://culturebridge.vercel.app

Built with Next.js TypeScript Nostr Protocol License: MIT


🎯 Mission

For too long, cultural preservation has been controlled by institutions and corporations. Culture Bridge returns this power to communities themselves, using decentralized technology to ensure traditions survive and thrive.

Why Nostr?

  • Censorship Resistant - No single entity can delete or control cultural content
  • Permanent Storage - Content lives on multiple relays across the world
  • User Sovereignty - Communities own their data and keys
  • No Middlemen - Direct peer-to-peer publishing and discovery

✨ Features

πŸ›οΈ Heritage Contributions

  • Share cultural practices, languages, and traditions
  • Multi-media support (images, videos, audio)
  • Markdown-based long-form content (NIP-23)
  • Permanent preservation on Nostr relays

πŸ›’ Decentralized Marketplace

  • List cultural items and artifacts
  • Parameterized replaceable events (NIP-33)
  • Product discovery with tags
  • Shopping cart synced to Nostr (NIP-78)

πŸ’¬ Private Messaging

  • End-to-end encrypted messages (NIP-17)
  • Gift-wrapped encryption (double encryption)
  • Message attachments (images, videos, audio)
  • Conversation context with product/heritage references

πŸ‘€ Self-Sovereign Identity

  • Own your identity with Nostr keys
  • Profile management (Kind 0)
  • NIP-05 verification
  • Lightning address support

πŸ“Š Analytics Dashboard

  • Event publishing tracking
  • Redis-powered analytics
  • User event history
  • Relay health monitoring

πŸ—οΈ Architecture

Culture Bridge implements a strict 6-layer Service-Oriented Architecture (SOA):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  UI Layer (Pages/Components)            β”‚ ← Display only
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Hook Layer (Custom Hooks)              β”‚ ← State management
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Business Service Layer                 β”‚ ← Orchestration
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Event Service Layer (Nostr)            β”‚ ← Event creation
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Generic Service Layer                  β”‚ ← Infrastructure
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Core Service Layer                     β”‚ ← Logging, caching
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

  • Frontend: Next.js 15.4 (App Router), React 18, TypeScript 5.5
  • Styling: Tailwind CSS with custom design tokens
  • State Management: Zustand (with persistence)
  • Nostr Integration: nostr-tools 2.17, custom service layer
  • File Storage: Blossom (decentralized CDN)
  • Database: Redis (Upstash KV for analytics)
  • Rich Text: TipTap with Markdown support
  • Animations: Framer Motion
  • Deployment: Vercel

πŸš€ Getting Started

Prerequisites

  • Node.js 20+ and npm
  • Nostr browser extension (Alby, nos2x, Nostore) or use built-in key management

Installation

# Clone the repository
git clone https://github.com/psam21/cb.git
cd cb

# Install dependencies
npm install

# Run development server
npm run dev

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

Build for Production

# Build optimized production bundle
npm run build

# Start production server
npm start

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build production bundle
  • npm run start - Start production server
  • npm run lint - Run ESLint
  • npm run lint:fix - Fix ESLint errors
  • npm run typecheck - TypeScript type checking
  • npm run format - Format code with Prettier

πŸ“‘ Nostr Implementation

Supported NIPs

  • NIP-01 - Basic protocol flow
  • NIP-05 - DNS-based verification
  • NIP-07 - Browser extension signer
  • NIP-09 - Event deletion
  • NIP-17 - Private direct messages
  • NIP-23 - Long-form content
  • NIP-33 - Parameterized replaceable events
  • NIP-44 - Encrypted payloads (v2)
  • NIP-78 - Application-specific data
  • NIP-94 - File metadata

Event Kinds Used

  • Kind 0 - User profiles
  • Kind 1 - Text notes (welcome messages)
  • Kind 5 - Event deletion
  • Kind 14 - Rumor (NIP-17 inner message)
  • Kind 1059 - Gift wrap (NIP-17 encryption)
  • Kind 10063 - Blossom server list
  • Kind 24242 - Blossom authorization
  • Kind 30023 - Products & heritage contributions
  • Kind 30078 - Cart & app data storage

Relay Configuration

Connected to 8 high-reliability relays:

  • relay.damus.io
  • relay.snort.social
  • relay.nostr.band
  • relay.primal.net
  • offchain.pub
  • shu01.shugur.net (35+ NIPs)
  • relay.0xchat.com (messaging-focused)
  • relay.nostr.wirednet.jp (APAC)

πŸ—‚οΈ Project Structure

cb/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js app router pages
β”‚   β”‚   β”œβ”€β”€ shop/              # Marketplace pages
β”‚   β”‚   β”œβ”€β”€ heritage/          # Heritage contribution pages
β”‚   β”‚   β”œβ”€β”€ messages/          # Private messaging
β”‚   β”‚   β”œβ”€β”€ profile/           # User profile
β”‚   β”‚   └── api/               # API routes
β”‚   β”œβ”€β”€ components/            # React components
β”‚   β”‚   β”œβ”€β”€ primitives/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ shop/              # Shop-specific components
β”‚   β”‚   β”œβ”€β”€ heritage/          # Heritage components
β”‚   β”‚   └── auth/              # Authentication forms
β”‚   β”œβ”€β”€ services/              # Service layer (SOA)
β”‚   β”‚   β”œβ”€β”€ core/              # Core services (logging, KV)
β”‚   β”‚   β”œβ”€β”€ generic/           # Generic infrastructure
β”‚   β”‚   β”œβ”€β”€ nostr/             # Nostr event facade
β”‚   β”‚   └── business/          # Business logic orchestration
β”‚   β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”œβ”€β”€ stores/                # Zustand state stores
β”‚   β”œβ”€β”€ types/                 # TypeScript type definitions
β”‚   β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”œβ”€β”€ config/                # Configuration files
β”‚   β”œβ”€β”€ errors/                # Error handling
β”‚   └── styles/                # Global styles
β”œβ”€β”€ docs/                      # Documentation
β”‚   β”œβ”€β”€ cb-critical-guidelines.md
β”‚   └── nip-kind-implementation-matrix.md
β”œβ”€β”€ public/                    # Static assets
└── package.json

πŸ” Security & Privacy

Authentication

  • Dual Authentication: Browser extension (NIP-07) or nsec storage
  • Keys never leave the user's device
  • All event signing requires user approval

Encryption

  • NIP-44 v2 - Modern ChaCha20-Poly1305 encryption
  • NIP-17 - Double gift-wrap for messages
  • IndexedDB - Encrypted cache storage with AES-256-GCM
  • PBKDF2 - 100k iterations for key derivation

Data Ownership

  • Users control their private keys
  • Content published to multiple relays
  • No centralized database for user data
  • Logout clears all browser storage

πŸ“š Documentation


🀝 Contributing

We welcome contributions! Please follow these guidelines:

  1. Read the guidelines: Check docs/cb-critical-guidelines.md
  2. Follow SOA: Respect the 6-layer architecture
  3. Build before commit: npm run build must pass
  4. Write tests: Manual end-to-end verification required
  5. Document changes: Update relevant docs

Development Workflow

# 1. Build (must pass with 0 errors)
npm run build

# 2. Fix any errors/warnings iteratively
npm run lint:fix

# 3. Stage changes
git add .

# 4. Commit with detailed message
git commit -m "feat: Description of WHAT and WHY"

# 5. Push
git push origin main

# 6. Verify on production
# Visit https://culturebridge.vercel.app

πŸ“Š Key Metrics

  • 10 NIPs implemented
  • 9 Event Kinds supported
  • 8 Relays connected
  • 21 Services in SOA architecture
  • 6 Layers of separation of concerns

🌟 Roadmap

Current Features

  • βœ… Heritage contributions
  • βœ… Decentralized marketplace
  • βœ… Private messaging (NIP-17)
  • βœ… Shopping cart with relay sync
  • βœ… Analytics dashboard
  • βœ… Profile management

Future Enhancements

  • πŸ”„ NIP-46 (Remote signer protocol)
  • πŸ”„ NIP-65 (Relay list metadata)
  • πŸ”„ WebSocket profile updates
  • πŸ”„ Video/audio streaming optimization
  • πŸ”„ IPFS fallback for media

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Nostr Protocol - For building censorship-resistant infrastructure
  • Blossom - For decentralized file hosting
  • Community - For preserving and sharing cultural heritage

πŸ“ž Support


πŸ’š Built With Love

Built with ❀️ for cultural preservation and community empowerment