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:your_password@cluster.mongodb.net/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.