Making Your Website Arweave Compatible

Learn how to prepare your web application for deployment on the Arweave permaweb. This guide covers essential modifications needed for different frameworks and explains important concepts for permaweb compatibility.

Hash Routing Requirements

Why Hash Routing?

When deploying applications to Arweave, hash routing is essential for several reasons:

  1. Serverless Architecture

    • Arweave is a decentralized storage network without traditional servers

    • No server-side routing is available to handle clean URLs

    • Hash-based routing ensures all navigation happens client-side

  2. Data Permanence

    • Content on Arweave is immutable once stored

    • Hash routing enables "dynamic" content within this immutable structure

    • Allows for SPA-like navigation without server intervention

  3. Performance Benefits

    • All necessary code loads once at initial request

    • Reduces network requests during navigation

    • Improves overall application performance

Without hash routing, your application's routes may break when users refresh the page or share direct links.

Framework-Specific Configuration

Choose your framework below for specific configuration instructions:

ReactJS Configuration

  1. Use HashRouter from react-router-dom:

import { HashRouter } from 'react-router-dom';

function App() {
  return (
    <HashRouter>
      {/* Your routes here */}
    </HashRouter>
  );
}
  1. Modify package.json:

{
  "scripts": {
    "build": "PUBLIC_URL=./ react-scripts build"
  }
}

File Path Requirements

Using Relative Paths

All assets in your application must use relative paths because:

  1. Gateway Flexibility

    • Your app can be accessed through different Arweave gateways

    • Absolute paths tied to specific domains won't work

    • Relative paths ensure resource accessibility regardless of gateway

  2. Decentralized Nature

    • No central server or root directory exists

    • Files must be referenced relative to their location

    • Ensures assets are found regardless of access point

Path Configuration Guidelines

Follow these rules for proper path configuration:

  1. Asset References

    • Use ./ prefix for same-directory resources

    • Use relative paths for images, styles, and scripts

    • Avoid absolute paths starting with /

  2. Common Patterns

    ✅ Good: ./images/logo.png
    ✅ Good: ../assets/style.css
    ❌ Bad: /images/logo.png
    ❌ Bad: https://mysite.com/images/logo.png
  3. Directory Navigation

    • Same directory: ./file.jpg

    • Child directory: ./images/file.jpg

    • Parent directory: ../file.jpg

Deployment Checklist

Before deploying, verify these items:

For HTML/CSS/JS applications without a framework, no special configuration is needed. You can deploy your files directly!

Common Issues and Solutions

Broken images after deployment
  • Check image paths are relative

  • Verify image files are included in build

  • Ensure correct case sensitivity in filenames

Routes not working on refresh
  • Confirm hash routing is properly implemented

  • Check router configuration

  • Verify base URL configuration

Assets not loading
  • Check for absolute paths in code

  • Verify build configuration

  • Ensure all assets are included in build directory

Next Steps

Once your application is properly configured: