Skip to main content

Prerequisites

Before you begin, ensure you have the following installed and configured:

Node.js 18+

Download from nodejs.org

Package Manager

npm, yarn, or pnpm

Supabase Account

Sign up at supabase.com

Web3 Wallet

MetaMask or compatible wallet
You’ll also need access to Base Sepolia testnet for contract deployments and testing.

Installation

1

Clone the Repository

git clone <repository-url>
cd i_story_dapp
2

Install Dependencies

npm install
This will install all frontend dependencies, including Next.js 15.5.9, React 19, Web3 libraries (Wagmi 2.17, Viem 2.38, RainbowKit 2.2), and AI service SDKs.
3

Set Up Environment Variables

Create a .env.local file in the root directory by copying from the example:
cp .env.example .env.local
Never commit .env.local to version control! It contains sensitive API keys and secrets.
You’ll configure the specific variables in the next section.
4

Configure Supabase

Create a Supabase Project

  1. Go to supabase.com/dashboard
  2. Create a new project
  3. Navigate to Settings > API to get your credentials

Run Database Migrations

eStory includes SQL migrations for all required tables:
  • 001_create_weekly_reflections.sql - Weekly AI reflection summaries
  • 002_enable_rls_policies.sql - Row Level Security policies
  • 003_add_oauth_fields.sql - OAuth integration fields
  • 004_create_habits_tables.sql - Habit tracking tables
  • 005_create_waitlist_table.sql - Waitlist management
  • 006_create_verified_metrics_tables.sql - CRE verified metrics
Run these migrations in order through the Supabase dashboard SQL Editor.

Create Storage Bucket

Create a storage bucket named story-audio for audio file storage:
  1. Go to Storage in your Supabase dashboard
  2. Create a new bucket named story-audio
  3. Set appropriate access policies (authenticated users can upload)
5

Install Hardhat for Smart Contracts (Optional)

If you plan to deploy or test smart contracts locally:
npm install --save-dev hardhat
Smart contracts are already deployed to Base Sepolia. This step is only needed if you want to deploy your own instances or run local tests.

Verify Installation

Run the development server to verify everything is set up correctly:
npm run dev
You should see:
▲ Next.js 15.5.9
- Local:        http://localhost:3000
- Environments: .env.local

✓ Ready in 2.1s
Open http://localhost:3000 in your browser to see the app.

Project Structure

After installation, your project structure will look like this:
i_story_dapp/
├── app/                  # Next.js App Router
│   ├── api/             # API routes
│   ├── hooks/           # React hooks
│   ├── types/           # TypeScript definitions
│   ├── utils/           # Utilities
│   └── [pages]/         # Application pages
├── components/          # React components
│   ├── ui/              # shadcn/ui components
│   ├── vault/           # Local encryption components
│   └── Provider.tsx     # Web3 & Theme providers
├── contracts/           # Solidity smart contracts
│   ├── eStoryToken.sol
│   ├── StoryProtocol.sol
│   └── StoryNFT.sol
├── lib/                 # Shared libraries
│   ├── auth.ts          # Authentication utilities
│   ├── contracts.ts     # Contract addresses & ABIs
│   └── vault/           # Client-side encryption
├── scripts/             # Deployment scripts
├── supabase/           # Database migrations
├── __tests__/          # Unit tests
└── e2e/                # E2E tests

Next Steps

Configure Environment

Set up all required API keys and environment variables

Local Development

Learn development workflows and available commands

Common Issues

eStory requires Node.js 18 or higher. Check your version:
node --version
If it’s below v18, update Node.js before proceeding.
These are typically safe to ignore. If installation fails completely, try:
npm install --legacy-peer-deps
You can specify a different port:
npm run dev -- -p 3001

Build docs developers (and LLMs) love