LogoLogo
  • ๐Ÿš€DeSo Vision
  • ๐Ÿช™DeSo Tokenomics
    • No Equity, Just Coins and Code
    • Current DESO Supply
    • Initial DESO Distribution
    • DESO Sinks
    • The BMF: Burn-Maximizing Fee Mechanism
    • Designed for the End-Game
  • ๐Ÿ›๏ธDeSo Governance
  • โญDeSo Tutorial (Build Apps)
  • ๐Ÿ–ฅ๏ธNode Architecture Overview
    • Setup a Node & Frontend Locally
    • Making Your First Changes
  • ๐Ÿ“…DeSo Roadmap
  • ๐Ÿ”DeSo Block Explorer
  • ๐Ÿ’ธDeSo Wallet
  • ๐Ÿ’ฌDeSo Chat Protocol
  • ๐Ÿ‘ฝOpenfund
  • ๐Ÿ‘€Focus
  • ๐Ÿ› ๏ธDeSo Tech Stack
  • ๐ŸŒDeSo Applications
  • DeSo Blockchain
    • 1๏ธโƒฃBare Metal
    • 2๏ธโƒฃScaling Roadmap
    • 3๏ธโƒฃContent Moderation
    • 4๏ธโƒฃInfinite-State
    • 5๏ธโƒฃOn-Chain Data
    • 6๏ธโƒฃSmart Services
    • 7๏ธโƒฃUser Security
  • DeSo Features
    • 1๏ธโƒฃAssociations
    • 2๏ธโƒฃCreator Coins
    • 3๏ธโƒฃFeeds & Moderation
    • 4๏ธโƒฃSocial NFTs
    • 5๏ธโƒฃSocial Tipping
  • DeSo Identity
    • 1๏ธโƒฃIdentity: Overview
      • Core Concepts
      • Mobile Integration
    • 2๏ธโƒฃIdentity: iFrame API
      • Overview
      • Endpoints
    • 3๏ธโƒฃIdentity: Window API
      • Overview
      • Endpoints
  • DESO FRONTEND
    • 1๏ธโƒฃFrontend: Get Started
    • 2๏ธโƒฃFrontend: React Example
  • 3๏ธโƒฃFrontend: NextJS Example
  • DESO BACKEND
    • 1๏ธโƒฃBackend: Config
      • Onboarding
      • Phone Number Verification
      • Global State
      • Admins
      • Web Security
      • Media
        • Images
        • Videos
      • Hot Feed
      • Selling $DESO
        • Wyre - Buy with USD
        • Buy with BTC
        • Buy with ETH
      • Analytics
      • Emails
      • Supply Monitoring
    • 2๏ธโƒฃConstruct: API
      • Social Transactions API
      • NFT Transactions API
      • Financial Transactions API
      • Derived Keys Transaction API
      • DeSo Tokens Transactions API
      • Associations Transactions API
      • Access Groups API
    • 3๏ธโƒฃData: API
      • Admin Endpoints
      • Associations Endpoints
      • DeSo Tokens Endpoints
      • Media Endpoints
      • Miner Endpoints
      • Notification Endpoints
      • NFT Endpoints
      • Social Endpoints
      • Referral Endpoints
      • Tutorial Endpoints
      • Meta Data Endpoints
      • Transaction Spending Limits Endpoints
      • User Endpoints
      • Post Endpoints
      • Messages Endpoints
      • Access Group Endpoints
    • 4๏ธโƒฃTransactions: API
  • DeSo Exchange Listings
    • 1๏ธโƒฃExchange Listing: API
  • DeSo Nodes
    • 2๏ธโƒฃNode: Setup
    • 3๏ธโƒฃNode: Staying Up-To-Date
    • 4๏ธโƒฃNode: FAQ
  • DESO VALIDATORS
    • 1๏ธโƒฃRun a Validator
  • Openfund
    • What is Openfund?
    • Openfund Tokenomics
    • Openfund Governance
    • Algorithmic Trading
      • The DeSo Python SDK
    • The DeSo Python SDK
      • Getting Help from the Community
      • Creating DeSo Testnet Accounts
      • Debugging Tips and Code Walkthrough
      • Write Blockchain Bots with AI
      • Market-Making Bots
      • Social AI Agents
      • AI-Generating Your Code
    • How Do the Advanced AMMs Work?
  • Focus
    • The Crypto Social Network
    • Next-Generation Token Mechanics
      • Launching Your Token
      • How the Order-Book AMMs Work
    • Crypto-Native Monetization
    • Focus Tokenomics
    • The Social Airdrop
    • Decentralizing Social Media
  • Contact And Media
    • โ˜€๏ธDeSo Website
    • ๐Ÿ“‘DeSo Blog
    • ๐Ÿ’ปDeSo Github
    • ๐Ÿ’ŽDeSo Diamond
    • ๐ŸฆDeSo Twitter
    • ๐Ÿ“บDeSo YouTube
    • ๐Ÿ“ฌContact US
    • โš ๏ธReporting an Account or Post
  • ไธญๆ–‡
    • ไป€ไนˆๆ˜ฏDeSo? (What is DeSo?)
    • ๆ„ฟๆ™ฏ (The Vision)
