Find chayakkadas (Kerala tea shops) in your walkable radius! A community-driven webapp to discover and contribute information about local tea shops.
- Location-based Search with Google Maps autocomplete
- Real Walking Times via Distance Matrix API (not just straight-line distance!)
- Customizable Filters for max distance and walking time
- Current Location detection support
- Dual View Mode: Toggle between list and interactive map views
- Custom Markers: Tea cup markers for chayakkadas, location marker for you
- Click to Navigate: Direct Google Maps navigation integration
- Community Reviews: Write and read text reviews
- Dual Rating System: Google ratings + community chayakkada ratings
- Review History: Track all reviews for each chayakkada
- Add New Places: Search and add from Google Maps Places API
- Contribute Details: Rate, list items, update availability
- Contribution History: Full transparency of all contributions
- User Authentication: Optional login for contributors
- Google Maps data (name, rating, photos, address)
- Community chayakkada ratings (1-5 stars)
- Items available (pazhampori, egg puffs, samosa, vada, chai varieties)
- Cigarette availability indicator
- Photo galleries from Google Places
- Rate Limiting: Protection against abuse
- Input Validation: Comprehensive validation with express-validator
- Security Headers: Helmet.js for secure HTTP headers
- Logging: Winston-based structured logging
- SQL Injection Protection: Parameterized queries only
- Backend: Node.js + Express
- Database: PostgreSQL with PostGIS extension for geospatial queries
- Authentication: JWT with bcrypt password hashing
- Security: Helmet, express-rate-limit, express-mongo-sanitize, HPP protection
- Logging: Winston (structured logging to console and files)
- Maps: Google Maps JavaScript API, Places API, Distance Matrix API, Geocoding API
- Frontend: Vanilla HTML/CSS/JavaScript (lightweight and fast!)
- Styling: Responsive CSS with Kerala-inspired warm color palette
- Node.js (v16 or higher)
- PostgreSQL (v12 or higher)
- Google Maps API Key with the following APIs enabled:
- Maps JavaScript API
- Places API
- Distance Matrix API
- Geocoding API
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/chayakkada-near-me.git cd chayakkada-near-me -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envand add your credentials:DATABASE_URL=postgresql://username:password@localhost:5432/chayakkada GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here JWT_SECRET=your_secure_jwt_secret_here NODE_ENV=development PORT=3000
-
Create PostgreSQL database
createdb chayakkada
-
Start the server
npm start
For development with auto-reload:
npm run dev
-
Open your browser
http://localhost:3000
You need to enable these APIs in your Google Cloud Console:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the following APIs:
- Maps JavaScript API
- Places API
- Distance Matrix API
- Geocoding API
- Create credentials (API Key)
- Add the API key to your
.envfile
Important: Restrict your API key in production:
- Set HTTP referrer restrictions
- Set API restrictions to only the APIs you need
The application automatically creates the necessary tables on startup:
- chayakkadas: Main table with place details and geospatial location (PostGIS GEOGRAPHY type)
- chayakkada_metadata: User-contributed metadata (ratings, items, cigarettes)
- reviews: User reviews for each chayakkada
- users: User authentication data (hashed passwords)
PostGIS extension is automatically enabled for efficient geospatial queries. Spatial indexes are created for optimal performance.
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userGET /api/auth/me- Get current user info
POST /api/search- Search for chayakkadas with filtersGET /api/chayakkada/:id- Get detailed chayakkada informationGET /api/chayakkada/:id/reviews- Get all reviews for a chayakkada
POST /api/chayakkada- Add a new chayakkadaPOST /api/chayakkada/:id/metadata- Add/update chayakkada detailsPOST /api/chayakkada/:id/review- Add a review
POST /api/geocode- Convert address to coordinatesGET /api/places/autocomplete- Google Places autocompleteGET /api/places/details- Get Google Place detailsGET /api/photo-proxy- Proxy for Google Places photosGET /api/health- Health check endpoint
All endpoints include rate limiting and input validation. Authentication is optional for viewing, required for contributions.
This app is designed to be easily deployed to any cloud platform that supports Node.js and PostgreSQL:
Recommended platforms:
- Railway: PostgreSQL + Node.js hosting with generous free tier
- Render: Free PostgreSQL and web service hosting
- Fly.io: Global deployment with PostgreSQL
- Heroku: Classic option with PostgreSQL add-on
- DigitalOcean App Platform: Simple deployment with managed databases
-
Environment Variables
DATABASE_URL- PostgreSQL connection string with SSL enabledGOOGLE_MAPS_API_KEY- API key with proper restrictionsJWT_SECRET- Secure random string (useopenssl rand -base64 32)NODE_ENV=productionALLOWED_ORIGINS- Your production domain(s)
-
Database Setup
- Enable PostGIS extension:
CREATE EXTENSION IF NOT EXISTS postgis; - Run migrations (automatic on first server start)
- Set up automated backups
- Configure connection pooling
- Enable PostGIS extension:
-
Security Checklist
- Restrict Google Maps API key (HTTP referrer + API restrictions)
- Set strong JWT secret
- Enable HTTPS (most platforms do this automatically)
- Configure CORS for your production domain
- Review rate limits in
middleware/security.js
-
Performance Optimization
- Enable gzip compression (handled by hosting platform)
- Set up CDN for static assets (optional)
- Configure database connection pool size
- Monitor API usage and costs
βββ public/ # Frontend static files
β βββ index.html # Single-page application
β βββ styles.css # Responsive CSS with theme
β βββ app.js # Vanilla JavaScript
βββ middleware/ # Express middleware
β βββ auth.js # JWT authentication
β βββ security.js # Security & rate limiting
β βββ validators.js # Input validation
βββ server.js # Main Express server
βββ logger.js # Winston logging configuration
βββ seed.js # Database seeding script
- Geospatial Indexing: PostGIS GIST indexes for sub-millisecond location queries
- API Proxying: Backend proxies Google APIs to keep keys secure
- Rate Limiting: Prevents abuse and manages API costs
- Efficient Queries: Optimized SQL with proper joins and limits
- Photo Caching: Browser caching headers for Google Photos
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick start:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Add user profiles and contribution history
- Implement favorite/bookmark functionality
- Add photo upload for community-contributed images
- Create mobile app (React Native)
- Add social sharing features
- Implement advanced filtering (opening hours, price range)
- Add support for other languages (Malayalam, Hindi)
- Create analytics dashboard for administrators
MIT License - see LICENSE file for details.
- Inspired by the chai culture of Kerala
- Built with modern web technologies
- Community-driven data and contributions
- Google Maps Platform for location services
- Report bugs via GitHub Issues
- Feature requests welcome
- Pull requests appreciated
Made with β€οΈ and β for the chayakkada community