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 App in 5 Minutes
        • Launch a User Map App on XION in 5 Minutes
        • React Native Mobile App on XION in 5 Minutes
        • Todo App
          • Build a TODO App using the Collection-Document Storage Smart Contract
          • Build a TODO Mobile App using the DocuStore Contract
    • Mobile App Development
      • Set up your XION Mobile Development Environment
      • Build a TODO Mobile App using the DocuStore Contract
      • Create Mobile App and Integrate Meta Account Authentication
      • Building a React Native Mobile App with Abstraxion (Xion.js)
    • Getting Started (Advanced)
      • 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
      • App Development
        • Account Abstraction with Gasless Transactions
        • Interact with XION via your Backend Service
    • Re-using Existing Contracts
      • Deployed Contracts on XION
      • Non-Fungible Tokens (NFTs)
      • Fungible Tokens
      • Marketplace
      • Multisig
      • Proxy Contracts
      • Membership Management
      • Governance
      • Valuts
      • SCV Audited Contracts
    • Web3 for Web2 Developers
      • Web2 vs Web3 App Architecture: A Comparison
      • Misconceptions and Misapplied Web2 Patterns
      • Recommended Architecture for Apps on XION
    • Building for Mainnet
      • Xion Testnet: Your Development Playground
      • Building with Audited & Battle-Tested Contracts
      • Community Engagement: Building Support for Your app
      • 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
      • Oracles
        • Creating a Smart Contract with Pyth Oracle Integration
      • Indexers: Optimized Data Retrieval
        • SubQuery
      • Use Cases
        • Building a Per-User Data Storage App
        • Build a TODO App using the Collection-Document Storage Smart Contract
      • Crossmint Integration
        • Crossmint Digital Collectibles Checkout via Credit Card
    • 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
  • Todo App Data Structure
  • Todos Collection
  • Profiles Collection
  • Settings Collection
  • Building the Frontend
  • Manual Installation

Was this helpful?

Edit on GitHub
  1. developers
  2. XION Quick Start
  3. Zero to App in 5 Minutes
  4. Todo App

Build a TODO App using the Collection-Document Storage Smart Contract

To reduce the need for custom contract development and accelerate Web2 to Web3 migrations, we've created a contract that provides a collection/document based storage model, inspired by Firebase’s Firestore. It supports structured JSON data storage using a flexible key-value format and an advanced permission model.

This solution is a major upgrade from the original user_map contract by enabling:

  • Namespaced storage: Data is organized into logical collections and documents.

  • Permissioned access: Fine-grained control over who can create, update, delete, and read documents.

  • Role-based security: Support for roles like "creator", "admin", and any custom roles.

  • Batch operations: Write multiple documents in a single transaction.

Todo App Data Structure

This todo app interacts with the DocuStore smart contract by organizing data into three main collections. Each collection stores structured documents with user-specific data.

Todos Collection

interface Todo {
  id: string;
  text: string;
  completed: boolean;
  createdAt: number;
}

Each document in the todos collection represents an individual task. It includes basic task details, and timestamps.

Profiles Collection

interface Profile {
  displayName: string;
  bio: string;
  avatar: string;
  socialLinks: {
    twitter?: string;
    github?: string;
    website?: string;
  };
}

The profile collection stores public facing user profile data such as name, bio, and social media links.

Settings Collection

interface Settings {
  darkMode: boolean;
  notifications: boolean;
  language: string;
  timezone: string;
}

The settings collection holds user preferences for customizing the application experience, including UI theme, notification toggles, and localization options.

Building the Frontend

Manual Installation

  1. You will first need to clone the repository:

git clone https://github.com/burnt-labs/todo-app-frontend
  1. Install dependencies:

cd todo-app-frontend
npm install
  1. Copy the .env.example file and name it .env.local and set the values with the information below:

NEXT_PUBLIC_TREASURY_ADDRESS="xion1svpts9q2ml4ahgc4tuu95w8cqzv988s6mf5mupt5kt56gvdnklks9hzar4"
NEXT_PUBLIC_CONTRACT_ADDRESS="xion1aza0jdzfc7g0u64k8qcvcxfppll0cjeer56k38vpshe3p26q5kzswpywp9"
NEXT_PUBLIC_RPC_URL="https://rpc.xion-testnet-2.burnt.com:443"
NEXT_PUBLIC_REST_URL="https://api.xion-testnet-2.burnt.com"
Variable
Description

NEXT_PUBLIC_TREASURY_ADDRESS

Treasury contract instance used for gasless transactions and grantz authorization to execute transactions via the DocuStore smart contract instance on behalf of users.

NEXT_PUBLIC_CONTRACT_ADDRESS

Address of the DocuStore smart contract instance.

NEXT_PUBLIC_RPC_URL

RPC endpoint for Xion (default: https://rpc.xion-testnet-2.burnt.com:443)

NEXT_PUBLIC_REST_URL

REST endpoint for Xion (default: https://api.xion-testnet-2.burnt.com)

  1. Build and start the application:

npm run dev
PreviousTodo AppNextMobile App Development

Last updated 9 hours ago

Was this helpful?

We've created a frontend which is a application built to interact with the DocuStore smart contract that can be downloaded at . It showcases how users can connect their wallets, create todo records, update their profile, app settings and query their data.

You can now access the app at in your browser.

Next.js
https://github.com/burnt-labs/todo-app-frontend
http://localhost:3000