Powered by GitBook
On this page
  • ๐Ÿ”ฅ Features
  • ๐Ÿš€ Getting Started
  • ๐Ÿงช Storybook
  • ๐Ÿ›  Tech Stack
  • ๐Ÿงฉ Folder Structure
  • ๐Ÿ”ง Query Configuration
  • ๐Ÿ“œ License
  • ๐Ÿค Contributing
  • ๐ŸŒ Credits
  • ๐Ÿชฒ Known Issues and Bug Reports

Was this helpful?

Frontend: NextJS Example

DeSo Frontend Starter for NextJS and React apps

PreviousFrontend: React ExampleNextBackend: Config

Last updated 5 minutes ago

Was this helpful?

Primary Contributor & Maintainer:

A modern frontend web application built using Next.js App Router and designed to integrate with the โ€” a decentralized social blockchain platform.

๐Ÿ“ฆ Repository:

This starter includes:

  • DeSo authentication via Identity service

  • Profile selector and alternate identity switching

  • Advanced commenting system with optimistic updates

  • Network-resilient data fetching and caching

  • Clean UI component system (Buttons, Inputs, Dropdowns, Select, etc.)

  • Support for Floating UI dropdowns and portals

  • Dark/light theming via CSS variables

  • Storybook for component exploration


๐Ÿ”ฅ Features

  • ๐Ÿ” DeSo Auth: Log in using DeSo Identity

  • ๐Ÿ‘ฅ Alt Profile Switcher: Switch between multiple public keys

  • ๐Ÿ”Ž Search Profiles: Find users by public key or username

  • ๐Ÿ“ Post Support: Read and create posts on the DeSo blockchain

  • ๐Ÿ’ฌ Advanced Comments: Inline replies with optimistic updates and smart caching

  • ๐ŸŒ Network Resilient: Handles offline/online transitions gracefully

  • ๐Ÿ‘ป Profileless Accounts: Fully functional even without a user profile

  • ๐ŸŽจ Component Library: Custom Select, MenuItem, Avatar, and Dropdown components

  • ๐ŸŒ Responsive UI: Built with modular CSS and theme tokens

  • ๐Ÿ“ฆ Floating UI: Precise positioning via @floating-ui/react

  • ๐Ÿงฑ Scalable Structure: Clean folder structure for extending easily

๐Ÿง  State Management with React Query

โœ… Core Benefits:

  • Smart caching and deduplication of network requests

  • Declarative useQuery / useMutation hooks

  • Built-in error/loading states

  • React Query Devtools support (optional)

โœ… Network Resilience Features:

  • Wake-from-sleep protection - No more "failed to fetch" errors when laptop wakes up

  • Smart retry logic - Won't retry when offline or for client errors

  • Progressive retry delays - Intelligent backoff (1s, 2s, 4s, 8s, max 15s)

  • Offline awareness - Graceful handling of network transitions

  • Centralized configuration - Consistent behavior across all pages

๐Ÿ’ฌ Advanced Comment System

The commenting system features sophisticated state management and user experience optimizations:

โœ… Real-time Features:

  • Optimistic updates - Comments appear instantly while syncing to blockchain

  • Local/remote merging - Seamlessly combines user's new comments with server data

  • Infinite pagination - Load more comments on demand

  • Smart deduplication - Prevents duplicate comments across page loads

โœ… User Experience:

  • Inline replies - Reply directly from any post without page navigation

  • Expand/collapse - Show/hide comment threads with state persistence

  • Comment promotion - Local comments become permanent after server sync

  • Visual feedback - Clear loading states and error handling

