A simple decentralized message board powered by Arkiv. This is the starter template for the Serverless DApp 101 tutorial.
- Read path: Querying Arkiv entities via
createPublicClient+ query builder - Write path: Server-signed writes via Next.js API routes (Phase 0)
- Optimistic UI: Handling "submitted vs indexed" states gracefully
- Error handling: Timeout, rate limit, and network error classification
- Shared space: Uses
SPACE_ID=nsso all messages appear on the main demo page
-
Fork this repository on GitHub
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/arkiv-hello-world.git cd arkiv-hello-world -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env and set: # - SPACE_ID=ns (shared workshop space - already set) # - ARKIV_PRIVATE_KEY=0x... (your testnet wallet private key)
-
Get testnet tokens:
- Generate a wallet using the Arkiv Getting Started guide
- Get testnet tokens from the Mendoza Testnet Faucet
- Add your private key to
.env
-
Run development server:
npm run dev
-
Visit:
- Homepage:
http://localhost:3000 - Hello World Demo:
http://localhost:3000/hello-world
- Homepage:
This demo uses SPACE_ID=ns by default. This means:
- ✅ Messages from any wallet will appear on the main demo page
- ✅ All tutorial participants can see each other's messages
- ✅ Demonstrates the decentralized nature of Arkiv
- ✅ No central database - all data is on-chain
When you create a message from your local app, it will appear on:
- Your local app at
http://localhost:3000/hello-world - The main demo at
https://serverlessdapp101.vercel.app/hello-world - Any other app using
SPACE_ID=ns
arkiv-hello-world/
├── app/
│ ├── hello-world/page.tsx # Message board UI
│ ├── api/serverless-dapp101/
│ │ └── messages/route.ts # Messages API
│ ├── page.tsx # Homepage
│ └── layout.tsx # Root layout
├── lib/
│ ├── arkiv/
│ │ ├── client.ts # Arkiv client utilities
│ │ └── transaction-utils.ts # Transaction helpers
│ └── config.ts # Configuration (SPACE_ID, etc.)
├── .env.example # Environment variable template
└── README.md # This file
- Writing messages: When you submit a message, it's sent to
/api/serverless-dapp101/messages(POST) - Creating entities: The API creates a
workshop_messageentity on Arkiv with your message - Shared space: All entities use
spaceId='ns', so they're queryable by anyone - Reading messages: The page queries all
workshop_messageentities withspaceId='ns' - Decentralized: No central database - all data lives on Arkiv (Mendoza testnet)
- View on Explorer: Each message has both Entity and Transaction links to verify on-chain:
- Entity link: View the entity (data structure) on the explorer
- Transaction link: View the transaction (blockchain operation) on the explorer
- Shared visibility: Your messages appear on the main demo page immediately
- Independent verification: Anyone can query the same data independently
- Serverless DApp 101 Tutorial - Full tutorial
- Arkiv Network - Official documentation
- Arkiv Getting Started - Wallet generation
- Mendoza Testnet Faucet - Get testnet tokens
MIT