Quickstart Guide: AI Textbook Platform
Branch: 1-ai-textbook-platform | Date: 2025-12-10 | Spec: specs/1-ai-textbook-platform/spec.md
Overview
This guide provides instructions to set up and run the AI Textbook Platform locally for development and testing. The project consists of a frontend (Docusaurus/React) and a backend (FastAPI).
Prerequisites
- Git
- Node.js (LTS version) & npm or yarn
- Python 3.10+ & pip
- Docker (Optional, for running external services like Qdrant/Postgres locally)
1. Clone the Repository
git clone https://github.com/your-org/ai-textbook-platform.git
cd ai-textbook-platform
2. Backend Setup (FastAPI)
-
Navigate to the backend directory:
cd backend -
Create a Python virtual environment and activate it:
python -m venv .venv
# On Windows:
.\.venv\Scripts\activate
# On macOS/Linux:
source ./.venv/bin/activate -
Install dependencies:
pip install -r requirements.txt(Note:
requirements.txtwill be generated during implementation, containing FastAPI, Better-Auth, OpenAI SDK, psycopg, etc.) -
Set up environment variables: Create a
.envfile in thebackend/directory based on a.env.example(which will be provided during implementation). Example variables will include:DATABASE_URL="postgresql://user:password@host:port/dbname"
QDRANT_URL="http://localhost:6333"
OPENAI_API_KEY="your_openai_api_key"
BETTER_AUTH_SECRET_KEY="your_secret_key" -
Run database migrations: (Command will be specified during implementation, likely
alembic upgrade headfor SQLAlchemy or similar for other ORMs) -
Start the backend server:
uvicorn app.main:app --reloadThe API will be available at
http://localhost:8000.
3. Frontend Setup (Docusaurus/React)
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install # or yarn install -
Set up environment variables: Create a
.envfile in thefrontend/directory based on a.env.example. Example variables will include:VITE_BACKEND_API_URL="http://localhost:8000" -
Start the frontend development server:
npm start # or yarn startThe Docusaurus site will be available at
http://localhost:3000.
4. Running External Services (Optional, via Docker)
For local development, you might need to run PostgreSQL and Qdrant. A docker-compose.yml will be provided during implementation.
docker-compose up -d postgres qdrant