Skip to content

MasterBhuvnesh/Schedula-Server

Repository files navigation

Supabase TypeScript Husky ESLint Express Node.js Render

Schedula Server

Version License TypeScript Node.js Coverage

Schedula Server is a high-performance backend service designed to power modern event management systems. Built with TypeScript and Node.js, it excels at generating and managing secure QR codes for event access control, while providing robust health monitoring and comprehensive logging capabilities.

Why Schedula Server?

  • Security First: Built with industry-standard security practices using Helmet and CORS protection
  • Modern Stack: Leverages TypeScript for type safety and modern ES6+ features
  • Cloud Ready: Seamless integration with Supabase for secure and scalable storage
  • Developer Friendly: Comprehensive test coverage and detailed documentation
  • Production Grade: Built-in health monitoring, error handling, and logging
  • Enterprise Ready: Follows best practices for scalability and maintenance

This server is an integral part of the Schedula ecosystem, designed to handle event management needs at scale, from small meetups to large conferences.

πŸ“š Features

  • QR Code Generation & Management: Create and store QR codes for event access
  • Automated Health Checks: Scheduled cron jobs for system health monitoring
  • Secure Storage: Integration with Supabase for secure file storage
  • Type Safety: Built with TypeScript for increased reliability
  • Test Coverage: Comprehensive test suite with 80%+ coverage
  • API Validation: Request/response validation
  • Error Handling: Comprehensive error handling and logging

πŸ“š Prerequisites

  • Node.js (v14 or higher)
  • npm
  • A Supabase account and project

πŸ“š Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Create a .env file in the root directory (see Configuration section)
  4. Start the server:
    npm run dev   # for development
    npm start     # for production

πŸ“š Configuration

Create a .env file with the following variables:

NODE_ENV=development
PORT=3000

# Supabase Configuration
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_STORAGE_BUCKET_QR=your_qr_bucket

# Health Check
API_URL=http://localhost:3000/health
HEALTH_CHECK_SCHEDULE="*/14 * * * *"

The server can be configured through environment variables:

Variable Description Default
PORT Port for the server 3000
NODE_ENV Environment mode development
SUPABASE_URL Supabase instance URL (required)
SUPABASE_ANON_KEY Supabase anonymous key (required)
SUPABASE_STORAGE_BUCKET_QR Bucket name for QR codes (required)
API_URL URL for API health checks http://localhost:3000/health
HEALTH_CHECK_SCHEDULE Cron schedule for health checks */14 * * * *

πŸ“š API Documentation

Endpoints

Generate QR Code

POST /api/qr/generate

Request Body:

{
  "qrId": "string",
  "qrCode": "string",
  "userId": "string"
}

Response:

{
  "status": "success",
  "data": {
    "url": "string"
  }
}

πŸ“š Development Features

Health Check System

  • Runs only in development mode
  • Configured through HEALTH_CHECK_SCHEDULE in cron format
  • Monitors API health at configured intervals

Logging

  • Colored console output in development
  • File-based logging with daily rotation
  • Separate error logs
  • JSON formatting for production

πŸ“š Scripts

  • npm start - Start the server in production mode
  • npm run dev - Start the server in development mode with hot reload
  • npm run build - Build the TypeScript code
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier

πŸ“š Technologies

Core Dependencies

  • Express - Web framework
  • Supabase - Backend storage
  • QRCode - QR code generation
  • Cron - Task scheduling
  • Joi - Request validation
  • TypeScript - Type safety

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • Jest - Testing framework
  • Husky - Manage Git hooks
  • Docker - Containerization

πŸ“š Documentation

πŸ“š License

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

About

High-performance event management backend service with QR code generation, health monitoring, and comprehensive logging capabilities

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published