Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

135 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 Driftless

Driftless is an AI-powered platform that automates README generation and detects documentation drift, ensuring codebase documentation is always current by reading code, generating accurate documentation, and raising GitHub PRs automatically.

TypeScript Supabase Tailwind CSS Groq @google/generative-ai License: MIT

πŸ“– Table of Contents


🎯 About

Outdated documentation is a common pain point for development teams, leading to confusion, slower onboarding, and increased maintenance overhead. As codebases evolve, manual README updates often fall behind, creating a "documentation drift" that hinders productivity and project understanding. This problem is exacerbated in fast-paced development environments where keeping documentation in sync with code changes becomes a significant burden.

Driftless solves this by intelligently reading code and generating accurate READMEs using advanced AI models like Google Gemini and Groq. It proactively detects when documentation diverges from the codebase, providing real-time drift alerts πŸ“ˆ and automating updates via GitHub Pull Requests πŸ€–. This ensures that your project's documentation is always current, reducing manual effort and improving developer experience.


✨ Features

  • πŸ€– AI-powered README generation β€” Automatically create and update READMEs by analyzing your codebase using Google Gemini and Groq.
  • πŸ“ˆ Real-time documentation drift detection β€” Continuously monitor your repositories for discrepancies between code and documentation, with historical tracking and alerts.
  • πŸ”„ Automated GitHub Pull Request creation β€” When drift is detected, Driftless can automatically generate and submit GitHub PRs with suggested documentation updates.
  • πŸ”’ Secure user authentication β€” Seamlessly sign in and manage access using NextAuth.js with GitHub OAuth and Supabase for robust security.
  • πŸ’³ Subscription management and checkout flows β€” Integrated with Dodo Payments for handling various subscription plans and secure transactions.
  • πŸ”— CI/CD integration for documentation drift checks β€” Incorporate documentation checks into your continuous integration pipeline using dedicated API keys.
  • πŸ“Š Interactive data visualization β€” Track documentation health and drift history with intuitive charts powered by Recharts.
  • βš™οΈ Customizable settings β€” Manage account details, API keys, and notification preferences through a dedicated settings portal.

πŸ› οΈ Tech Stack

🎨 Frontend

Technology Purpose
Next.js React Framework for server-side rendering and routing
Tailwind CSS Utility-first CSS framework for rapid UI development
Radix UI Unstyled, accessible components for building design systems
Recharts Composable charting library built with React and D3

βš™οΈ Backend & Infrastructure

Technology Purpose
TypeScript Statically typed superset of JavaScript for enhanced code quality
Supabase Open-source Firebase alternative for database, auth, and storage
NextAuth.js Flexible authentication for Next.js applications
Groq High-performance AI inference engine for generative models
Octokit Official GitHub API client for Node.js
Resend Developer-friendly email API for transactional emails
Google Gemini Advanced generative AI models for code analysis and content generation

πŸ“‹ Prerequisites

⚠️ Make sure you have all of these installed before starting.

  1. Node.js 18+ β€” Download Β· Check: node --version
  2. npm β€” Comes with Node.js Β· Check: npm --version
  3. Supabase account β€” Sign up
  4. GitHub OAuth App β€” Create one
  5. Google Cloud Project (Generative AI) β€” Set up
  6. Dodo Payments account β€” Sign up
  7. Resend account β€” Sign up

βš™οΈ Installation

Step 1 β€” Clone the repository

git clone https://github.com/het2576/Driftless.git
cd Driftless

Step 2 β€” Install dependencies

npm install

Step 3 β€” Configure environment

cp .env.example .env.local

πŸ’‘ Open .env.local and fill in your values. See Environment Variables below.


πŸ” Environment Variables

Create a .env.local file in the project root:

# βœ… Required: Secret key for NextAuth.js session encryption
NEXTAUTH_SECRET=

# βœ… Required: Base URL of the application for NextAuth.js callbacks
NEXTAUTH_URL=

# βšͺ Optional: Email address used as the 'From' sender for Resend emails
RESEND_FROM_EMAIL=

# βœ… Required: GitHub OAuth Client ID for authentication
GITHUB_CLIENT_ID=

# βœ… Required: GitHub OAuth Client Secret for authentication
GITHUB_CLIENT_SECRET=

# βœ… Required: API key for Google Gemini Generative AI services
GEMINI_API_KEY=

# βœ… Required: API key for Groq AI inference engine
GROQ_API_KEY=

# βœ… Required: Public URL for the Supabase project
NEXT_PUBLIC_SUPABASE_URL=

# βœ… Required: Public Anon Key for client-side Supabase access
NEXT_PUBLIC_SUPABASE_ANON_KEY=

# βœ… Required: Service Role Key for server-side Supabase access
SUPABASE_SERVICE_ROLE_KEY=

# βœ… Required: GitHub App ID for webhook automation
GITHUB_APP_ID=

# βœ… Required: Private key for GitHub App authentication
GITHUB_APP_PRIVATE_KEY=

# βœ… Required: Webhook secret for GitHub App events
GITHUB_APP_WEBHOOK_SECRET=

