Overview
Effective debugging strategies for both frontend and backend components of KAIU Natural Living.Browser DevTools
React DevTools
Install the React DevTools extension: Usage:- Open browser DevTools (F12)
- Navigate to “React” tab
- Inspect component tree and props
- Profile component renders
Network Tab
Debug API calls:- Open DevTools → Network tab
- Filter by “Fetch/XHR”
- Inspect request/response headers and payloads
- Check status codes and response times
Console Debugging
Add strategic console logs:Frontend Debugging
Vite Dev Server
The dev server runs on port 8080 with HMR (Hot Module Replacement):React Query DevTools
If using React Query, add DevTools:State Debugging
Debug Context state:Component Isolation
Test components in isolation:Backend Debugging
Node.js Inspector
Debug the backend with Chrome DevTools:- Open Chrome
- Navigate to
chrome://inspect - Click “Open dedicated DevTools for Node”
- Set breakpoints and inspect variables
Nodemon with Inspect
For hot reload with debugging:Console Logging
Add detailed logs in backend:Request Logging Middleware
Log all requests:Database Debugging
Prisma Studio
Visual database browser:http://localhost:5555
Query Logging
Enable Prisma query logs:Raw SQL Queries
Debug complex queries:Transaction Debugging
Redis Debugging
Redis CLI
Inspect Redis data:BullMQ Job Debugging
API Debugging
Test Endpoints with cURL
Using Postman
Import and test API endpoints:- Create a collection for KAIU APIs
- Add environment variables (base URL, tokens)
- Test all endpoints
- Save example responses
Simulate WhatsApp Webhooks
Use the provided test script:Simulate Payment Events
AI/RAG Debugging
Test AI Responses
Vector Search Debugging
LangChain Tracing
Enable verbose logging:Environment Debugging
Check Environment Variables
Verify Services
Performance Debugging
React Profiler
Backend Performance
Common Issues
Frontend Build Errors
API Not Responding
Check if backend is running:Database Connection Issues
Redis Connection Failed
Debugging Tools
VSCode Debugger
Create.vscode/launch.json:
Chrome Debugger for Frontend
- Add breakpoints in source code
- Open DevTools → Sources
- Find your file in the webpack:// section
- Step through code execution
Next Steps
- Review Testing Guide
- Explore Contributing Guidelines
- Check Code Style Guide