Skip to content

canstralian/ReplitCodeMiner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

138 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReplitCodeMiner

License Version Node TypeScript

A powerful tool for detecting duplicate code patterns across your Replit projects with advanced analysis capabilities and intuitive visualizations.

🌟 Features

  • πŸ” Smart Code Analysis: Advanced duplicate detection using AST parsing and pattern matching
  • πŸš€ Multi-Project Scanning: Analyze all your Replit projects simultaneously
  • πŸ“Š Visual Comparisons: Side-by-side code comparison with syntax highlighting
  • πŸ”— Cross-Project Patterns: Detect shared patterns across different repositories
  • πŸ“ˆ Analytics Dashboard: Comprehensive insights into code duplication metrics
  • πŸ” Secure Authentication: Replit OAuth2 integration with secure session management
  • 🌐 Responsive Design: Works seamlessly on desktop and mobile devices

πŸ› οΈ Technology Stack

  • Frontend: React 18, TypeScript, Tailwind CSS, Radix UI
  • Backend: Express.js, Node.js 20+
  • Database: PostgreSQL with Drizzle ORM
  • Authentication: Replit OAuth2
  • Testing: Vitest, React Testing Library
  • Deployment: Replit Deployments

πŸš€ Quick Start

Prerequisites

  • Node.js 20 or higher
  • Replit account
  • Git

Development Setup

  1. Fork this Repl or Clone the repository

    # If cloning from GitHub (replace with actual repo URL)
    git clone https://github.com/canstralian/replit-duplicate-detector.git
    cd replit-duplicate-detector
  2. Install dependencies

    npm install
  3. Environment Setup

    cp .env.example .env
    # Edit .env with your configuration
  4. Database Setup

    npm run db:push
  5. Start Development Server

    npm run dev

The application will be available at http://localhost:5000

Production Deployment

  1. Build for Production

    npm run build
  2. Start Production Server

    npm run start
  3. Deploy to Replit

    • Connect your GitHub repository to Replit
    • Configure environment variables in Replit Secrets
    • Use the provided Replit configuration

πŸ“ Project Structure

β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom React hooks
β”‚   β”‚   └── lib/            # Utility functions
β”œβ”€β”€ server/                 # Express backend
β”‚   β”œβ”€β”€ routes.ts           # API routes
β”‚   β”œβ”€β”€ db.ts              # Database configuration
β”‚   β”œβ”€β”€ auth.ts            # Authentication logic
β”‚   └── services/          # Business logic
β”œβ”€β”€ shared/                 # Shared types and schemas
β”œβ”€β”€ tests/                  # Test files
└── docs/                   # Documentation

πŸ”§ Configuration

Environment Variables

Variable Description Required
DATABASE_URL PostgreSQL connection string Yes
REPLIT_CLIENT_ID Replit OAuth2 client ID Yes
REPLIT_CLIENT_SECRET Replit OAuth2 client secret Yes
SESSION_SECRET Session encryption secret Yes
NODE_ENV Environment (development/production) No
PORT Server port (default: 5000) No

See .env.example for complete configuration options.

πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

Test Coverage

We maintain >80% code coverage across all modules. Coverage reports are generated in coverage/ directory.

πŸ“Š API Documentation

Authentication Endpoints

  • GET /api/auth/user - Get current user
  • GET /api/login - Initiate OAuth login
  • POST /api/logout - Logout user

Project Analysis

  • GET /api/projects - List user projects
  • POST /api/projects/:id/analyze - Analyze project for duplicates
  • GET /api/projects/:id/results - Get analysis results

Settings

  • GET /api/settings - Get user settings
  • PUT /api/settings - Update user settings

For detailed API documentation, visit /api/docs when running the application.

πŸ”’ Security

This application implements multiple security layers:

  • Authentication: Secure OAuth2 integration with Replit
  • Authorization: Role-based access control
  • Input Validation: Comprehensive input sanitization using Zod
  • Rate Limiting: API rate limiting to prevent abuse
  • Security Headers: CSRF, XSS, and clickjacking protection
  • HTTPS: Enforced in production with secure cookies

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Process

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Ensure tests pass: npm test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to your branch: git push origin feature/amazing-feature
  7. Submit a pull request

πŸ› Issues and Support

πŸ“„ License

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

πŸ™ Acknowledgments

  • Built with ❀️ for the Replit community
  • Thanks to all contributors and testers
  • Special thanks to the open-source community

πŸ“ˆ Roadmap

  • Advanced pattern recognition algorithms
  • Integration with more version control systems
  • Machine learning-based duplicate detection
  • Team collaboration features
  • API rate limiting improvements
  • Performance optimizations

Made with ❀️ by the Replit Community

About

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages