How to Set Up X402 in 5 Minutes

By X402 Team | Last Updated: February 2026

Goal

Set up a complete X402 documentation repository from scratch and publish your first piece of content in under 5 minutes.

What You'll Achieve

  • Working X402 repository
  • Basic template structure
  • First batch created
  • First documentation piece written
  • Repository committed to Git

Prerequisites

  • Git installed on your computer
  • Text editor (VS Code, Sublime, or any editor)
  • GitHub account (or GitLab/Bitbucket)
  • 5 minutes of uninterrupted time

Time Required

5 minutes (actual setup: ~4 minutes, verification: ~1 minute)

Step-by-Step Instructions

Step 1: Create Repository (30 seconds)

# Create and enter directory
mkdir my-docs
cd my-docs

Initialize Git

git init

Create main INDEX file

cat > INDEX.md <<'EOF'

My Documentation

Batches

  • [ ] batch-001 — In Progress (0/1 titles)

Instructions

  1. Each batch is a separate folder
  2. Add titles to batch INDEX.md as unchecked items
  3. Complete work files in batch folder
  4. Check off items as completed
  5. Update batch status line above when done
EOF

Verify: Run ls and confirm you see INDEX.md

Step 2: Create Templates Folder (45 seconds)

# Create templates directory
mkdir templates

Create simple template

cat > templates/simple-template.md <<'EOF'

[Title]

Overview

[Brief description]

Content

[Main content here]

Next Steps

[What to do next]

Quality Standards

  • [ ] Accurate information
  • [ ] Clear writing
  • [ ] No spelling errors
  • [ ] Ready to publish
EOF

Verify: Run ls templates/ and confirm you see simple-template.md

Step 3: Create First Batch (30 seconds)

# Create batch directory
mkdir batch-001

Create batch INDEX

cat > batch-001/INDEX.md <<'EOF'

Batch 001 — Getting Started

Status: In Progress

Content Items

  • [ ] Welcome Guide

Notes

First batch to get started with X402. EOF

Verify: Run ls batch-001/ and confirm you see INDEX.md

Step 4: Write First Documentation (2 minutes)

# Create your first doc
cat > batch-001/welcome-guide.md <<'EOF'

Welcome Guide

Overview

Welcome to our documentation! This guide will help you get started.

Getting Started

Quick Start

  1. Clone the repository
  2. Read the documentation
  3. Start using the product

What's Next

After completing this guide, check out:
  • Installation Guide
  • User Manual
  • API Reference

Support

Need help? Contact support@example.com

Quality Standards

  • [x] Accurate information
  • [x] Clear writing
  • [x] No spelling errors
  • [x] Ready to publish
EOF

Verify: Run cat batch-001/welcome-guide.md to see your content

Step 5: Mark as Complete (30 seconds)

Update batch-001/INDEX.md:

# Mark item as complete
sed -i 's/- \[ \] Welcome Guide/- [x] Welcome Guide/' batch-001/INDEX.md

Update batch status

sed -i 's/Status: In Progress/Status: Complete/' batch-001/INDEX.md

Update main INDEX.md:

# Update completion count
sed -i 's/(0\/1 titles)/(1\/1 titles)/' INDEX.md

Mark batch complete

sed -i 's/- \[ \] batch-001/- [x] batch-001/' INDEX.md sed -i 's/In Progress/Complete/' INDEX.md

Verify: Run cat INDEX.md and confirm batch shows as complete

Step 6: Commit to Git (30 seconds)

# Stage all files
git add .

Create first commit

git commit -m "Initial X402 setup with first documentation"

Optional: Push to GitHub

git remote add origin https://github.com/yourusername/my-docs.git

git push -u origin main

Verify: Run git log and confirm you see your commit

Verification Checklist

Confirm everything works:

# Check repository structure
tree -L 2

Should show:

.

├── INDEX.md

├── batch-001

│ ├── INDEX.md

│ └── welcome-guide.md

└── templates

└── simple-template.md

Verify batch completion

grep "batch-001" INDEX.md

