DocDrift is an automated, AI-assisted system designed to detect and remediate documentation-code drift in software repositories. Whenever developers push code changes, DocDrift analyzes code diffs against existing prose documentation (READMEs, /docs directory, Wiki pages) using Google Gemini's semantic reasoning, generates specific patch suggestions, and presents them in a review dashboard for human approval before opening a fix pull request.
- 🔍 Automated Drift Detection: Continuously monitors code changes via GitHub webhooks or REST triggers to spot outdated, inaccurate, or incomplete documentation.
- 💡 Actionable Patch Generation: Uses Google's Gemini LLM to generate precise, structured text replacements (
oldText→suggestedText) along with AI reasoning. - 🛡️ Human-in-the-Loop Oversight: No documentation is mutated automatically. Suggestions enter a review queue requiring explicit approval.
- 🎨 Modern Review Dashboard: Premium glassmorphic React dashboard for tech leads and reviewers to inspect side-by-side diffs and approve/reject suggestions with one click.
- 🗄️ Auditable Persistence: Tracks all drift reports, suggested fixes, and reviewer actions in PostgreSQL for full historical auditability.
- Framework: Spring Boot (Java 21)
- Data Access: Spring Data JPA, Hibernate
- Database: PostgreSQL (pgAdmin 4 integration) / H2 in-memory
- Networking: Spring WebFlux (
WebClientfor non-blocking GitHub & Gemini API calls) - Security: Spring Security (CORS enabled for local frontend integration)
- Framework: React (Vite)
- Icons: Lucide React
- Styling: Vanilla CSS (Custom dark-mode glassmorphic design system)
- LLM Engine: Google Gemini API (
gemini-1.5-flash) - Version Control: GitHub REST API & Webhook events
Docdrift/
├── Docdrift/ # Spring Boot Backend Project
│ ├── src/main/java/com/docdrift/Docdrift/
│ │ ├── config/ # Security & WebClient Configurations
│ │ ├── controller/ # REST Controllers (Webhooks, Repositories, Reviews)
│ │ ├── dto/ # Request/Response DTOs & Gemini payload models
│ │ ├── model/ # JPA Entities (DriftReport, DriftSuggestion, etc.)
│ │ ├── repository/ # Spring Data JPA Repositories
│ │ └── service/ # GitHub, Gemini LLM, & Diff Analysis logic
│ ├── src/main/resources/
│ │ └── application.properties
│ └── pom.xml
│
├── frontend/ # Vite + React Dashboard Application
│ ├── src/
│ │ ├── components/ # Header, ReportList, SuggestionCard
│ │ ├── api.js # Axios/Fetch integration with Spring Boot API
│ │ ├── App.jsx # Main Dashboard Layout & Repo Tracking Modal
│ │ └── index.css # Glassmorphism Design System
│ └── package.json
│
└── README.md
- Java 21 or later
- Node.js (v18+) & npm
- PostgreSQL running locally (or via pgAdmin 4)
- Open pgAdmin 4 or
psqlcommand line. - Create a new database named
docdrift:CREATE DATABASE docdrift;
- Update
Docdrift/src/main/resources/application.propertieswith your PostgreSQL username and password:spring.datasource.url=jdbc:postgresql://localhost:5432/docdrift spring.datasource.username=postgres spring.datasource.password=YOUR_POSTGRES_PASSWORD
- Set your API credentials in
application.propertiesor environment variables:github.api.token=YOUR_GITHUB_PAT gemini.api.key=YOUR_GEMINI_API_KEY
Navigate to the backend directory and launch the server:
cd Docdrift
.\mvnw.cmd spring-boot:runThe backend server will start on http://localhost:8080.
Open a new terminal window, navigate to the frontend folder, and start the Vite dev server:
cd frontend
npm install
npm run devThe dashboard will be available at http://localhost:5173.
curl -X POST http://localhost:8080/api/repos \
-H "Content-Type: application/json" \
-d '{"url":"https://github.com/Rajan3103/Doc_Drift", "name":"Rajan3103/Doc_Drift"}'curl -X POST http://localhost:8080/api/webhooks/github \
-H "Content-Type: application/json" \
-d '{
"ref": "refs/heads/main",
"repository": {"full_name": "Rajan3103/Doc_Drift"},
"commits": [{"id": "sample-sha-12345", "message": "Updated function signatures"}]
}'curl http://localhost:8080/api/reportscurl -X POST http://localhost:8080/api/suggestions/1/approve