How pandeyprashant123-coder/cotest works
Project type and purpose
• This is a monorepo containing a full-stack code-analysis platform (“CoTest”).
• A Next.js-based React frontend (“client”).
• A Node.js-based API layer (Next.js API routes) with Bull/Redis queues and custom JS analysis modules.
• A Python microservice (“cotest_python”) exposing a REST API for Python code analysis.
• A standalone Node.js test harness (“Test”) for developing/testing ESLint-style plugins and rules.
File structure
• Top-level directories:
• client/ – Next.js frontend + API routes + Redis/Bull configuration
• cotest_python/ – Python code analyzer microservice
• Test/ – Node.js plugin/test framework for JS analyzers
• Key config files:
• client/compose.yaml, Dockerfile, .dockerignore → containerization/deployment
• client/src/pages/api/config/*.js → Redis and Bull queue setup
• cotest_python/requirements.txt → Python dependencies
• Test/eslint.config.mjs, Test/modules, Test/rules → custom ESLint-style modules & rules
README for additional insights
• Details how to run the client (Next.js + Redis), the Python service, and the Test harness.
• Mentions Redis as the queue backing service and how to execute code analyzers.
• Illustrates the intended “CoTest Workflow” across lexer/parser/analyzer/rules stages (conceptual).
Main system components & interactions
a. Frontend (client)
• Next.js React UI (pages, components)
• NextAuth authentication via pages/api/auth
• UI invokes “check” and “runtest” API routes
b. API layer (Next.js pages/api)
• Authentication middleware → NextAuth
• GitHub service (OAuth, repo fetch)
• Parser/ELOC services (calculateELOC.js, parser.js)
• Analyzer modules (customanalizer, detectCredentials, etc.)
• Bull/Redis queue → jobs enqueued for analysis
• Queue worker (in same Next.js app or separate process)
c. Python microservice
• Exposes REST endpoints (api.py)
• Implements ELOC calculation, rule engine, reviewer functionality
• Loads Python rule modules (cotest_python/rules/*.py)
• Returns JSON reports
d. Node.js Test harness
• Allows local plugin development & testing
• Uses ESLint engine and custom rule definitions
e. External Services
• Redis (job queue)
• GitHub API
Architectural patterns & design principles
• Modular analyzers: JS and Python rule modules are pluggable.
• Queue-based processing: decouples request handling from heavy analysis work.
• Microservices: Python analyzer runs independently of Node.js stack.
• Next.js serverless functions: thin API layer that orchestrates work.
• Separation of concerns: UI / API / Worker / Rule Engine.
• Clear labels: “Next.js UI”, “Auth (NextAuth)”, “GET/POST /get-report”, “Bull Queue”, “JS Worker”, “Python Analyzer API”.