CodeInSight is a full-stack code-review application and developer productivity toolkit. It includes:
- Backend: Express + MongoDB API that generates and stores AI-powered code reviews.
- Frontend: React + Vite single-page app with Firebase auth and an editor UI.
- VS Code Extension: a lightweight extension scaffold that can be used to integrate the reviewer inside VS Code.
This README explains how to run the project locally, what environment variables are required, and where to look when things go wrong.
CodeInsight/
├─ Backend/ # Express API (reviews)
├─ Frontend/ # React + Vite frontend
└─ codeinsight/ # VS Code extension source
- Submit source files from the browser to generate AI review comments.
- Store reviews in MongoDB and browse review history.
- VS Code extension scaffold to run or extend editor integration.
- Node.js (16+ recommended)
- npm or pnpm
- MongoDB (local or cloud), connection string
- (Optional) OpenRouter / OpenAI API key for generating real AI reviews
- (Frontend) Firebase project for authentication (optional but recommended)
- Open a terminal and install dependencies:
cd "d:\DEV\PROJECT\CodeInsight\Backend"
npm install- Create a
.envfile (copy.env.exampleif present) and set these variables:
MONGO_URI=mongodb+srv://<user>:<pass>@cluster.example.mongodb.net/codeinsight
PORT=5000
OPENROUTER_API_KEY=sk-... # optional - required for real AI reviews
- Start the server in development mode:
npm run devThe backend will listen on the PORT (default 5000) and expose the reviews API under /api/review.
If you want to quickly populate sample data (books/reviews, if provided by the app), check for any test-*.js helper scripts in the backend folder and run them with node.
- Install dependencies and start the dev server:
cd "d:\DEV\PROJECT\CodeInsight\Frontend"
npm install
npm run dev- Create a
.envfile in theFrontendfolder and set at least:
VITE_API_URL=http://localhost:5000
# Optional Firebase settings if you use authentication
VITE_API_KEY=...
VITE_AUTH_DOMAIN=...
VITE_PROJECT_ID=...
VITE_STORAGE_BUCKET=...
VITE_MESSAGING_SENDER_ID=...
VITE_APP_ID=...
- Open the app in your browser (Vite will print the URL, typically
http://localhost:5173).
Notes:
- The frontend expects the backend to be running and accessible at
VITE_API_URL. - If you see network errors like
ERR_CONNECTION_REFUSEDfor/api/reviewor/api/books, confirm the backend is running and theVITE_API_URLmatches the backend origin.
The codeinsight/ folder contains a sample VS Code extension scaffold. To run tests or package the extension:
cd "d:\DEV\PROJECT\CodeInsight\codeinsight"
npm install
# Run tests (uses vscode-test)
npm test
# To package the extension for publishing you can use `vsce package` (install `vsce` globally)
# vsce packageThe extension's main entry point is extension.js and the package manifest is package.json within that folder.
- POST
/api/review— submit code for review (body:{ filename, code, userId?, userEmail? }) - GET
/api/review— list reviews (may accept query params for filtering) - GET
/api/review/:id— get a single review - DELETE
/api/review/:id— delete a review
Adjust the requests from the frontend in Frontend/src/utils/api.js if you change API paths.
- Backend 500 on review POST: check
OPENROUTER_API_KEYand MongoDB connection. If you don't have an AI key, the server may return an error when trying to call the remote API. - Frontend:
The requested module ... does not provide an export named 'getReviews': ensure imports match the exports inFrontend/src/utils/api.js(we providegetReviews/getUserReviewsaliases). - Navbar errors using
useLocation()outside Router: ensure the React tree inFrontend/src/main.jsxwraps the app with<BrowserRouter>(it does by default in this repo). - CORS issues: backend
server.jsmay restrict origins; for local dev make surehttp://localhost:5173(Vite) is allowed in the CORS config.
If you encounter problems, check the browser console and backend logs. The codebase includes helpful console outputs in several places; follow them to pinpoint failures.
- Fork the repo and create a feature branch.
- Make your changes and add tests where possible.
- Open a pull request describing your change.
Please follow existing code style (Prettier / ESLint rules are present in some subfolders).
This project is open-source under the terms of the LICENSE file in the repository root.
If you'd like, I can also generate smaller READMEs inside the Backend/, Frontend/, and codeinsight/ folders with step-by-step instructions specific to each subproject. Would you like that?