A Chrome extension that uses AI to summarize web page content. Built with React, Vite, NestJS, and OpenAI.
neoai/
├── backend/ # NestJS backend with hexagonal architecture
│ ├── src/
│ │ ├── domain/ # Domain layer (ports)
│ │ ├── application/ # Application layer (services, DTOs)
│ │ ├── infrastructure/ # Infrastructure layer (OpenAI adapter)
│ │ └── adapters/ # HTTP adapters (controllers)
│ ├── .env # Environment variables
│ └── package.json
│
└── frontend/ # React + Vite Chrome extension
├── src/
│ ├── App.tsx # Main popup component
│ └── index.css # Tailwind CSS styles
├── public/
│ ├── manifest.json # Chrome extension manifest
│ └── icon*.png # Extension icons
└── package.json
- Navigate to the backend directory:
cd backend- Install dependencies (already done):
npm install-
The
.envfile is already configured with the OpenAI API key. -
Start the backend server:
npm run start:devThe backend will run on http://localhost:3000.
- Navigate to the frontend directory:
cd frontend- Install dependencies (already done):
npm install- Build the extension:
npm run buildThis will create a dist/ directory with the Chrome extension files.
- Build the frontend:
cd frontend
npm run build-
Open Chrome and navigate to
chrome://extensions/ -
Enable "Developer mode" (toggle in the top right)
-
Click "Load unpacked"
-
Select the
frontend/dist/directory -
The extension should now appear in your extensions list
-
Make sure the backend is running (
cd backend && npm run start:dev) -
Navigate to any web page in Chrome
-
Click the extension icon in the Chrome toolbar
-
Click "Summarize This Page" button
-
Wait for the AI to generate a summary
-
The summary will be displayed in the popup
The backend follows hexagonal architecture:
- Domain Layer (
src/domain/): Contains ports (interfaces) - Application Layer (
src/application/): Contains services and DTOs - Infrastructure Layer (
src/infrastructure/): Contains external service adapters (OpenAI) - Adapters Layer (
src/adapters/): Contains HTTP controllers
To modify the summarization logic, edit:
backend/src/infrastructure/openai/openai.adapter.ts
The frontend is a simple React app with Tailwind CSS:
- Main component:
frontend/src/App.tsx - Styles:
frontend/src/index.css - Manifest:
frontend/public/manifest.json
To modify the UI, edit App.tsx. The component:
- Extracts page content using Chrome APIs
- Sends it to the backend
- Displays the summary
The Vite configuration (frontend/vite.config.ts) is set up to:
- Build the extension files to
dist/ - Copy manifest.json and icons to the output directory
- Bundle all assets correctly for Chrome
Summarizes the provided content using OpenAI.
Request:
{
"content": "Page content to summarize..."
}Response:
{
"summary": "AI-generated summary..."
}- NestJS - Node.js framework
- OpenAI API - AI summarization
- TypeScript
- Hexagonal architecture pattern
- React - UI library
- Vite - Build tool
- Tailwind CSS - Styling
- Chrome Extension APIs
- TypeScript
- The backend must be running for the extension to work
- The OpenAI API key is configured in
backend/.env - For production, add proper error handling and rate limiting
- Icon placeholders are included; replace with actual icons for production
- CORS is enabled on the backend for development
Extension not loading:
- Make sure you ran
npm run buildin the frontend directory - Check that manifest.json is in the dist/ folder
Summarization fails:
- Ensure the backend is running on http://localhost:3000
- Check the browser console for errors
- Verify the OpenAI API key is valid in backend/.env
Build errors:
- Delete node_modules and package-lock.json
- Run npm install again
- Make sure you're using a recent Node.js version (16+)