Skip to content

apps-codes/shodh-code-challenge

Repository files navigation

πŸ† Shodh-a-Code Contest Platform

A comprehensive real-time coding contest platform built with modern technologies, following Extreme Programming (XP) practices and microservices architecture.

CI/CD Coverage License

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+
  • Java 17+
  • Maven 3.8+

Start the Platform

# Clone the repository
git clone <repository-url>
cd shodh-code-challenge

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

Access the Services

��️ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Frontend (Next.js)                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚  β”‚   React UI      β”‚  β”‚   Monaco Editor β”‚                  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Backend (Spring Boot)                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  REST API       β”‚  β”‚  WebSocket      β”‚  β”‚   Security  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 Infrastructure Layer                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   PostgreSQL    β”‚  β”‚    RabbitMQ     β”‚  β”‚    Redis    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

Frontend

  • Next.js 14 with App Router and TypeScript
  • Tailwind CSS for responsive design
  • Zustand for state management
  • Monaco Editor for code editing
  • React Hook Form with Zod validation

Backend

  • Spring Boot 3.2.0 with Java 17
  • Hexagonal Architecture (Ports & Adapters)
  • PostgreSQL 15 for data persistence
  • RabbitMQ for message queuing
  • Redis for caching
  • Docker for code execution

Infrastructure

  • Docker & Docker Compose for containerization
  • Nginx as reverse proxy
  • Prometheus + Grafana for monitoring
  • GitHub Actions for CI/CD

✨ Features

🎯 Core Features

  • Real-time Contest Management: Create and manage coding contests
  • Live Code Judging: Secure code execution using Docker containers
  • Live Leaderboard: Real-time rankings and statistics
  • Multi-language Support: Java, Python, JavaScript, C++
  • Responsive Design: Works on desktop, tablet, and mobile

πŸ”§ Advanced Features

  • Asynchronous Processing: Queue-based submission handling
  • Real-time Updates: WebSocket connections for live data
  • Comprehensive Testing: Unit, integration, and E2E tests
  • Monitoring & Observability: Prometheus metrics and Grafana dashboards
  • Security: Input validation, code isolation, and rate limiting

πŸ“ Project Structure

shodh-code-challenge/
β”œβ”€β”€ backend/                    # Spring Boot Backend
β”‚   β”œβ”€β”€ src/main/java/com/shodh/contest/
β”‚   β”‚   β”œβ”€β”€ domain/            # Domain models and ports
β”‚   β”‚   β”œβ”€β”€ application/       # Use cases and services
β”‚   β”‚   β”œβ”€β”€ infrastructure/    # Adapters and repositories
β”‚   β”‚   └── interfaces/        # REST controllers and DTOs
β”‚   β”œβ”€β”€ src/test/             # Comprehensive test suite
β”‚   └── Dockerfile
β”œβ”€β”€ frontend/                   # Next.js Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/              # Next.js App Router pages
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”œβ”€β”€ hooks/           # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ store/           # Zustand stores
β”‚   β”‚   └── services/        # API services
β”‚   └── Dockerfile
β”œβ”€β”€ docker/                    # Docker configurations
β”œβ”€β”€ monitoring/                # Monitoring setup
β”œβ”€β”€ nginx/                     # Reverse proxy config
β”œβ”€β”€ .github/workflows/         # CI/CD pipelines
└── docs/                      # API documentation

πŸ§ͺ Testing

Backend Testing

cd backend
./mvnw test                    # Unit tests
./mvnw test -Dtest="*IntegrationTest"  # Integration tests
./mvnw test -Dtest="*ArchTest"         # Architecture tests
./mvnw jacoco:report           # Coverage report

Frontend Testing

cd frontend
npm test                       # Unit tests
npm run test:coverage          # Coverage report
npm run test:e2e              # E2E tests

πŸš€ Development

Backend Development

cd backend
./mvnw spring-boot:run

Frontend Development

cd frontend
npm run dev

πŸ“Š Monitoring

Metrics Available

  • Application Metrics: Request count, response time, error rate
  • Business Metrics: Contest participation, submission success rate
  • Infrastructure Metrics: CPU, memory, database connections

Dashboards

  • Application Dashboard: Real-time application health
  • Contest Dashboard: Contest participation and performance
  • Infrastructure Dashboard: System resource utilization

πŸ”’ Security

Security Measures

  • Input Validation: All inputs are validated and sanitized
  • Code Execution Isolation: Docker containers with resource limits
  • SQL Injection Prevention: JPA/Hibernate with parameterized queries
  • XSS Protection: React's built-in XSS protection
  • Rate Limiting: API throttling to prevent abuse

πŸ“ˆ Performance

Performance Metrics

  • Response Time: < 200ms for API calls
  • Throughput: 1000+ requests/second
  • Code Execution: < 5 seconds per submission
  • Frontend Load Time: < 2 seconds first contentful paint

🀝 Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Write tests
  5. Submit a pull request

Code Standards

  • Backend: Google Java Style Guide
  • Frontend: ESLint + Prettier configuration
  • Commits: Conventional commit messages
  • Testing: 80%+ code coverage requirement

πŸ“š Documentation

🎯 Roadmap

Planned Features

  • Real-time collaboration
  • Advanced analytics
  • Mobile application
  • AI-powered code analysis
  • Multi-tenancy support

Technical Improvements

  • Microservices architecture
  • Event sourcing
  • GraphQL API
  • Kubernetes deployment
  • Service mesh implementation

πŸ“ž Support

πŸ“„ License

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

πŸ™ Acknowledgments

  • Spring Boot team for the excellent framework
  • Next.js team for the amazing React framework
  • Docker team for containerization
  • Prometheus and Grafana teams for monitoring tools

Built with ❀️ by the Shodh AI Team

This platform represents a complete, production-ready implementation of a real-time coding contest platform, following industry best practices and modern development methodologies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors