This guide will help you quickly get the advanced search system up and running.
- Node.js v18+
- Docker & Docker Compose
- Git
cd backend
npm installnpm installcd backend
docker-compose up -dThis starts:
- PostgreSQL (port 5432)
- Redis (port 6379)
- pgAdmin (http://localhost:5050)
cd backend
npm run start:devBackend will run on: http://localhost:3000
npm run devFrontend will run on: http://localhost:3000 (Next.js)
- Homepage: http://localhost:3000
- Search Page: http://localhost:3000/search
- pgAdmin: http://localhost:5050
- Email: [email protected]
- Password: admin
- Go to http://localhost:3000/search
- Select a search type (All, Pets, Vets, etc.)
- Type in the search box
- Try the filters
- Click "Use My Location" for geolocation
# Search pets
curl "http://localhost:3000/api/v1/search/pets?query=golden"
# Autocomplete
curl "http://localhost:3000/api/v1/search/autocomplete?query=gold&type=pets"
# Popular queries
curl "http://localhost:3000/api/v1/search/popular"
# Analytics
curl "http://localhost:3000/api/v1/search/analytics"Create a seed script or manually add data:
curl -X POST http://localhost:3000/api/v1/pets \
-H "Content-Type: application/json" \
-d '{
"name": "Max",
"breed": "Golden Retriever",
"species": "Dog",
"age": 3,
"location": "San Francisco, CA",
"latitude": 37.7749,
"longitude": -122.4194,
"status": "active",
"ownerId": "YOUR_USER_ID"
}'curl -X POST http://localhost:3000/api/v1/vets \
-H "Content-Type: application/json" \
-d '{
"name": "Dr. Sarah Johnson",
"email": "[email protected]",
"specialty": "General Practice",
"clinicName": "SF Pet Clinic",
"location": "San Francisco, CA",
"latitude": 37.7749,
"longitude": -122.4194,
"yearsOfExperience": 10,
"rating": 4.8
}'curl -X POST http://localhost:3000/api/v1/emergency-services \
-H "Content-Type: application/json" \
-d '{
"name": "24/7 Pet Emergency",
"serviceType": "Emergency Clinic",
"phone": "+1-555-0123",
"latitude": 37.7749,
"longitude": -122.4194,
"location": "San Francisco, CA",
"address": "123 Main St, SF, CA 94102",
"is24Hours": true,
"rating": 4.5
}'# Check what's using port 3000
lsof -i :3000
# Kill the process
kill -9 <PID># Stop all containers
docker-compose down
# Remove volumes
docker-compose down -v
# Restart
docker-compose up -dCheck .env file in backend directory:
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=petchain_db# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install- Edit files
- Backend auto-reloads (nodemon)
- Frontend auto-reloads (Next.js)
- Test in browser
- Check API responses
- Update entity in
backend/src/modules/*/entities/ - Update DTO in
backend/src/modules/*/dto/ - Add to search query in
search.service.ts - Update frontend filters in
SearchBar.tsx
- Add sample data
- Search in UI
- Check console for network requests
- Verify response format
- Test filters and pagination
# Application
NODE_ENV=development
PORT=3000
API_PREFIX=api/v1
# Database
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=petchain_db
DB_SYNCHRONIZE=true
DB_LOGGING=true
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# CORS
CORS_ORIGIN=http://localhost:3000NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1# Backend
npm run start:dev # Start dev server
npm run build # Build production
npm run start:prod # Start production
npm run lint # Lint code
# Frontend
npm run dev # Start dev server
npm run build # Build production
npm run start # Start production
npm run lint # Lint code
# Docker
docker-compose up -d # Start services
docker-compose down # Stop services
docker-compose logs -f # View logs
docker-compose ps # List servicesImport these endpoints:
- Base URL: http://localhost:3000/api/v1
- Endpoints:
/search/pets,/search/vets, etc. - Headers:
Content-Type: application/json
# Terminal running npm run start:dev
# Logs appear automatically# Access pgAdmin at http://localhost:5050
# Connect to petchain_postgres
# Run SQL queries# Access Redis CLI
docker exec -it petchain_redis redis-cli
# List keys
KEYS *
# Get value
GET search:pets:query- ✅ Set up environment
- ✅ Start services
- ✅ Test basic search
- ⬜ Seed sample data
- ⬜ Test all search types
- ⬜ Test geolocation
- ⬜ Check analytics
- ⬜ Review performance
- Issues: Create GitHub issue
- Questions: Telegram @llins_x
- Documentation:
SEARCH_IMPLEMENTATION.md- Detailed guideIMPLEMENTATION_SUMMARY.md- Complete summary
- Docker services running
- Backend server running on port 3000
- Frontend running (Next.js dev server)
- Can access http://localhost:3000/search
- Database tables created
- Can create pets/vets via API
- Search returns results
- Autocomplete works
- Filters work
- Geolocation works
- Analytics endpoint returns data
Time to Complete: ~10 minutes Difficulty: Easy
Happy Searching! 🔍