A guide to starting the AI Docs application on your local machine and performing initial checks.
This guide provides a step-by-step walkthrough to set up and run AI Docs on your local machine. By following these instructions, you'll prepare your development environment, configure essential services, and launch the application, enabling you to begin generating documentation from your GitHub repositories.
Before proceeding with the installation, ensure your development environment meets the following requirements. For a comprehensive overview of all necessary software and services, refer to Installation and Prerequisites.
npm install -g pnpm
Follow these steps to get AI Docs running on your local machine.
Start by cloning the AI Docs repository from GitHub to your local machine and navigate into the project directory.
git clone <your-repo-url>
cd ai-docs
Once inside the project directory, install all necessary dependencies using pnpm.
pnpm install
AI Docs relies on several environment variables for database connection, authentication, and AI services.
Create your .env file: Copy the provided example environment file to create your local configuration file:
cp .env.example .env
Update .env variables: Open the newly created .env file and populate the following variables with your specific credentials and settings:
# Database connection string for your PostgreSQL database
DATABASE_URL="your-postgresql-connection-string"
# Google OAuth credentials for user authentication
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Better Auth secret key for session management
BETTER_AUTH_SECRET=your-random-secret-key
# Generate a strong secret with: openssl rand -base64 32
# Local development URLs for Better Auth and the Next.js app
BETTER_AUTH_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
# OpenAI API Key for AI generation features
OPENAI_API_KEY=your-openai-api-key
For detailed instructions on obtaining GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, refer to the Google OAuth Configuration page. The OPENAI_API_KEY setup is covered in Environment Configuration.
Many other environment variables exist for advanced features like GitHub integration, Qdrant, and Inngest. For a comprehensive guide to all available variables, consult the Environment Configuration page.
AI Docs uses Drizzle ORM for database management. After configuring your DATABASE_URL, you need to generate and push the database schema.
pnpm db:generate
pnpm db:push
pnpm db:generate: This command generates Drizzle migrations based on your schema definitions.pnpm db:push: This command applies the generated schema changes to your PostgreSQL database.For more in-depth information about the database setup and Drizzle ORM, consult the Database Architecture with Drizzle ORM page.
With all prerequisites and configurations in place, you can now start the AI Docs development server.
pnpm dev
This command will start the Next.js development server. Once it's running, open your web browser and navigate to http://localhost:3000 to see the application.
The initial setup process follows a clear sequence to ensure all components are correctly initialized:
Congratulations! You have successfully installed and launched AI Docs locally. Here are some recommended next steps to get started with generating documentation: