How chaitanyapawar21/codeastra works
Purpose and Entry Points
This is a full-stack repository-analysis product. A React/Vite frontend presents repository structure, architecture, dependencies, AI insights, and chat views; a TypeScript backend accepts analysis requests, retrieves/parses repository content, runs an AI analysis graph, and persists results.
Backend startup is backend/server.ts, with Express application composition in backend/src/app.ts. Frontend bootstraps at frontend/src/main.tsx and routes/views originate from frontend/src/App.tsx.
HTTP Analysis Boundary
The backend exposes repository-analysis endpoints through backend/src/routes/repoAnalysis.route.ts, handled by backend/src/controllers/analysis.controller.ts. This layer is the boundary between browser/API callers and the asynchronous analysis workflow, delegating orchestration rather than embedding GitHub, parsing, model, or persistence concerns.
Repository Acquisition and Parsing
backend/src/services/github.service.ts retrieves source material from GitHub, while backend/src/services/parser.service.ts converts repository contents into analysis-ready structure. These services isolate external-repository access and source interpretation from the AI workflow. Shared analysis shapes are defined in backend/src/types/type.ts.
AI Workflow Graph
The central analysis pipeline is a graph defined in backend/src/ai/analysis.graph.ts, with shared graph state in backend/src/ai/state.ts and model setup in backend/src/ai/model.ts. It decomposes repository understanding into staged outputs:
• folder/structure analysis: backend/src/ai/nodes/m1Folder.node.ts
• entry-point analysis: backend/src/ai/nodes/m2EntryPoint.node.ts
• dependency analysis: backend/src/ai/nodes/m3Dependency.node.ts
• result synthesis: backend/src/ai/nodes/combine.node.ts
Stage-specific prompt contracts live under backend/src/ai/prompts/m1Prompt.ts, backend/src/ai/prompts/m2Prompt.ts, and backend/src/ai/prompts/m3Prompt.ts.
AI Service and Persistence
backend/src/services/ai.service.ts is the application-facing adapter for invoking the graph/model pipeline. Results are represented by backend/src/models/repoAnalysis.model.ts and accessed through backend/src/dao/analysis.dao.ts. Database connectivity/configuration is centralized in backend/src/config/db.ts and backend/src/config/config.ts, keeping storage infrastructure behind DAO and configuration boundaries.
Frontend Application Shell and State
The frontend uses a shared layout composed in frontend/src/layouts/MainLayout.tsx, with primary navigation in frontend/src/components/Navbar.tsx and frontend/src/components/Sidebar.tsx. frontend/src/context/AnalysisContext.tsx is the cross-page state boundary for the active analysis and its derived views.
Analysis Visualization Surfaces
Feature pages are separated by analysis perspective: repository structure (frontend/src/pages/RepositoryStructurePage.tsx), code analysis (frontend/src/pages/CodeAnalysisPage.tsx), architecture (frontend/src/pages/ArchitecturePage.tsx), dependency graph (frontend/src/pages/DependencyGraphPage.tsx), and AI insights/chat (frontend/src/pages/AIInsightsPage.tsx, frontend/src/pages/AIChatPage.tsx). Workflow UX includes initial and in-progress states in frontend/src/pages/LandingPage.tsx and frontend/src/pages/LoadingPage.tsx.
Runtime and External Dependencies
The backend runs on Node.js/TypeScript with an Express-style HTTP application, database integration, GitHub as the repository source, and an LLM/model integration behind the AI service and graph. The frontend runs as a React TypeScript SPA built and served through Vite, using Tailwind/PostCSS configuration for styling.
Main entry points: analysis.controller.ts Analysis controller · repoAnalysis.route.ts Repository analysis routes · App.tsx App routes · MainLayout.tsx Main layout and navigation
Components 23
React SPA
- Vite bootstrap
frontend/src/main.tsx - App routes
frontend/src/App.tsx - Main layout and navigation
frontend/src/layouts/MainLayout.tsx - Analysis context · Holds the active analysis and derived views.
frontend/src/context/AnalysisContext.tsx - Landing and loading
frontend/src/pages/LandingPage.tsx - Analysis views · Structure, code, architecture, dependency, insights, and chat views.
frontend/src/pages/ArchitecturePage.tsx
Backend API
- Server startup
backend/server.ts - Express application
backend/src/app.ts - Repository analysis routes
backend/src/routes/repoAnalysis.route.ts - Analysis controller · Delegates requests to the asynchronous analysis workflow.
backend/src/controllers/analysis.controller.ts - GitHub retrieval
backend/src/services/github.service.ts - Repository parser
backend/src/services/parser.service.ts
AI Analysis Pipeline
- AI service · Application-facing graph invocation boundary.
backend/src/services/ai.service.ts - Analysis graph · Coordinates staged repository analysis and synthesis.
backend/src/ai/analysis.graph.ts - Graph state and types
backend/src/ai/state.ts - Folder, entry, dependency stages · Produces structure, entry-point, and dependency findings.
backend/src/ai/nodes/m1Folder.node.ts - Result synthesis
backend/src/ai/nodes/combine.node.ts - LLM model setup
backend/src/ai/model.ts
Persistence
- Analysis DAO
backend/src/dao/analysis.dao.ts - Analysis result model
backend/src/models/repoAnalysis.model.ts - Database connection
backend/src/config/db.ts
Other components
- GitHub
- LLM provider
Connections 24
- Vite bootstrap → App routes: mounts
- App routes → Main layout and navigation: composes
- Main layout and navigation → Landing and loading: hosts
- Main layout and navigation → Analysis views: hosts
- App routes → Analysis context: provides
- Landing and loading → Repository analysis routes: starts analysis
- Analysis views → Repository analysis routes: reads results
- Analysis context → Analysis views: supplies analysis
- Server startup → Express application: starts
- Express application → Repository analysis routes: mounts
- Repository analysis routes → Analysis controller: dispatches
- Analysis controller → GitHub retrieval: acquires repository
- GitHub retrieval → GitHub: retrieves content
- Analysis controller → Repository parser: parses content
- Repository parser → AI service: analysis-ready input
- AI service → Analysis graph: invokes
- Analysis graph → Graph state and types: uses
- Analysis graph → Folder, entry, dependency stages: runs
- Folder, entry, dependency stages → Result synthesis: findings
- Result synthesis → LLM model setup: uses model
- LLM model setup → LLM provider: calls
- Analysis controller → Analysis DAO: persists and retrieves
- Analysis DAO → Analysis result model: maps
- Analysis DAO → Database connection: accesses