The backend for Globetrotter - The Ultimate Travel Guessing Game!
Powered by Node.js, Express, MongoDB, Redis, and Socket.io, this backend handles game logic, user interactions, and real-time updates.
- 🛠️ Features
- 🚀 Installation
- 📌 Environment Variables
▶️ Running the Server- 🧪 Running Tests
- 📂 Project Structure
- 📌 API Endpoints
- 🤝 Contributing
- 📜 License
✅ AI-enhanced destination dataset – Uses a mix of AI tools and manual curation.
✅ Rate-limited API – Protects against excessive requests.
✅ Real-time multiplayer support – Powered by Socket.io.
✅ Robust validation – Uses Joi for request validation.
✅ Secure & optimized – Helmet, CORS, compression, and logging (Winston & Morgan).
git clone https://github.com/ashvinck/globetrotter-backend.git
cd globetrotter-backend
npm install
Create a .env
file in the root directory and define the following variables:
PORT=5000
MONGO_URI=mongodb+srv://your_username:[email protected]/globetrotter
REDIS_URL=redis://localhost:6379
npm run dev
npm start
npm test
To run tests in watch mode:
npm run test:watch
📦 globetrotter-backend
├── 📂 src
│ ├── 📂 config # Database and environment configuration
│ ├── 📂 controllers # Route handlers
│ ├── 📂 middleware # Express middleware (auth, validation, rate limiting, etc.)
│ ├── 📂 models # Mongoose models
│ ├── 📂 routes # API routes
│ ├── 📂 services # Business logic (game logic, scoring, AI integration, etc.)
│ ├── 📂 utils # Helper functions (logging, error handling, etc.)
│ ├── index.js # Main server file
├── .env # Environment variables
├── .gitignore # Files to ignore in git
├── package.json # Dependencies and scripts
├── README.md # Documentation
GET /destinations/get/random
– Get random cluesPOST /destinations/check-destination
– Check user selected destination is correct or not
GET /destinations/get/all
– Retrieve all destination info.POST /api/admin/add-destination
– Add new destinations.
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Commit your changes (
git commit -m "Added new feature"
) - Push to the branch (
git push origin feature-branch
) - Open a pull request
This project is licensed under the ISC License.