Skip to content

dilitS/codebase-analyser

Repository files navigation

πŸš€ Codebase Analyser AI

AI-powered code analysis tool built with Next.js 15, TypeScript, and Google Gemini AI

Next.js TypeScript TailwindCSS shadcn/ui

✨ Features

πŸ” Multi-Source Code Analysis

  • Direct Code Input - Paste code directly for instant analysis
  • GitHub Repository Analysis - Analyze entire repositories from GitHub URLs
  • ZIP File Analysis - Upload and analyze ZIP archives containing code

πŸ€– AI-Powered Analysis

  • Product Requirements Document (PRD) generation
  • Development Plan creation with actionable insights
  • Performance & Fixes Analysis with optimization recommendations
  • 6 Expert Personas for specialized analysis perspectives

🌍 Multi-Language Support

  • English, Polish, Spanish, German, French output languages
  • Intelligent code file detection (25+ programming languages)

πŸ“Š Advanced Features

  • Analysis History with statistics and management
  • Multi-Format Export (PDF, Markdown, JSON)
  • Toast Notifications for better UX
  • Responsive Design with dark/light theme support
  • Real-time Progress Indicators

πŸ› οΈ Tech Stack

  • Framework: Next.js 15 with App Router
  • Language: TypeScript (strict mode)
  • Styling: TailwindCSS 4 + shadcn/ui
  • AI Integration: Google Gemini API
  • Testing: Vitest + Testing Library
  • Build Tool: Turbopack
  • Icons: Lucide React
  • File Processing: JSZip
  • PDF Generation: jsPDF
  • Notifications: Sonner

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Google Gemini API key

Installation

  1. Clone the repository

    git clone <repository-url>
    cd codebase-analyser
  2. Install dependencies

    npm install
  3. Set up environment variables

    # Create .env.local file
    echo "NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key_here" > .env.local
  4. Run the development server

    npm run dev
  5. Open your browser Navigate to http://localhost:3000

πŸ“– Usage

1. Configure API Key

  • Click the settings icon in the top-right corner
  • Enter your Google Gemini API key
  • The key is stored securely in your browser's local storage

2. Choose Input Method

  • Code Tab: Paste code directly or load a sample
  • GitHub Tab: Enter a GitHub repository URL
  • ZIP Tab: Upload ZIP files containing your codebase

3. Configure Analysis

  • Language: Select output language (EN, PL, ES, DE, FR)
  • Expert Persona: Choose analysis perspective:
    • Generalist Software Architect
    • Security Specialist
    • Startup MVP Coach
    • Refactoring Guru
    • Performance Optimizer
    • UX/UI Advocate

4. Analyze & Export

  • Click "Analyze Codebase" to start analysis
  • View results in organized tabs (PRD, Development Plan, Performance)
  • Export results in PDF, Markdown, or JSON format
  • Access analysis history for previous results

πŸ§ͺ Testing

# Run all tests
npm run test

# Run tests in watch mode
npm run test:ui

# Build for production
npm run build

# Run linting
npm run lint

πŸ“ Project Structure

codebase-analyser/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ components/             # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ display/           # Display components
β”‚   β”‚   β”‚   β”œβ”€β”€ forms/             # Form components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/            # Layout components
β”‚   β”‚   β”‚   └── ui/                # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ lib/                   # Utility libraries
β”‚   β”‚   β”œβ”€β”€ services/              # Business logic services
β”‚   β”‚   β”œβ”€β”€ types/                 # TypeScript type definitions
β”‚   β”‚   └── __tests__/             # Test files
β”‚   β”œβ”€β”€ public/                    # Static assets
β”‚   └── docs/                      # Documentation

πŸ”§ Configuration

Environment Variables

Variable Description Required
NEXT_PUBLIC_GEMINI_API_KEY Google Gemini API key Optional*

*Can be configured in the UI settings

Supported File Types

The application automatically detects and processes these file types:

  • JavaScript/TypeScript: .js, .jsx, .ts, .tsx
  • Python: .py
  • Java: .java
  • C/C++: .c, .cpp, .cs
  • Web: .html, .css, .scss, .sass
  • Config: .json, .yaml, .yml, .toml
  • And 15+ more languages

🎯 Expert Personas

Each persona provides specialized analysis focus:

  • 🎯 Generalist: Balanced, comprehensive analysis
  • πŸ”’ Security Specialist: Security vulnerabilities and best practices
  • πŸš€ Startup MVP Coach: MVP features and rapid development
  • πŸ”§ Refactoring Guru: Code quality and maintainability
  • ⚑ Performance Optimizer: Performance bottlenecks and optimization
  • 🎨 UX/UI Advocate: User experience and interface considerations

πŸ“Š Features Overview

Analysis Capabilities

  • βœ… Multi-file repository analysis
  • βœ… Intelligent code filtering
  • βœ… Context-aware AI prompts
  • βœ… Size limits and rate limiting
  • βœ… Error handling and recovery

Export Options

  • βœ… PDF with formatted layout
  • βœ… Markdown for documentation
  • βœ… JSON for programmatic use
  • βœ… Customizable content selection

History Management

  • βœ… Persistent analysis history
  • βœ… Search and filter capabilities
  • βœ… Statistics and insights
  • βœ… Export/import functionality

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

If you have any questions or need help:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue

Made with ❀️ using Next.js 15 and Google Gemini AI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published