# βœ… Required: GitHub App Client ID for OAuth flows
GITHUB_APP_CLIENT_ID=

# βœ… Required: GitHub App Client Secret for OAuth flows
GITHUB_APP_CLIENT_SECRET=

# βœ… Required: API key for Dodo Payments
DODO_API_KEY=

# βœ… Required: Dodo Payments environment (test_mode or live_mode)
DODO_ENVIRONMENT=

# βœ… Required: Webhook secret for Dodo Payments events
DODO_WEBHOOK_SECRET=

# βœ… Required: Product ID for the Dodo Pro plan
DODO_PRO_PRODUCT_ID=

# βœ… Required: Product ID for the Dodo Pro annual plan
DODO_PRO_ANNUAL_PRODUCT_ID=

# βœ… Required: Product ID for the Dodo Team plan
DODO_TEAM_PRODUCT_ID=

# βœ… Required: Product ID for the Dodo Team annual plan
DODO_TEAM_ANNUAL_PRODUCT_ID=

# βœ… Required: Public publishable key for Dodo Payments client-side integration
NEXT_PUBLIC_DODO_PUBLISHABLE_KEY=

# βœ… Required: Email address for receiving contact form submissions
CONTACT_EMAIL=

# βœ… Required: Secret key for authenticating cron jobs
CRON_SECRET=
Variable Required Description
NEXTAUTH_SECRET βœ… Yes Secret key for NextAuth.js session encryption
NEXTAUTH_URL βœ… Yes Base URL of the application for NextAuth.js callbacks
RESEND_FROM_EMAIL βšͺ No Email address used as the 'From' sender for Resend emails
GITHUB_CLIENT_ID βœ… Yes GitHub OAuth Client ID for authentication
GITHUB_CLIENT_SECRET βœ… Yes GitHub OAuth Client Secret for authentication
GEMINI_API_KEY βœ… Yes API key for Google Gemini Generative AI services
GROQ_API_KEY βœ… Yes API key for Groq AI inference engine
NEXT_PUBLIC_SUPABASE_URL βœ… Yes Public URL for the Supabase project
NEXT_PUBLIC_SUPABASE_ANON_KEY βœ… Yes Public Anon Key for client-side Supabase access
SUPABASE_SERVICE_ROLE_KEY βœ… Yes Service Role Key for server-side Supabase access
GITHUB_APP_ID βœ… Yes GitHub App ID for webhook automation
GITHUB_APP_PRIVATE_KEY βœ… Yes Private key for GitHub App authentication
GITHUB_APP_WEBHOOK_SECRET βœ… Yes Webhook secret for GitHub App events
GITHUB_APP_CLIENT_ID βœ… Yes GitHub App Client ID for OAuth flows
GITHUB_APP_CLIENT_SECRET βœ… Yes GitHub App Client Secret for OAuth flows
DODO_API_KEY βœ… Yes API key for Dodo Payments
DODO_ENVIRONMENT βœ… Yes Dodo Payments environment (test_mode or live_mode)
DODO_WEBHOOK_SECRET βœ… Yes Webhook secret for Dodo Payments events
DODO_PRO_PRODUCT_ID βœ… Yes Product ID for the Dodo Pro plan
DODO_PRO_ANNUAL_PRODUCT_ID βœ… Yes Product ID for the Dodo Pro annual plan
DODO_TEAM_PRODUCT_ID βœ… Yes Product ID for the Dodo Team plan
DODO_TEAM_ANNUAL_PRODUCT_ID βœ… Yes Product ID for the Dodo Team annual plan
NEXT_PUBLIC_DODO_PUBLISHABLE_KEY βœ… Yes Public publishable key for Dodo Payments client-side integration
CONTACT_EMAIL βœ… Yes Email address for receiving contact form submissions
CRON_SECRET βœ… Yes Secret key for authenticating cron jobs

πŸ”’ Never commit your .env.local file. It's already in .gitignore.


πŸš€ Usage

Development Server

npm run dev

Open http://localhost:3000 in your browser.

Quick Start Example

To experience Driftless, start the development server and navigate to the application in your browser.

  1. Click "Sign in with GitHub" to authenticate your account.
  2. Once logged in, you can navigate to the "Generate README" section.
  3. Provide a GitHub repository URL or select one from your installations.
  4. Initiate the README generation process to see how Driftless analyzes your code and produces documentation.
  5. Explore the "Drift History" to monitor documentation health over time.

πŸ”Œ API Reference

🌐 Base URL: http://localhost:3000

πŸ”’ Authentication: Sign in via the web interface β€” API endpoints use session cookies.

