Skip to content

prabalesh/brainless-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Brainless Map

A modern, interactive quiz and trivia game platform built with React and Go. Create custom games, add questions, and challenge your knowledge in a sleek, user-friendly interface.

License Go Version React TypeScript

โœจ Features

  • ๐ŸŽฎ Interactive Game Creation: Build custom quiz games with ease
  • โ“ Question Management: Create and organize trivia questions
  • ๐ŸŽฏ Real-time Gameplay: Engaging quiz experience with smooth navigation
  • ๐ŸŽจ Modern UI: Beautiful, responsive interface with gradient designs
  • ๐Ÿ“ฑ Mobile Responsive: Works seamlessly on all device sizes
  • ๐Ÿ” Image Search Integration: Find images for your questions
  • ๐Ÿ‘ค User Management: User profiles and game tracking
  • ๐Ÿ“Š Dashboard: Comprehensive overview of games and performance

๐Ÿš€ Quick Start

Prerequisites

  • Go: 1.21 or higher
  • Node.js: 18 or higher
  • MongoDB: Running instance
  • npm/yarn: Package manager

Installation

  1. Clone the repository

    git clone https://github.com/prabalesh/brainless-map.git
    cd brainless-map
  2. Setup Backend

    cd backend
    
    # Install dependencies
    go mod tidy
    
    # Create .env file
    cp .env.example .env
    # Edit .env with your MongoDB connection and other configs
    
    # Run the server
    go run cmd/server/main.go
  3. Setup Frontend

    cd frontend
    
    # Install dependencies
    npm install
    
    # Start development server
    npm run dev
  4. Access the application

    • Frontend: http://localhost:5173
    • Backend API: http://localhost:8080

๐Ÿ—๏ธ Architecture

Backend (Go)

backend/
โ”œโ”€โ”€ cmd/server/          # Application entry point
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ config/          # Database configuration
โ”‚   โ”œโ”€โ”€ handler/         # HTTP request handlers
โ”‚   โ”œโ”€โ”€ model/           # Data models
โ”‚   โ”œโ”€โ”€ repository/      # Data access layer
โ”‚   โ”œโ”€โ”€ service/         # Business logic layer
โ”‚   โ””โ”€โ”€ utils/           # Utility functions

Frontend (React + TypeScript)

frontend/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ pages/           # React page components
โ”‚   โ”œโ”€โ”€ services/        # API service layer
โ”‚   โ”œโ”€โ”€ types/           # TypeScript type definitions
โ”‚   โ””โ”€โ”€ App.tsx          # Main application component

๐Ÿ› ๏ธ Tech Stack

Backend

  • Go: Core backend language
  • MongoDB: Database for storing games, questions, and users
  • Gorilla Mux: HTTP router and URL matcher
  • CORS: Cross-origin resource sharing

Frontend

  • React 18: UI framework
  • TypeScript: Type-safe JavaScript
  • React Router: Client-side routing
  • Tailwind CSS: Utility-first CSS framework
  • Lucide React: Beautiful icon library
  • Vite: Fast build tool

๐Ÿ“ก API Endpoints

Games

  • GET /api/games - Get all games
  • POST /api/games - Create new game
  • GET /api/games/{id}/questions - Get questions for a game
  • POST /api/games/{id}/questions - Add question to game

Questions

  • GET /api/questions - Get all questions
  • POST /api/questions - Create new question
  • GET /api/questions/{id} - Get specific question

Users

  • POST /api/users - Create new user

Utilities

  • GET /api/images/search - Search for images

๐ŸŽฎ Usage

Creating a Game

  1. Navigate to "Create Game" in the navigation
  2. Fill in game details and settings
  3. Add questions to your game
  4. Save and share with players

Adding Questions

  1. Go to "Create Question" page
  2. Enter question text and multiple choice answers
  3. Set the correct answer and difficulty
  4. Save to question bank

Playing Games

  1. Access the Dashboard to view available games
  2. Select a game to start playing
  3. Answer questions and track your progress
  4. View results and scores

๐Ÿ”ง Configuration

Environment Variables

Create a .env file in the backend directory:

# Database
MONGO_URI=mongodb://localhost:27017/brainless-map

# Server
PORT=8080
FRONTEND_ORIGIN=http://localhost:5173

# External APIs (if applicable)
IMAGE_SEARCH_API_KEY=your_api_key_here

๐Ÿš€ Deployment

Backend Deployment

# Build the application
go build -o bin/server cmd/server/main.go

# Run in production
./bin/server

Frontend Deployment

# Build for production
npm run build

# Serve the dist folder with your preferred static server

๐Ÿงช Testing

# Backend tests
cd backend
go test ./...

# Frontend tests (if configured)
cd frontend
npm test

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ Development Guidelines

  • Follow Go conventions for backend code
  • Use TypeScript strictly in frontend
  • Maintain consistent code formatting
  • Write meaningful commit messages
  • Add tests for new features

๐Ÿ› Known Issues

  • Mobile menu functionality needs implementation
  • Image search integration may require API key setup

๐Ÿ”ฎ Future Enhancements

  • Real-time multiplayer support
  • Advanced scoring algorithms
  • Question categories and tags
  • User authentication and profiles
  • Game analytics and statistics
  • Social sharing features
  • Mobile app version

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Prabalesh

๐Ÿ™ Acknowledgments

  • Thanks to the React and Go communities for excellent documentation
  • Tailwind CSS for the amazing utility classes
  • Lucide React for the beautiful icons

โญ Star this repository if you find it helpful!

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages