Learn how to set up your local development environment for AI Docs, including necessary software and dependencies.
AI Docs is an AI-powered documentation generator that streamlines the creation and maintenance of project documentation. This guide provides a comprehensive overview of the essential system prerequisites and step-by-step instructions to install and set up AI Docs for local development. By following these instructions, you will prepare your environment and get the application running on your machine, ready for further configuration and project creation.
Before you begin the installation process, ensure your development environment meets the following requirements. These tools and services are fundamental for AI Docs to function correctly.
Node.js: AI Docs is built on Next.js and requires a modern Node.js runtime.
You need Node.js version 18 or higher. You can check your version with node -v. If you need to update, consider using a version manager like nvm.
pnpm: This is the preferred package manager for AI Docs, offering efficient disk space usage and faster installation times.
If you don't have pnpm installed, you can install it globally using npm:
npm install -g pnpm
AI Docs integrates with several external services to deliver its core functionality. You will need access to instances of these services and their respective credentials.
PostgreSQL Database: AI Docs uses PostgreSQL for storing all project data, user information, and generated documentation content.
You will need a running instance of a PostgreSQL database and its connection string. For detailed setup instructions and schema management, refer to Database Architecture with Drizzle ORM.
Google OAuth Credentials: These are necessary for user authentication, allowing users to sign in to AI Docs via their Google accounts.
You will need a Client ID and Client Secret from the Google Cloud Console. A comprehensive guide for obtaining and configuring these credentials is provided in Google OAuth Configuration.
OpenAI API Key: This key is fundamental for AI Docs' core value proposition: leveraging AI to analyze codebases and generate documentation.
An API key from OpenAI is required to enable the AI-powered documentation generation and semantic search features. This is covered in more detail in AI-Powered Generation.
Qdrant Instance: While AI Docs can function for basic documentation generation without it, a dedicated Qdrant instance is essential for advanced features like semantic search and Retrieval-Augmented Generation (RAG) within the AI chat.
You will need the URL and an API key for your Qdrant instance. Learn more about its role in Vector Search with Qdrant.
GitHub Personal Access Token: For the AI Docs application to interact with GitHub (e.g., for initial repository checks, webhook creation, and accessing public repositories), a GitHub Personal Access Token with appropriate repo scope is required.
This token is used for application-level interactions. For users to connect their own GitHub accounts and access private repositories, GitHub Integration details the setup for GitHub OAuth App credentials.
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. This command reads the package.json file and fetches all required packages.
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 to your PostgreSQL instance.
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, ensuring your database structure matches the application's requirements.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: