A social wiki where every page you write is a fundraiser.
WeWrite transforms knowledge sharing into a collaborative economy where writers earn direct USD payments from their contributions and readers support creators with transparent monthly funding.
- Connect With Us
- What Makes WeWrite Special
- Quick Start
- System Architecture
- Technology Stack
- Documentation
- Project Structure
- Development
- Contributing
- License
- Support
- π Website - Try WeWrite now
- πΈ Instagram - Behind the scenes and updates
- π₯ YouTube - Tutorials and feature demos
- π X - Real-time updates and community
- πΊ Twitch - Live streams and coding sessions
- π¬ Telegram - Join our community
- π Collaborative Writing - Create and edit pages together with smart versioning
- π° Direct USD Payments - Support creators with transparent monthly funding
- π Smart Linking - Connect ideas across the platform with inline pill links
- π Beautiful Interface - Clean, modern design with dark mode and glassmorphism
- π Secure & Private - Your data is protected and encrypted
- β‘ High Performance - 90% cost reduction through optimization strategies
- Node.js 20.x or higher
- Bun (preferred package manager - faster than npm/pnpm)
# Install Bun if you don't have it
curl -fsSL https://bun.sh/install | bash
# Clone the repository
git clone https://github.com/WeWriteApp/WeWrite.git
cd WeWrite
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your configuration
# Run the development server
bun devOpen http://localhost:3000 to see WeWrite in action!
graph TB
subgraph "Client Layer"
Web[Next.js Web App]
PWA[Progressive Web App]
end
subgraph "API Layer"
API[API Routes]
Webhooks[Stripe Webhooks]
Cron[Cron Jobs]
end
subgraph "Service Layer"
Auth[Authentication Service]
Payment[Payment Service]
Earnings[Earnings Service]
Email[Email Service]
Search[Search Service]
end
subgraph "Data Layer"
Firebase[(Firebase)]
Firestore[(Firestore DB)]
Storage[(Firebase Storage)]
end
subgraph "External Services"
Stripe[Stripe Payments]
Resend[Resend Email]
end
Web --> API
PWA --> API
API --> Service Layer
Webhooks --> Service Layer
Cron --> Service Layer
Service Layer --> Data Layer
Payment --> Stripe
Email --> Resend
Auth --> Firebase
sequenceDiagram
participant User
participant Frontend
participant API
participant Stripe
participant Database
participant Cron
User->>Frontend: Subscribe ($10, $20, $30)
Frontend->>API: Create Subscription
API->>Stripe: Create Checkout Session
Stripe-->>User: Payment Page
User->>Stripe: Complete Payment
Stripe->>API: Webhook: subscription.created
API->>Database: Create USD Balance
User->>Frontend: Allocate to Creators
Frontend->>API: Set Allocations
API->>Database: Store Allocations
Note over Cron,Database: End of Month
Cron->>Database: Calculate Earnings
Cron->>Database: Lock Allocations
Cron->>Stripe: Process Payouts
Stripe-->>Database: Update Payout Status
graph LR
A[User Subscription] --> B[USD Balance]
B --> C[Monthly Allocations]
C --> D[Creator Earnings]
D --> E[Payouts]
F[Unallocated Funds] --> G[Platform Revenue]
style A fill:#e1f5ff
style B fill:#fff3e0
style C fill:#f3e5f5
style D fill:#e8f5e9
style E fill:#fff9c4
style F fill:#ffebee
style G fill:#fce4ec
graph TD
subgraph "Development"
DevBranch[dev branch]
DevCollections[DEV_* Collections]
DevData[Test Data]
end
subgraph "Production"
MainBranch[main branch]
ProdCollections[Production Collections]
RealData[Real User Data]
end
DevBranch --> DevCollections
DevCollections --> DevData
MainBranch --> ProdCollections
ProdCollections --> RealData
style DevBranch fill:#e3f2fd
style MainBranch fill:#e8f5e9
- βοΈ Next.js 14 - React framework with App Router
- π₯ Firebase - Backend-as-a-Service platform
- π¨ Tailwind CSS - Utility-first CSS framework
- π Slate.js - Customizable rich text editor framework
- π³ Stripe - Payment processing and subscriptions
- π TypeScript - Type-safe JavaScript development
- ποΈ Firestore - NoSQL document database for pages, users, and versions
- π Authentication - Email/password authentication with session management
- βοΈ Functions - Serverless functions for webhooks and background processing
- π Storage - File storage for images and attachments
- π¦ Bun - Fast, disk space efficient package manager
- π Vercel - Deployment platform with automatic CI/CD
- π LogRocket - Session replay and error tracking
- π Dark Mode - System-aware theme switching with OKLCH color system
- π± Responsive Design - Mobile-first responsive interface
- π Smart Linking - Automatic page linking and backlinks with inline pills
- π° USD Creator Support - Direct USD payments with transparent monthly funding
- π Security - Comprehensive security measures and data protection
- β‘ Performance - 90% cost reduction through aggressive optimization
- Current Architecture - Complete system overview and architecture principles
- Environment Quick Reference - Development environment setup
- Performance Optimization Guide - Optimization strategies (90% cost reduction achieved)
- Authentication Architecture - Environment-specific authentication rules
- Username Security Guidelines - Prevent email exposure vulnerabilities
- User Data Fetching Patterns - Standardized patterns for secure user data handling
- Security Audit Report - Security posture and best practices
- Payments and Allocations - Main payments documentation
- Allocation System - USD allocation architecture
- Subscription System - Subscription management and Stripe integration
- Payout Troubleshooting Guide - Common payout issues and solutions
- Financial Data Architecture - Separated financial contexts architecture
- Page Data and Versions - Authoritative page data structure and version system
- Text Selection and Attribution - Selection & attribution system
- Writing Suggestions System - Writing suggestion features
- Line Based Editor - Editor implementation details
- Search Architecture - Search system architecture
- Search Performance Optimizations - Performance tuning
- Design System Architecture - FloatingCard component system and glassmorphism guidelines
- Theme System Architecture - Theme and styling system
- Complete Color System - OKLCH color space for better accessibility
- Header System - Navigation header architecture
- Performance Optimization Guide - Performance strategies
- Firebase Optimization Guide - Firebase cost and performance optimization
- Navigation Caching Optimization - Navigation performance optimization
- Logging Noise Reduction - Log management strategies
- Production Deployment Guide - Deployment procedures and best practices
- Branch Aware Development - Development workflow and environment switching
- Webhook Setup Guide - Stripe webhook configuration
- Dependency Management Standards - Package management standards
- Legacy Code Cleanup Guide - Identifying and removing deprecated patterns
For a complete list of all documentation, see docs/README.md.
WeWrite/
βββ app/ # Next.js App Router
β βββ api/ # API routes and endpoints
β β βββ admin/ # Admin API endpoints
β β βββ cron/ # Scheduled job endpoints
β β βββ webhooks/ # Stripe webhook handlers
β βββ admin/ # Admin dashboard pages
β βββ auth/ # Authentication pages
β βββ components/ # Reusable UI components
β β βββ admin/ # Admin-specific components
β β βββ editor/ # Rich text editor components
β β βββ landing/ # Landing page components
β β βββ layout/ # Layout components
β β βββ payments/ # Payment UI components
β β βββ ui/ # Shared UI components
β βββ contexts/ # React contexts for global state
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility libraries and helpers
β βββ providers/ # Context providers
β βββ services/ # Business logic services
β βββ settings/ # User settings pages
β βββ utils/ # Utility functions
βββ docs/ # Technical documentation
β βββ architecture/ # System architecture docs
β βββ auth/ # Authentication docs
β βββ deployment/ # Deployment guides
β βββ editor/ # Editor documentation
β βββ features/ # Feature-specific docs
β βββ firebase/ # Firebase patterns
β βββ payments/ # Payment system docs
β βββ performance/ # Performance guides
β βββ search/ # Search system docs
β βββ security/ # Security documentation
β βββ ui/ # UI and design docs
βββ functions/ # Firebase Cloud Functions
βββ public/ # Static assets
β βββ icons/ # App icons and favicons
β βββ images/ # Images and graphics
βββ scripts/ # Build and utility scripts
app/- Next.js 14 App Router with file-based routingapp/components/- Reusable UI components organized by featureapp/services/- Business logic services (payment, earnings, email, etc.)app/api/- API routes for backend functionalitydocs/- Comprehensive technical documentationfunctions/- Firebase Cloud Functions for webhooks and background tasks
# Start development server
bun dev
# Start with HTTPS (for PWA testing)
bun dev:https
# Build for production
bun build
# Run tests
bun test
# Run tests in watch mode
bun test:watch
# Run specific test suites
bun test:payments
bun test:payouts
bun test:allocationWeWrite uses branch-aware environment detection for local development:
- Main branch (
main): Uses production collections - connects to real data - Dev branch (
dev): Uses dev collections (DEV_*prefix) - isolated test data - Other branches: Uses dev collections (safe default) - isolated test data
This ensures you can test against production data when needed (main branch) while keeping development work safely isolated (dev branch).
Before contributing, ensure you follow:
- TypeScript strict mode - All code must be type-safe
- ESLint rules - Run
bun lintbefore committing - Security guidelines - Follow USERNAME_SECURITY_GUIDELINES
- Performance practices - Follow PERFORMANCE_OPTIMIZATION_GUIDE
WeWrite uses Vercel for automatic deployment:
- Production: Deploys from
mainbranch to wewrite.app - Preview: Deploys from
devbranch for testing - Environment Variables: Configured in Vercel dashboard
See Production Deployment Guide for detailed procedures.
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Follow our coding standards (see documentation)
- Write tests for new functionality
- Commit your changes with clear messages
- Submit a pull request
- Security First: Follow USERNAME_SECURITY_GUIDELINES
- Clean Code: Use LEGACY_CODE_CLEANUP_GUIDE
- Testing: Write comprehensive tests for all features
- Documentation: Update docs for any new features or changes
- Be respectful and inclusive
- Focus on constructive feedback
- Help create a welcoming environment for all contributors
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.
This is free software: you are free to change and redistribute it under the terms of the GPL-3.0 license.
- π§ Email: support@wewrite.app
- π¬ Discord: Join our community
- π Issues: GitHub Issues
- π Documentation: docs/ directory
Built with modern web technologies and powered by:
- Next.js - The React Framework
- Firebase - Backend-as-a-Service
- Stripe - Payment Infrastructure
- Tailwind CSS - Utility-First CSS
- Vercel - Deployment Platform
Made with β€οΈ by the WeWrite team