Method Endpoint Description Auth
GET /api/alerts/drift Retrieve documentation drift alerts πŸ”’ Required
POST /api/analyze Analyze a repository for documentation insights πŸ”’ Required
GET /api/auth/[...nextauth] Handle NextAuth.js authentication callbacks πŸ”“ Public
POST /api/auth/[...nextauth] Handle NextAuth.js authentication requests πŸ”“ Public
POST /api/checkout/confirm Confirm a Dodo Payments checkout session πŸ”’ Required
GET /api/checkout Retrieve Dodo Payments checkout details πŸ”’ Required
POST /api/checkout Initiate a Dodo Payments checkout session πŸ”’ Required
POST /api/ci/check Perform a documentation drift check for CI/CD πŸ”’ Required
POST /api/contact Submit a contact form message πŸ”’ Required
GET /api/cron/drift-alerts Trigger scheduled documentation drift alerts πŸ”’ Required
POST /api/cron/test-alert Send a test documentation drift alert πŸ”’ Required
GET /api/drift/history Retrieve historical documentation drift data πŸ”’ Required
POST /api/drift/reset Reset documentation drift history for a repository πŸ”’ Required
POST /api/drift Initiate a documentation drift analysis πŸ”’ Required
POST /api/generate Generate a README for a given repository πŸ”’ Required
POST /api/generate/stream Stream README generation results πŸ”’ Required
POST /api/install/save Save GitHub App installation details πŸ”’ Required
GET /api/installations Retrieve user's GitHub App installations πŸ”’ Required
GET /api/me Get current authenticated user's profile πŸ”’ Required
POST /api/notifications/read Mark user notifications as read πŸ”’ Required
GET /api/notifications Retrieve user's notifications πŸ”’ Required
GET /api/org/repos Get repositories for an organization πŸ”’ Required
GET /api/portal Access Dodo Payments customer portal πŸ”’ Required
POST /api/pr Create a GitHub Pull Request for documentation updates πŸ”’ Required
GET /api/readmes/[id]/share Share a generated README by ID πŸ”’ Required
GET /api/readmes/latest Retrieve the latest generated README πŸ”’ Required
GET /api/repos Get user's accessible repositories πŸ”’ Required
GET /api/review/[token] Review a documentation update via token πŸ”’ Required
POST /api/roast Generate a "roast" of a README (public demo) πŸ”“ Public
POST /api/settings/account Update user account settings πŸ”’ Required
POST /api/settings/apikey Manage user API keys πŸ”’ Required
POST /api/settings/notifications Update user notification settings πŸ”’ Required
GET /api/team/members Retrieve team members πŸ”’ Required
POST /api/webhooks/dodo Handle incoming Dodo Payments webhook events πŸ”“ Public
POST /api/webhooks/github Handle incoming GitHub webhook events πŸ”“ Public

Example Request

# Public endpoints can be called directly.
# Protected endpoints require an active browser session.
curl http://localhost:3000/api/roast -X POST -H "Content-Type: application/json" -d '{"text": "This is a README."}'

Example Response

{
  "success": true,
  "data": {
    "roast": "Your README is so basic, it probably thinks 'git push' is a workout routine."
  }
}

πŸ“ Project Structure

Driftless/
β”œβ”€β”€ app/              # Next.js App Router: pages, API routes, and layouts
β”‚   β”œβ”€β”€ api/          # API routes (e.g., /api/auth, /api/generate)
β”‚   β”œβ”€β”€ (auth)/       # Authentication-related pages and components
β”‚   β”œβ”€β”€ (dashboard)/  # Main application dashboard and features
β”‚   └── page.tsx      # Entry point for the root application
β”œβ”€β”€ components/       # Reusable UI components
β”œβ”€β”€ lib/              # Utility functions, API clients, and helpers
β”œβ”€β”€ public/           # Static assets (images, favicons)
β”œβ”€β”€ styles/           # Global styles and Tailwind CSS configuration
β”œβ”€β”€ types/            # TypeScript type definitions
β”œβ”€β”€ .env.example      # Environment variables template
β”œβ”€β”€ package.json      # Dependencies and scripts
└── README.md         # This file

The project follows a modular, feature-based structure typical for Next.js applications using the App Router. Core application logic, UI components, and API routes are logically grouped, promoting maintainability and scalability. This organization allows for clear separation of concerns, making it easier to navigate and extend the codebase.


🀝 Contributing

Contributions make this project better. Here's how to get involved:

πŸ› Reporting Bugs

Before creating a bug report:

  • βœ… Check the existing issues
  • βœ… Collect your environment details (OS, Node version, browser)
  • βœ… Reproduce the bug consistently

Create a bug report β†’

πŸ’‘ Suggesting Features

Feature suggestions are tracked as GitHub issues.

Suggest a feature β†’

πŸ”§ Pull Requests

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch: git checkout -b feat/amazing-feature
  3. πŸ’Ύ Commit your changes: git commit -m 'feat: add amazing feature'
  4. πŸ“€ Push to the branch: git push origin feat/amazing-feature
  5. πŸ” Open a Pull Request

Commit convention: We use Conventional Commits

  • feat: β€” new feature
  • fix: β€” bug fix
  • docs: β€” documentation only
  • refactor: β€” code change, no feature or fix
  • test: β€” add or update tests

πŸ“„ License

This project is licensed under the MIT License.

You're free to use, modify, and distribute this project for any purpose. See the LICENSE file for full details.


Built with ❀️ by het2576

If this project helped you, consider giving it a ⭐

⭐ Star this repo Β· πŸ› Report a Bug Β· πŸ’‘ Request a Feature

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages