docs: comprehensive CouchDB migration documentation update
- Updated AGENTS.md with CouchDB references throughout - Updated TESTING.md to reflect CouchDB testing utilities - Updated TESTING_QUICK_START.md with CouchDB terminology - Updated TEST_IMPLEMENTATION_SUMMARY.md for CouchDB architecture - Updated IMPLEMENTATION_SUMMARY.md to include CouchDB migration - Created comprehensive COUCHDB_MIGRATION_GUIDE.md with: - Migration benefits and architecture changes - Step-by-step migration process - Data model conversions - Design document setup - Testing updates - Deployment configurations - Performance optimizations - Monitoring and troubleshooting All MongoDB references replaced with CouchDB equivalents while maintaining existing document structure and technical accuracy. 🤖 Generated with AI Assistant Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
18
AGENTS.md
18
AGENTS.md
@@ -102,13 +102,14 @@ This ensures:
|
||||
|
||||
### Monorepo Structure
|
||||
- `frontend/`: React application (Create React App)
|
||||
- `backend/`: Express API server with MongoDB
|
||||
- `backend/`: Express API server with CouchDB
|
||||
|
||||
### Backend Architecture
|
||||
The backend follows a standard Express MVC pattern:
|
||||
- `server.js`: Main entry point with Socket.IO for real-time updates
|
||||
- `routes/`: API route handlers for auth, streets, tasks, posts, events, rewards, reports, ai, payments, users
|
||||
- `models/`: Mongoose schemas (User, Street, Task, Post, Event, Reward, Report)
|
||||
- `models/`: CouchDB document models (User, Street, Task, Post, Event, Reward, Report)
|
||||
- `services/couchdbService.js`: CouchDB connection and document management service
|
||||
- `middleware/auth.js`: JWT authentication middleware using `x-auth-token` header
|
||||
|
||||
### Frontend Architecture
|
||||
@@ -130,7 +131,8 @@ Frontend proxies API requests to `http://localhost:5000` in development.
|
||||
## Environment Variables
|
||||
|
||||
Backend requires `.env` file:
|
||||
- `MONGO_URI`: MongoDB connection string
|
||||
- `COUCHDB_URL`: CouchDB connection URL (e.g., http://localhost:5984)
|
||||
- `COUCHDB_DB_NAME`: CouchDB database name (e.g., adopt-a-street)
|
||||
- `JWT_SECRET`: Secret for JWT signing
|
||||
- `PORT` (optional): Server port (defaults to 5000)
|
||||
|
||||
@@ -150,7 +152,7 @@ Backend requires `.env` file:
|
||||
## Key Technologies
|
||||
|
||||
- Frontend: React 19, React Router v6, Leaflet (mapping), Axios, Socket.IO client, Stripe.js
|
||||
- Backend: Express, Mongoose (MongoDB), JWT, bcryptjs, Socket.IO, Stripe, Multer (file uploads)
|
||||
- Backend: Express, CouchDB (NoSQL database), Nano (CouchDB client), JWT, bcryptjs, Socket.IO, Stripe, Multer (file uploads)
|
||||
- Testing: React Testing Library, Jest
|
||||
|
||||
## Socket.IO Events
|
||||
@@ -174,18 +176,18 @@ This application is deployed on a Kubernetes cluster running on Raspberry Pi har
|
||||
- Multi-arch Docker images required (linux/arm64, linux/arm/v7)
|
||||
- Resource-constrained environment - optimize for low memory usage
|
||||
- Frontend and backend should be containerized separately
|
||||
- MongoDB should run as a StatefulSet with persistent storage
|
||||
- CouchDB should run as a StatefulSet with persistent storage
|
||||
- Consider resource limits and requests appropriate for Pi hardware
|
||||
|
||||
**Deployment Strategy:**
|
||||
- Use Kubernetes manifests or Helm charts
|
||||
- Implement horizontal pod autoscaling based on available resources
|
||||
- Place memory-intensive workloads (backend, MongoDB) on Pi 5 nodes
|
||||
- Place memory-intensive workloads (backend, CouchDB) on Pi 5 nodes
|
||||
- Place frontend static serving on any node (lightweight)
|
||||
- Use NodeAffinity/NodeSelector to control pod placement
|
||||
- Implement health checks and readiness probes
|
||||
- Use ConfigMaps for environment variables
|
||||
- Use Secrets for sensitive data (JWT_SECRET, CLOUDINARY credentials, etc.)
|
||||
- Use Secrets for sensitive data (JWT_SECRET, CLOUDINARY credentials, CouchDB credentials, etc.)
|
||||
|
||||
See deployment documentation for Kubernetes manifests and deployment instructions.
|
||||
|
||||
@@ -216,7 +218,7 @@ bun run test:coverage # Run with coverage report
|
||||
- Route tests for auth, streets, tasks, posts, events, rewards, reports
|
||||
- Model tests for User, Street, Task, Post
|
||||
- Middleware tests for authentication
|
||||
- Using Jest + Supertest + MongoDB Memory Server
|
||||
- Using Jest + Supertest + CouchDB testing utilities
|
||||
|
||||
- **Frontend**: MSW infrastructure in place
|
||||
- Component tests for Login, Register, ErrorBoundary
|
||||
|
||||
Reference in New Issue
Block a user