XION
DiscordGithub
  • Welcome to XION
  • XION'S Core
    • Concepts
      • Generalized Chain Abstraction
      • Intro to Account Abstraction
      • XION's Meta Accounts
      • Meta Accounts Design
      • Architecture & Tech Glossary
      • Use Cases
  • developers
    • Xion Quick Start
      • Zero to Dapp in 5 Minutes
        • Launch a User Map Dapp on XION in 5 Minutes
        • React Native Mobile Dapp on XION in 5 Minutes
      • Set Up Local Environment
        • Setting up your Local Smart Contract Development Environment for XION
          • Setting up your XION Smart Contract Development Environment on Windows (WSL2 + Ubuntu)
        • Set Up an Integrated Development Environment (IDE)
        • Interacting with Xion Chain using Xion Daemon
      • Your First Contract
        • Deploying Your First Smart Contract on XION
      • Gasless UX & Permission Grants
        • Enabling Gasless Transactions with Treasury Contracts
      • Your First DApp
        • Account Abstraction with Gasless Transactions
        • Interact with XION via your Backend Service
    • Web3 for Web2 Developers
      • Web2 vs Web3 App Architecture: A Comparison
      • Misconceptions and Misapplied Web2 Patterns
      • Recommended Architecture for Dapps on XION
    • Building for Mainnet
      • Xion Testnet: Your Development Playground
      • Building with Audited & Battle-Tested Contracts
      • Community Engagement: Building Support for Your dApp
      • Deploying to Xion Mainnet
        • Smart Contract Audits: Process, Costs & Support
        • Governance Process to Deploying Smart Contracts to Mainnet
    • Learn & Build
      • Token Factory
        • Creating, Minting, and Interacting with a Token Factory Token
        • Building a React dApp to Interact with Token Factory Tokens
        • Integrating a Token Factory Token in a Smart Contract
      • Websockets
        • WebSockets with Xion: Real-Time Communication
      • Mobile Development
        • Building a React Native Mobile App with Abstraxion (Xion.js)
      • Oracles
        • Creating a Smart Contract with Pyth Oracle Integration
      • Indexers: Optimized Data Retrieval
        • SubQuery
      • Use Cases
        • Building a Per-User Data Storage Dapp
    • Reference and Resources
      • Requesting XION Testnet Tokens
      • Public Endpoints & Resources
      • Block Explorers
      • Governance
        • Deploying Smart Contracts to Mainnet
      • Developer Tools: Abstract
      • IBC Denoms on XION Networks
      • Frequently Asked Questions
      • XION Token Contract Addresses on EVM Chains
  • Nodes & Validators
    • Run a Node
      • System Specifications
      • Build the Xion Daemon
      • Download the Xion Daemon
      • Configure the Xion Daemon
        • app.toml
        • client.toml
        • config.toml
      • Join the XION Network
        • xion-testnet-1
      • Confirm node is running
    • Become a Validator
      • Initial Setup
      • Obtain a XION Wallet Address
      • Obtain Funds
        • Testnet
      • Create Validator
    • IBC Relayers and Tokens
  • Others
    • Resources
Powered by GitBook
On this page
  • Architectural Overview
  • Key Components Explained
  • Frontend (React/Vue + xion.js)
  • Smart Contracts (CosmWasm in Rust)
  • Optional Indexer (SubQuery, Numia indexer)
  • Optional Storage Layer (IPFS / Jackal)

Was this helpful?

Edit on GitHub
  1. developers
  2. Web3 for Web2 Developers

Recommended Architecture for Dapps on XION

PreviousMisconceptions and Misapplied Web2 PatternsNextBuilding for Mainnet

Last updated 22 days ago

Was this helpful?

Building dapps on XION opens the door to a decentralized and user-friendly development model, but to fully take advantage of it, you need to rethink how your app is structured. This guide outlines a recommended architecture for developing scalable, secure, and gasless dapps on XION using smart contracts, modern frontend tools, and built-in wallet functionality.

Architectural Overview

At a high level, a typical XION dapp consists of the following components:

  • Frontend: A browser-based or mobile user interface that connects directly to the blockchain.

  • Wallet Layer: Wallets are generated and managed on the frontend using the abstraxion library.

  • Smart Contracts: Core business logic written in Rust using the CosmWasm framework and deployed to the XION blockchain.

  • Optional Indexer: An off-chain service (e.g. SubQuery) that provides advanced filtering, aggregation, and data access from the blockchain for frontend consumption.

  • Optional Storage Layer: For storing large or private files, decentralized storage solutions like IPFS or Jackal can be integrated.

Key Components Explained

Frontend (React/Vue + xion.js)

  • Built using modern JavaScript frameworks like React or Vue, the frontend serves as the primary interface for users to interact with your dapp.

  • Wallet creation, login, and transaction signing are handled via abstraxion, a sub-package of xion.js, which eliminates the need for external wallets or browser extensions.

  • User onboarding is seamless, you can programmatically set up a fee grant via XION Treasury Contracts, allowing your dapp to cover the gas costs for users.

  • XION’s treasury contracts go even further by enabling a Web2-style authorization model. Users can approve a Grantz (similar to OAuth2 scopes), authorizing your frontend to send signed transactions on their behalf, no wallet popups required.

  • The frontend communicates directly with deployed smart contracts and the XION blockchain via RPC, gRPC, REST APIs, or WebSockets using xion.js.

  • Since your frontend is entirely static, it can be deployed to platforms like Vercel, Netlify, or any CDN. The full dapp loads in the user's browser, there's no need for server-side rendering or backend infrastructure.

Smart Contracts (CosmWasm in Rust)

  • All core business logic is implemented as CosmWasm smart contracts, written in Rust and deployed to the XION blockchain.

  • Contracts store critical application state using a key-value data model, secured and managed on-chain.

  • Common use cases include:

    • Managing token balances

    • Storing profile metadata

    • Handling voting, staking, or other custom logic

Smart contracts are deterministic, upgradeable (via migrations), and auditable, forming the trusted core of your dapp.

Optional Indexer (SubQuery, Numia indexer)

  • For apps that require complex queries, analytics, filtering, or historical lookups, an indexer is essential.

  • Tools like SubQuery or Numia parse blockchain data and expose it via GraphQL or REST APIs, making it easy to power advanced frontend views without querying the chain directly.

  • Improves performance, scalability, and responsiveness of your UI.

Optional Storage Layer (IPFS / Jackal)

  • On-chain storage is expensive and limited, use decentralized storage networks like IPFS or Jackal to store:

    • Large files (images, PDFs)

    • Encrypted or private user content

    • NFT metadata and media

  • Smart contracts can reference these assets via content hashes, ensuring verifiability while offloading heavy data.