Analyze, secure, optimize, and document code using a multi-stage AI pipeline.
CognifyAI is a full-stack AI-assisted code analysis platform designed to help developers improve code quality through a structured analysis pipeline.
Users can submit source code and receive:
- Syntax validation
- Bug detection
- Security vulnerability analysis
- Complexity estimation
- Code optimization suggestions
- Automated docstring generation
- Overall quality scoring
The platform combines deterministic static analysis with optional LLM-powered enrichment, providing fast and reliable results while remaining cost-efficient.
Every code submission passes through a strictly sequential pipeline:
graph TD
SV["Syntax Validation"] --> BD["Bug Detection"]
BD --> SS["Security Scanning"]
SS --> CA["Complexity Analysis"]
CA --> CO["Code Optimization"]
CO --> DG["Docstring Generation"]
%% Styling for visual clarity
style SV fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,color:#000
style DG fill:#e8f5e9,stroke:#388e3c,stroke-width:2px,color:#000
- AST-based static code analysis
- Bug detection with line-level explanations
- Security vulnerability scanning
- Time complexity estimation
- Space complexity estimation
- Code optimization suggestions
- Automatic documentation generation
- Quality scoring engine
- Monaco Editor
- Live pipeline progress tracking
- Analysis dashboard
- Historical analysis records
- Side-by-side diff viewer
- Optimized code comparison
Supports two execution modes:
- No API key required
- Fully local analysis
- Fast execution
- Rule-based heuristics
- LangChain integration
- Mistral AI support
- Enhanced explanations
- Smarter optimization recommendations
- More contextual code reviews
graph TD
FE["Frontend (React + TypeScript)"] --> BE["FastAPI Backend"]
subgraph Core_Services ["Core Core Engine Layer"]
BE --> PL["Pipeline Block"]
BE --> DB_Layer["Database Interface"]
BE --> LLM["LLM Layer (LangChain / Mistral)"]
end
DB_Layer --> DB[("PostgreSQL Database")]
%% Styling
style FE fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,color:#000
style BE fill:#e8f5e9,stroke:#388e3c,stroke-width:2px,color:#000
style DB fill:#ede7f6,stroke:#5e35b1,stroke-width:2px,color:#000
- Python 3.11
- FastAPI
- SQLAlchemy 2.0
- PostgreSQL
- Pydantic v2
- React 18
- TypeScript
- Vite
- Monaco Editor
- AST Analysis
- LangChain
- Mistral AI
- Docker
- Docker Compose
- Nginx
- Pytest
CognifyAI/
├── backend/
│ ├── app/
│ ├── tests/
│ ├── Dockerfile
│ └── requirements.txt
│
├── frontend/
│ ├── src/
│ ├── Dockerfile
│ └── package.json
│
├── docs/
│ ├── api_design.md
│ ├── architecture.md
│ └── prompts.md
│
├── screenshot/
│ ├── home.jpeg
│ ├── result.jpeg
│ └── history.jpeg
│
├── docker-compose.yml
└── README.md
git clone [https://github.com/maroofiums/CognifyAI.git](https://github.com/maroofiums/CognifyAI.git)
cd CognifyAI
docker-compose up --build
| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend API | http://localhost:8000 |
| Swagger Docs | http://localhost:8000/docs |
| PostgreSQL | localhost:5432 |
The frontend automatically communicates with the backend through Nginx proxy configuration.
docker-compose down
Remove database volume:
docker-compose down -v
By default:
USE_LLM=false
To enable LangChain + Mistral enrichment:
environment:
USE_LLM: "true"
MISTRAL_API_KEY: "your-api-key"
LLM_MODEL: "mistral-small-latest"
cd backend
python -m venv .venv
source .venv/bin/activate
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
Backend:
http://localhost:8000
Swagger Documentation:
http://localhost:8000/docs
cd frontend
npm install
npm run dev
Frontend:
http://localhost:5173
For local PostgreSQL:
DATABASE_URL=postgresql://cognify:cognify@localhost:5432/cognifydb
Run PostgreSQL:
docker run -d \
--name cognify-db \
-e POSTGRES_USER=cognify \
-e POSTGRES_PASSWORD=cognify \
-e POSTGRES_DB=cognifydb \
-p 5432:5432 \
postgres:16-alpine
- Open the Home page and paste source code into the Monaco editor.
- Select the programming language.
- Click Analyze Code.
- Watch live pipeline progress updates.
- Review:
- Quality score
- Security findings
- Bug reports
- Complexity analysis
- Generated documentation
- Optimized code suggestions
- Browse historical analyses from the History page.
{
"language": "python",
"code": "def add(a,b): return a+b"
}
{
"bugs": [],
"security_issues": [],
"complexity": {
"time": "O(1)",
"space": "O(1)"
},
"optimized_code": "def add(a: int, b: int) -> int:\n return a + b",
"docstring": "Returns the sum of two integers.",
"score": {
"correctness": 95,
"readability": 90,
"security": 100,
"performance": 95,
"documentation": 85,
"overall": 93
}
}
{
"bugs": [],
"security_issues": [],
"complexity": {
"time": "O(n)",
"space": "O(1)"
},
"optimized_code": "",
"docstring": "",
"score": {
"correctness": 0,
"readability": 0,
"security": 0,
"performance": 0,
"documentation": 0,
"overall": 0
}
}
Run the complete backend test suite:
cd backend
pytest -q
Coverage includes:
- API tests
- Pipeline tests
- Service tests
- Security checks
- Syntax validation
- Score calculation
Additional documentation can be found inside the docs directory.
| File | Purpose |
|---|---|
| architecture.md | System architecture |
| api_design.md | API documentation |
| prompts.md | LLM prompt templates |
- Redis integration
- Celery background workers
- WebSocket status updates
- Authentication & authorization
- Multi-language support
- Team workspaces
- LangGraph orchestration
- RAG-powered recommendations
- GitHub repository analysis
- Pull request reviews
- CI/CD integration
- AI code review reports
Most code review tools focus on one aspect of software quality. CognifyAI combines Static Analysis, Security Review, Optimization, Documentation Generation, and AI-Assisted Insights into a single developer workflow.
The project demonstrates production-grade software engineering concepts including:
- Clean Architecture
- Repository Pattern
- Service Layer Pattern
- REST API Design
- Containerized Deployment
- AI Workflow Pipelines
- Frontend-Backend Integration
MIT License
Feel free to use, modify, and contribute.