This guide covers local development setup, debugging procedures, and testing strategies for all components of the Bluesky Alt Text Generator project.
- Node.js: v18.0.0 or higher (v20 recommended)
- npm: v9.0.0 or higher (comes with Node.js)
- Git: Latest version
- Browser: Chrome, Firefox, or Safari for extension development
- VS Code: Recommended IDE with extensions:
- TypeScript Language Service
- WXT.dev extension support
- REST Client for API testing
- Postman/Insomnia: API testing
- Chrome DevTools: Extension debugging
# Install Node.js (Windows with PowerShell)
winget install OpenJS.NodeJS
# Verify installation
node --version # Should be v18+
npm --version # Should be v9+# Navigate to your development directory
cd C:\Users\[username]\Documents\GitHub
# Clone all repositories
git clone https://github.com/symmetricalboy/gen-alt-text.git
git clone https://github.com/symmetricalboy/alt-text-ext.git
git clone https://github.com/symmetricalboy/alt-text-server.git
git clone https://github.com/symmetricalboy/alt-text-web.gitcd alt-text-ext
npm install
npm run postinstall # WXT preparationcd alt-text-server
npm install
# Create environment file
cp .env.example .env
# Edit .env and add your GEMINI_API_KEYcd alt-text-web
npm installcd alt-text-ext
npm run dev:chrome- Extension builds to
.output/chrome-mv3/ - Load unpacked extension in Chrome from that directory
- Hot reload enabled for most changes
npm run dev:firefox- Extension builds to
.output/firefox-mv2/ - Load temporary add-on in Firefox from
manifest.json
npm run dev:safari- Requires Safari Technology Preview for testing
- Extension builds to
.output/safari/
cd alt-text-server
npm run dev- Server runs on
http://localhost:3000 - Nodemon provides automatic restart on file changes
- Health endpoint available at
/health
cd alt-text-web
npm start- Application runs on
http://localhost:8080 - Static file serving with proper COEP/COOP headers
- Manual refresh required for changes
-
Obtain API Key:
- Visit Google AI Studio
- Create new API key
- Copy the key securely
-
Backend Server Configuration:
# In alt-text-server/.env GEMINI_API_KEY=your_actual_api_key_here -
Extension Configuration:
// In alt-text-ext/wxt.config.ts const CLOUD_FUNCTION_URL = 'http://localhost:3000/generate-alt-text';
-
Web App Configuration:
// In alt-text-web/public/index.html const API_ENDPOINT = 'http://localhost:3000/generate-alt-text';
-
Start Backend Server:
cd alt-text-server npm run dev -
Start Extension Development:
cd alt-text-ext npm run dev:chrome -
Load Extension in Browser:
- Open Chrome
- Navigate to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select
.output/chrome-mv3/directory
-
Test on Bluesky:
- Visit
https://bsky.app - Create new post with image/video
- Look for ✨ button next to alt text field
- Visit
-
Start Web App:
cd alt-text-web npm start -
Test Locally:
- Visit
http://localhost:8080 - Test file upload and compression
- Verify API communication
- Visit
# Chrome DevTools
1. Go to chrome://extensions/
2. Find your extension
3. Click "service worker" link
4. Use console for debugging# On Bluesky page
1. Open Chrome DevTools (F12)
2. Go to Sources tab
3. Find content script files
4. Set breakpoints as needed# Special debugging for FFmpeg processing
1. Add debugger; statements in offscreen-ffmpeg-handler.js
2. Look for "Offscreen Document" in Chrome task manager
3. Right-click and "Inspect" to open DevTools// Enhanced logging for development
console.log('API Request:', {
mimeType: req.body.mimeType,
dataSize: req.body.base64Data?.length,
action: req.body.action
});# Use curl for API testing
curl -X POST http://localhost:3000/generate-alt-text \
-H "Content-Type: application/json" \
-d '{"base64Data":"...","mimeType":"image/jpeg"}'- Console: JavaScript errors and logs
- Network: API request/response inspection
- Application: Service Worker and cache inspection
- Performance: FFmpeg processing analysis
// Enable FFmpeg logs in compression-worker.js
ffmpeg.setLogger(({ message }) => {
console.log('FFmpeg:', message);
});- ✨ button appears on Bluesky alt text fields
- Image upload and processing works
- Video compression and processing works
- Toast notifications display correctly
- Error handling works gracefully
- Cross-tab functionality works
-
/healthendpoint returns 200 OK - Image processing generates alt text
- Video processing generates captions
- Large file handling works
- Error responses are meaningful
- File upload (drag & drop) works
- Video compression shows progress
- Generated content displays correctly
- Copy to clipboard functions
- PWA installation works
cd alt-text-ext
npm test # If test script exists# Using curl or create test scripts
cd alt-text-server
# Create test scripts in tests/ directory- JPEG: Standard photos from phones/cameras
- PNG: Screenshots, graphics with transparency
- WebP: Modern web format
- GIF: Animated and static GIFs
- MP4: Most common video format
- WebM: Web-optimized videos
- MOV: iPhone/Mac videos
- AVI: Older video format
- Small: < 1MB (instant processing)
- Medium: 1-15MB (direct upload)
- Large: 15-100MB (compression required)
- Very Large: > 100MB (aggressive compression)
// Time compression operations
const startTime = performance.now();
const result = await compressVideo(file);
const endTime = performance.now();
console.log(`Compression took ${endTime - startTime}ms`);// Monitor memory in extension
setInterval(() => {
if (performance.memory) {
console.log('Memory:', {
used: Math.round(performance.memory.usedJSHeapSize / 1024 / 1024),
total: Math.round(performance.memory.totalJSHeapSize / 1024 / 1024),
limit: Math.round(performance.memory.jsHeapSizeLimit / 1024 / 1024)
});
}
}, 5000);# Clean install
rm -rf node_modules package-lock.json
npm install- Check manifest.json for syntax errors
- Verify all files are in correct locations
- Check browser console for CSP errors
- Verify assets are in public/assets/ffmpeg/
- Check COEP/COOP headers in web app
- Ensure proper file paths in configuration
- Verify GEMINI_API_KEY is set correctly
- Check API key permissions in Google Cloud Console
- Ensure API key is not expired
- Verify server CORS configuration
- Check origin headers in requests
- Ensure proper preflight handling
# Check TypeScript configuration
npm run compile# Clean WXT cache
rm -rf .wxt
npm run dev- React Developer Tools: Component inspection
- Redux DevTools: State management debugging
- Web Developer: Various web development utilities
- WXT.dev: Extension framework support
- TypeScript Importer: Auto-import management
- Bracket Pair Colorizer: Code readability
- GitLens: Git integration enhancement
# Create setup script (setup-dev.ps1)
cd alt-text-server
Start-Process npm -ArgumentList "run", "dev" -NoNewWindow
cd alt-text-ext
Start-Process npm -ArgumentList "run", "dev:chrome" -NoNewWindow
cd alt-text-web
Start-Process npm -ArgumentList "start" -NoNewWindow# build-all.ps1
cd alt-text-ext
npm run build:unified
cd alt-text-server
# No build needed - Node.js runtime
cd alt-text-web
# No build needed - static filesDevelopment Guide Version: 1.0 | Last Updated: January 2025