ao-shield/
βββ extension/ # Browser extension codebase
β βββ src/ # React source code
β βββ public/ # Static assets (copied to dist)
β βββ dist/ # Built extension (load this in browser)
β βββ manifest.json # Extension manifest
β βββ package.json # Extension dependencies
βββ frontend/ # Landing page/website
βββ docs/ # Documentation
βββ DEVGUIDE.md # This file
- Node.js (v16 or higher)
- npm or yarn
- Chrome/Edge browser for testing
# Clone the repository
git clone https://github.com/dinahmaccodes/ao-shield.git
cd ao-shield/extension
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run buildsrc/- Your development code (React, TypeScript)public/- Static assets (images, manifest)dist/- Built extension that browser reads
π¨ The browser extension ONLY reads from the dist/ folder, NOT src/
# Navigate to extension directory
cd extension/
# Edit files in src/ directory
# - src/pages/ for page components
# - src/components/ for reusable components
# - src/assets/ for development assets- Images/SVGs: Place in
public/assets/images/ - Reference in code: Use path
/assets/images/filename.svg - Why: Files in
public/get copied directly todist/
npm run buildThis compiles your React code and copies public assets to dist/
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
dist/folder (NOTsrc/) - Test your changes
# After making changes:
npm run build
# Then in Chrome:
# - Go to chrome://extensions/
# - Click the reload button on your extension# 1. Add image to public directory
cp new-image.svg public/assets/images/
# 2. Use in React component
<img src="/assets/images/new-image.svg" alt="Description" />
# 3. Build and test
npm run build# 1. Edit CSS/Tailwind classes in components
# 2. For custom styles, edit src/index.css
# 3. Build to see changes
npm run build# 1. Create component in src/pages/ or src/components/
# 2. Import and use in src/App.jsx
# 3. Build and test
npm run build- React - UI framework
- Vite - Build tool and dev server
- Tailwind CSS - Styling framework
- Framer Motion - Animations
- TypeScript - Type safety (for .tsx files)
- Manifest V3 - Latest Chrome extension format
- Content Scripts - Interact with web pages
- Background Scripts - Run in background
- Popup - Extension popup interface
extension/
βββ src/
β βββ App.jsx # Main app component
β βββ main.jsx # React entry point
β βββ index.css # Global styles
β βββ components/ # Reusable components
β β βββ Header.tsx # Top header with logo
β β βββ NavBar.tsx # Bottom navigation
β β βββ Card.tsx # Card component
β βββ pages/ # Page components
β βββ ConnectWallet.tsx # Initial connection page
β βββ Alerts.tsx # Alerts/threats page
β βββ Dashboard.tsx # Threat details
β βββ History.tsx # Transaction history
β βββ Settings.tsx # User settings
βββ public/
β βββ assets/
β βββ images/ # Static images (SVGs, PNGs)
βββ dist/ # Built extension (ignored by git)
βββ manifest.json # Extension permissions & config
βββ popup.html # Extension popup HTML
βββ background.js # Background script
βββ content_ao.js # Content script
βββ package.json # Dependencies & scripts
vite.config.js- Vite build configurationtailwind.config.js- Tailwind CSS configurationtsconfig.json- TypeScript configurationpostcss.config.js- PostCSS configuration
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes and commit
git add .
git commit -m "feat: add new feature"
# Push to remote
git push -u origin feature/your-feature-name
# Create pull request on GitHub# If you rebased and have divergent branches:
git push --force-with-lease
# DO NOT pull after rebase - just force pushProblem: Images show broken/missing Solution:
- Check images are in
public/assets/images/ - Use correct path:
/assets/images/filename.svg - Rebuild:
npm run build
Problem: Code changes don't appear in extension Solution:
- Build first:
npm run build - Reload extension in Chrome
- Check you're loading
dist/folder, notsrc/
Problem: Chrome shows extension errors Solution:
- Check
dist/manifest.jsonexists - Verify build completed successfully
- Check browser console for errors
Problem: Tailwind classes not working Solution:
- Ensure Tailwind is imported in
src/index.css - Check class names are correct
- Rebuild extension
# Check build output
npm run build
# Validate extension
./validate_extension.sh
# Development server (for testing outside extension)
npm run dev- Extension popup: Right-click extension β "Inspect"
- Content script: Regular page DevTools
- Background script: Extensions page β "Inspect views"
npm run buildnpm run build
# Output in dist/ folder ready for Chrome Web Store# Create extension zip for store
zip -r ao-shield-extension.zip dist/- Only request permissions you need
- Use
activeTabinstead of broadtabspermission - Avoid
<all_urls>unless necessary
- No inline scripts in manifest
- Use nonce for dynamic content
- Sanitize user inputs
- Keep sensitive data out of public/
- Use environment variables for API keys
- Never commit private keys (.pem files)
- Load extension in Chrome
- Test all navigation flows
- Verify responsive design
- Check error states
- Test on different websites
# Validate manifest and structure
./validate_extension.sh
# Check for common issues
npm run build && echo "Build successful"- Check this guide first
- Look at similar components in the codebase
- Check browser console for errors
- Review Git history for similar changes
- Ask questions in team chat/issues
# Reset to clean state
npm run build && rm -rf dist && npm run build
# Check file structure
ls -la dist/
# Verify assets copied
ls -la dist/assets/images/
# Check for TypeScript errors
npx tsc --noEmitcd extension/ # Navigate to extension
npm install # Install dependencies
npm run build # Build for production
npm run dev # Development server- Static assets:
public/assets/images/ - React components:
src/components/orsrc/pages/ - Global styles:
src/index.css - Built extension:
dist/(load this in browser)
- Always build before testing:
npm run build - Load
dist/folder in Chrome, notsrc/ - Place images in
public/assets/images/ - Reference images as
/assets/images/filename.svg - Reload extension after each build
Happy coding! π