Should show: [x] batch-001 — Complete (1/1 titles)

Verify Git status

git status

Should show: nothing to commit, working tree clean

All checks passed? Congratulations! You've successfully set up X402!

What You Just Built

Your repository now includes:

  • ✓ Main INDEX.md for tracking batches
  • ✓ Template system for consistency
  • ✓ First batch with completed content
  • ✓ Git version control
  • ✓ Clear organizational structure

Troubleshooting

Issue: "command not found: git"

Solution: Install Git:
  • macOS: brew install git
  • Ubuntu/Debian: sudo apt-get install git
  • Windows: Download from git-scm.com

Issue: "sed: command not found" (Windows)

Solution: Manually edit the files instead:
  1. Open batch-001/INDEX.md in text editor
  2. Change - [ ] to - [x]
  3. Change In Progress to Complete
  4. Save and repeat for INDEX.md

Issue: Files created but can't see them

Solution:
# List all files including hidden
ls -la

Check current directory

pwd

Issue: Commit failed with "Please tell me who you are"

Solution: Configure Git:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Next Steps

Now that X402 is set up, you can:

  1. Create more content
   # Add another item to batch-001
   echo "- [ ] Installation Guide" >> batch-001/INDEX.md
   # Create the content file...
   
  1. Start a new batch
   mkdir batch-002
   # Follow the same pattern as batch-001
   
  1. Customize templates
  • Edit templates/simple-template.md
  • Create specialized templates for different content types
  • Add your organization's quality standards
  1. Enable GitHub Pages (optional)
  • Push to GitHub
  • Enable Pages in repository settings
  • Your docs are now live!
  1. Add automation
  • Set up pre-commit hooks
  • Add markdown linting
  • Configure CI/CD

Quick Reference

Create New Batch

mkdir batch-002
cat > batch-002/INDEX.md <<'EOF'

Batch 002 — [Description]

Status: In Progress

Content Items

  • [ ] Item 1
  • [ ] Item 2

Notes

[Notes about this batch] EOF

Create New Content

cp templates/simple-template.md batch-002/my-content.md

Edit batch-002/my-content.md with your content

Mark Item Complete

# In batch INDEX
  • [x] My Content # Change [ ] to [x]

Update main INDEX count

  • [ ] batch-002 — In Progress (1/2 titles)

Commit Changes

git add .
git commit -m "Add new content: [description]"
git push

Related Guides

  • How to Create Your First Batch (detailed batch creation)
  • How to Write Quality Documentation (writing tips)
  • X402 Best Practices (optimization strategies)
  • X402 Implementation Guide (comprehensive setup)

Common Questions

Q: Can I use a different folder name instead of "batch-"? A: Yes! Use any naming convention. Example: docs-001, guide-001, v1.0-docs

Q: Do I need GitHub? A: No. X402 works with any Git hosting (GitLab, Bitbucket) or even locally without remote.

Q: Can I use this for non-technical documentation? A: Absolutely! X402 works for any text-based documentation: policies, procedures, guides, manuals.

Q: What if I make a mistake? A: Git lets you undo anything:

git log  # Find commit before mistake
git reset --hard <commit-hash>  # Reset to that point

Success Criteria

You've successfully completed this guide if:

  • [ ] X402 repository exists and is initialized
  • [ ] Templates folder created with at least one template
  • [ ] First batch created and marked complete
  • [ ] First documentation piece written
  • [ ] Changes committed to Git
  • [ ] You understand how to create more content

Time spent: _____ minutes (Target: < 5 minutes)

Quality Standards

  • [x] Clear step-by-step instructions
  • [x] All commands tested and working
  • [x] Verification steps included
  • [x] Troubleshooting section complete
  • [x] Time estimate accurate
  • [x] Prerequisites listed
  • [x] Next steps provided
  • [x] Ready for production

Start Building with X402

Get our free X402 Implementation Starter Kit with ready-to-use templates, code examples, and best practices.

What is included:

  • Quick-start implementation templates
  • API integration examples
  • Configuration best practices guide

Get the Free Starter Kit