Initialize App
Step-by-step setup for building an appchain-backed app, modeled after Adrift
Getting Started
This guide will help you set up a new appchain backed project, following the structure of Adrift. You'll create a monorepo with a Next.js frontend, a Ponder indexer, a Bun-powered backend, and Foundry contracts.
Quick Start
1. Install Bun & Foundry
Bun is a fast, modern JavaScript/TypeScript package manager and runtime, used in Adrift for installing dependencies, running scripts, and executing backend jobs. Foundry is a powerful toolkit for developing, testing, and deploying Solidity smart contracts, chosen for its speed and developer experience.
Follow the official instructions for your platform to install both tools before proceeding.
2. Create Your Project Structure
Adrift uses a monorepo structure to keep the frontend, indexer, backend, and contracts organized in one place. This makes development, dependency management, and deployment easier for complex, multi-component apps.
3. Scaffold the Frontend (Next.js + Bun)
Next.js is a popular React framework for building fast, modern web apps. In Adrift, it powers the user interface and client-side logic. Bun is used here for dependency management and running the app.
4. Scaffold the Indexer (Ponder)
Ponder is a TypeScript-first, developer-friendly tool for indexing blockchain events and syncing onchain data to a local database. Adrift uses Ponder to track game and player state, making it easy to build real-time, onchain-powered UIs.
5. Scaffold the Contracts (Foundry)
Foundry is used for all smart contract development in Adrift. It provides fast compilation, testing, and deployment for Solidity contracts, and is widely adopted in the Ethereum ecosystem.
Project Structure
This structure keeps each part of your appchain project modular and maintainable, following the Adrift example.
Install Dependencies
Running the Apps
- Frontend (Next.js + Bun):
- Indexer (Ponder):
- Contracts:
Next Steps
- Configure your chain connection in
apps/site/utils/chain.ts
- Set up wallet integration with Wagmi and Para in the frontend
- Define your Ponder schema and event handlers in the indexer
- Implement your contract logic and deployment scripts in
contracts/
- Build your UI and hooks for game logic, player state, and randomness
For more details, see the Adrift repo and the deeper guides on contracts, wallet setup, sequencing, indexer, and game logic.