Usage examples include:

  • Fetching user profiles by public key or username

  • Fetching posts and comments with infinite scroll

  • Creating replies with optimistic UI updates

  • Managing complex UI state like comment visibility

  • Handling username โ†’ public key resolution for notifications and feeds

Query keys are centralized in /queries/queryKeys.js, UI keys in /queries/uiKeys.js, and network configuration in /queries/queryClientConfig.js for consistency and maintainability.

๐Ÿ”ง Profile editing and mutations use invalidateQueries() for cache synchronization and support optimistic updates.

๐Ÿš€ Getting Started

1. Clone the repository

git clone https://github.com/brootle/deso-starter-nextjs-plus.git
cd deso-starter-nextjs-plus

2. Install dependencies

npm install

3. Start the dev server

npm run dev

Visit http://localhost:3000 to view the app.


๐Ÿงช Storybook

Run Storybook to browse UI components in isolation:

npm run storybook

Opens at: http://localhost:6006


๐Ÿ›  Tech Stack

  • UI Logic: React 19 + CSS Modules

  • State Management: React Context (Auth, User) + React Query for UI state

  • DeSo Identity: Authentication via DeSo Identity service

  • Theming: CSS variable-based dark/light support


๐Ÿงฉ Folder Structure

/api               โ†’ DeSo API abstraction hooks and handlers
/app               โ†’ Next.js App Router structure (routes, pages, layout)
/assets            โ†’ Static assets like icons and illustrations
/components        โ†’ Reusable UI components (Button, Select, Input, etc.)
/config            โ†’ Environment-independent constants (e.g. API base URLs)
/context           โ†’ Global state via React Context API (Auth, User, QueryProvider)
/hooks             โ†’ Custom React hooks (e.g. useClickOutside, useToast)
/layouts           โ†’ Shared layout components (MainLayout, etc.)
/queries           โ†’ React Query configuration and key definitions
  โ”œโ”€โ”€ queryKeys.js         โ†’ API query keys
  โ”œโ”€โ”€ uiKeys.js           โ†’ UI state keys  
  โ”œโ”€โ”€ queryClientConfig.js โ†’ Network-aware configuration
  โ””โ”€โ”€ index.js            โ†’ Clean exports
/styles            โ†’ Theme system and shared styles (CSS Modules + variables)
/utils             โ†’ Helper functions (auth, DeSo profiles, tokens)

๐Ÿ”ง Query Configuration

The app features a sophisticated React Query setup optimized for reliability:

Network-Aware Retry Logic

// Won't retry when offline or for client errors (4xx)
// Uses progressive delays: 1s โ†’ 2s โ†’ 4s โ†’ 8s โ†’ max 15s
const networkAwareRetry = (failureCount, error) => {
  if (!navigator.onLine) return false;
  if (error?.status >= 400 && error?.status < 500) return false;
  return failureCount < 2;
};

Wake-from-Sleep Protection

// Prevents "failed to fetch" errors when laptop wakes up
refetchOnReconnect: false,  // Key setting
refetchOnWindowFocus: false,

Smart Cache Management

  • API queries: 2-minute stale time, 10-minute cache time

  • Search queries: 30-second stale time for fresh results

  • Comments: Infinite stale time for persistent threading

  • UI state: Cached for consistent user experience


๐Ÿ“œ License

This project is open-sourced under the MIT License.


๐Ÿค Contributing

Pull requests are welcome! Open issues or suggestions any time.


๐ŸŒ Credits


๐Ÿชฒ Known Issues and Bug Reports

During development, several minor issues were identified with the DeSo backend API:

Open Issues

Resolved Issues

If you encounter additional issues, please report them via the appropriate GitHub repository.

This starter uses for efficient, declarative data fetching and caching with enterprise-grade reliability.

Framework: (v15.2.4)

Data Fetching & Caching: with network-aware configuration

Floating Dropdowns:

Built using the โ€” the decentralized social blockchain.

Unresolved: See for details on an issue that remains open.

Fixed: A previously reported bug has been addressed. Refer to for more information.

3๏ธโƒฃ
@brootle
DeSo Protocol
brootle/deso-starter-nextjs-plus
TanStack React Query
Next.js App Router
React Query v5
@floating-ui/react
DeSo Protocol
this bug report
this issue