docSmith is an API designed to generate documentation, Dockerfiles, and Docker Compose configurations from a GitHub repository URL. It leverages the Gemini language model and Langchain to analyze the codebase and produce structured outputs.
Key Features:
- Documentation Generation: Automatically generates comprehensive documentation for a given GitHub repository.
- Dockerfile Generation: Creates a Dockerfile tailored to the project's needs.
- Docker Compose Generation: Generates a Docker Compose configuration for multi-container applications.
- API-Driven: Provides a RESTful API for easy integration with other tools and services. Supported Platforms/Requirements:
- Python 3.7+
- FastAPI
- Langchain
- Google Gemini API
- Docker (for Dockerfile and Docker Compose generation)
- Node.js and npm (for Repomix installation)
Before you begin, ensure you have the following installed:
- Python: Version 3.7 or higher.
- pip: Python package installer.
- Docker: For generating and using Dockerfiles and Docker Compose configurations.
- Node.js and npm: Required for installing Repomix.
- Google Cloud Account: Required to access the Gemini API.
- Git: Required to clone the repository.
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Create a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate # On Linux/macOS venv\Scripts\activate # On Windows
-
Install the backend dependencies:
cd backend pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in thebackend
directory. - Add your Google API key: GOOGLE_API_KEY=<your_google_api_key>
- Create a
-
Install Repomix:
npm install -g repomix
This script checks if Repomix is installed and installs it globally using npm if it's not already present.
-
Install the frontend dependencies:
cd ../frontend npm install
- Start the backend server:
This command starts the FastAPI server on port 8000 with hot reloading enabled.
cd ../backend uvicorn main:app --host 0.0.0.0 --port 8000 --reload
- Start the frontend application:
This command starts the Vite development server, typically on port 5173.
cd ../frontend npm run dev
The backend provides the following API endpoints:
POST /generate-docs-from-url
: Generates documentation from a GitHub repository URL.- Input:
{ "url": "https://github.com/username/repository" } * **Output:** A string containing the generated documentation in Markdown format.
- Input:
POST /generate-dockerfile
: Generates a Dockerfile from a GitHub repository URL.- Input:
{ "url": "https://github.com/username/repository" } * **Output:** A string containing the generated Dockerfile.
- Input:
POST /generate-docker-compose
: Generates a Docker Compose configuration from a GitHub repository URL.- Input:
{ "url": "https://github.com/username/repository" } * **Output:** A string containing the generated Docker Compose configuration in YAML format.
- Input:
GET /ping
: A lightweight route to keep the server alive.- Output:
{ "message": "Pong!" }
- Output: