Skip to main content

Prerequisites

Before you begin, ensure you have the following installed on your machine:
  • Node.js 20.x or higher
  • Package Manager: One of the following:
    • Bun (recommended)
    • npm (comes with Node.js)
    • pnpm
  • Git for version control
  • Supabase CLI for database management
This project uses Next.js 15 with the App Router and TypeScript. Familiarity with these technologies is recommended.

Clone the Repository

First, clone the repository to your local machine:
git clone <repository-url>
cd echoes-of-the-past

Install Dependencies

Install the project dependencies using your preferred package manager:
bun install
The project includes the following key dependencies:
  • Frontend Framework: Next.js 15.3.2, React 19
  • Database: Supabase (@supabase/supabase-js, @supabase/ssr)
  • Voice AI: Vapi AI SDK (@vapi-ai/web)
  • Text-to-Speech: ElevenLabs (@elevenlabs/elevenlabs-js)
  • AI Models: OpenAI SDK
  • State Management: TanStack Query (React Query)
  • Caching: Upstash Redis
  • UI Components: Radix UI, Tailwind CSS
  • Forms: React Hook Form with Zod validation

Project Structure

Understand the codebase organization:
echoes-of-the-past/
├── app/                      # Next.js App Router
│   ├── (other)/             # Auth routes (sign-in, sign-up, callback)
│   ├── app/                 # Main application routes
│   │   ├── analytics/       # User analytics dashboard
│   │   ├── call/[id]/       # Voice call interface
│   │   ├── new/             # Create new conversation
│   │   ├── quizzes/         # Quiz system
│   │   └── page.tsx         # Main app page
│   ├── layout.tsx           # Root layout
│   └── page.tsx             # Landing page
├── components/              # Reusable UI components
│   ├── ui/                  # Base UI components (shadcn/ui)
│   └── ...                  # Custom components
├── features/                # Feature-based modules
│   ├── analytics/           # Analytics features
│   ├── auth/                # Authentication
│   ├── call/                # Voice call functionality
│   ├── character/           # Historical figure management
│   ├── dashboard/           # Dashboard features
│   ├── quiz/                # Quiz system
│   └── sidebar/             # Navigation sidebar
├── lib/                     # Core library code
│   ├── ai.ts                # OpenAI client configuration
│   ├── vapi.ts              # Vapi AI client
│   ├── elevenlabs.ts        # ElevenLabs client
│   ├── redis.ts             # Redis client
│   ├── prompt.ts            # AI prompt templates
│   └── utils.ts             # Utility functions
├── utils/                   # Utility modules
│   └── supabase/            # Supabase client utilities
│       ├── client.ts        # Browser client
│       ├── server.ts        # Server client
│       └── middleware.ts    # Auth middleware
├── supabase/                # Database configuration
│   └── migrations/          # SQL migrations
├── database.types.ts        # Generated TypeScript types
├── middleware.ts            # Next.js middleware
└── package.json             # Dependencies and scripts

Running the Development Server

After installing dependencies and setting up your environment variables (see Environment Setup), start the development server:
bun run dev
The development server will start with Turbopack enabled for faster builds:
 Next.js 15.3.2
  - Local:        http://localhost:3000
  - Turbopack:    enabled

 Ready in 1.2s
Open http://localhost:3000 in your browser to see the application.

Available Scripts

The following scripts are available in package.json:
ScriptCommandDescription
devnext dev --turbopackStart development server with Turbopack
buildnext buildBuild production bundle
startnext startStart production server
lintnext lintRun ESLint
formatprettier --write .Format code with Prettier
gen-typesnpx supabase gen types...Generate TypeScript types from Supabase

Next Steps

1

Configure Environment Variables

Set up all required API keys and environment variables. See Environment Setup.
2

Set Up Database

Initialize your Supabase project and run migrations. See Database Setup.
3

Start Building

You’re ready to start developing! Explore the codebase and make your first changes.

Development Tips

  • The project uses Turbopack for faster development builds
  • TypeScript strict mode is enabled for type safety
  • ESLint and Prettier are configured for code quality
  • Use TanStack Query DevTools to debug data fetching

Troubleshooting

Port Already in Use

If port 3000 is already in use, you can specify a different port:
PORT=3001 npm run dev

Type Errors

If you encounter TypeScript errors related to database types, regenerate them:
npm run gen-types

Module Not Found

Clear your package manager’s cache and reinstall:
rm -rf node_modules bun.lockb
bun install

Build docs developers (and LLMs) love