Skip to content

lloydharold14/eventbackend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Event Management Platform

A modern, scalable event management platform built with microservices architecture on AWS.

πŸ—οΈ Architecture Overview

This platform follows a microservices architecture with the following services:

  • User Management Service - Authentication, user profiles, and role management
  • Event Management Service - Event CRUD operations and management
  • Booking Service - Ticket reservations and capacity management
  • Payment Service - Payment processing with Stripe integration
  • Notification Service - Email, SMS, and push notifications
  • Search Service - Event discovery and search functionality
  • Analytics Service - Business intelligence and reporting

Technology Stack

  • Backend: Node.js, TypeScript, AWS Lambda
  • Database: Amazon DynamoDB (NoSQL)
  • API Gateway: AWS API Gateway v2
  • Authentication: Amazon Cognito
  • File Storage: Amazon S3 + CloudFront
  • Caching: Amazon ElastiCache Redis
  • Search: Amazon OpenSearch
  • Monitoring: CloudWatch, X-Ray
  • Infrastructure: AWS CDK (Infrastructure as Code)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • AWS CLI configured with appropriate permissions
  • AWS CDK CLI installed globally: npm install -g aws-cdk

Installation

  1. Clone the repository

    git clone <repository-url>
    cd event-management-platform
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env
    # Edit .env with your configuration
  4. Build the project

    npm run build
  5. Deploy to AWS

    # Bootstrap CDK (first time only)
    cdk bootstrap
    
    # Deploy all stacks
    npm run cdk:deploy

πŸ“‹ Development Setup

Local Development

  1. Install dependencies

    npm install
  2. Set up local environment

    # Copy environment template
    cp .env.example .env.local
    
    # Edit with your local settings
    nano .env.local
  3. Run tests

    npm test
    npm run test:coverage
  4. Lint and format code

    npm run lint
    npm run format

Environment Configuration

The platform uses AWS Systems Manager Parameter Store for configuration management. For local development, you can use environment variables:

# Required environment variables
AWS_REGION=us-east-1
ENVIRONMENT=dev
JWT_SECRET=your-jwt-secret-here
ENCRYPTION_KEY=your-encryption-key-here
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

πŸ›οΈ Project Structure

src/
β”œβ”€β”€ domains/                 # Business domain services
β”‚   β”œβ”€β”€ users/              # User Management Service
β”‚   β”œβ”€β”€ events/             # Event Management Service
β”‚   β”œβ”€β”€ bookings/           # Booking Service
β”‚   β”œβ”€β”€ payments/           # Payment Service
β”‚   β”œβ”€β”€ notifications/      # Notification Service
β”‚   β”œβ”€β”€ search/             # Search Service
β”‚   └── analytics/          # Analytics Service
β”œβ”€β”€ infrastructure/         # CDK infrastructure code
β”‚   β”œβ”€β”€ stacks/            # CDK stacks
β”‚   └── lambda/            # Lambda functions
β”œβ”€β”€ shared/                # Shared utilities
β”‚   β”œβ”€β”€ types/             # TypeScript types
β”‚   β”œβ”€β”€ validators/        # Validation schemas
β”‚   β”œβ”€β”€ errors/            # Error handling
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   └── config/            # Configuration management
└── tests/                 # Test files
    β”œβ”€β”€ unit/              # Unit tests
    β”œβ”€β”€ integration/       # Integration tests
    └── e2e/              # End-to-end tests

πŸ”§ Available Scripts

  • npm run build - Build TypeScript code
  • npm run watch - Watch for changes and rebuild
  • npm test - Run tests
  • npm run test:coverage - Run tests with coverage
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier
  • npm run cdk:diff - Show CDK diff
  • npm run cdk:deploy - Deploy all CDK stacks
  • npm run cdk:destroy - Destroy all CDK stacks

πŸš€ Deployment

Development Environment

# Deploy to development environment
npm run cdk:deploy -- --context environment=dev

Production Environment

# Deploy to production environment
npm run cdk:deploy -- --context environment=prod

Staging Environment

# Deploy to staging environment
npm run cdk:deploy -- --context environment=staging

πŸ“Š Monitoring and Observability

The platform includes comprehensive monitoring:

  • CloudWatch Dashboards - Real-time metrics and logs
  • X-Ray Tracing - Distributed tracing for microservices
  • Custom Metrics - Business metrics and KPIs
  • Alarms - Automated alerting for critical issues
  • Health Checks - Service health monitoring

Accessing Monitoring

  • CloudWatch Dashboard: Available in AWS Console
  • X-Ray Tracing: Available in AWS Console
  • Health Check Endpoint: GET /health

πŸ”’ Security

The platform implements security best practices:

  • Zero Trust Architecture - Never trust, always verify
  • Defense in Depth - Multiple security layers
  • Principle of Least Privilege - Minimum required permissions
  • Data Encryption - Encrypt everything in transit and at rest
  • Audit Trail - Log all security-relevant events

Security Features

  • JWT-based authentication with Cognito
  • Role-based access control (RBAC)
  • Input validation and sanitization
  • SQL injection prevention
  • XSS protection
  • CSRF protection
  • Rate limiting
  • DDoS protection

πŸ§ͺ Testing

Test Types

  • Unit Tests - Individual function testing
  • Integration Tests - Service integration testing
  • End-to-End Tests - Full user journey testing
  • Performance Tests - Load and stress testing
  • Security Tests - Vulnerability scanning

Running Tests

# Run all tests
npm test

# Run specific test types
npm run test:unit
npm run test:integration
npm run test:e2e

# Run with coverage
npm run test:coverage

πŸ“ˆ Performance Optimization

Optimization Strategies

  • Caching - Multi-layer caching with Redis
  • CDN - CloudFront for static content delivery
  • Database Optimization - DynamoDB best practices
  • Lambda Optimization - Cold start mitigation
  • API Optimization - Request/response optimization

Performance Targets

  • API Response Time: < 200ms (95th percentile)
  • Database Query Time: < 50ms (95th percentile)
  • Cache Hit Rate: > 90%
  • Uptime: > 99.9%

πŸ”„ CI/CD Pipeline

The platform includes automated CI/CD:

  1. Code Quality Gates

    • ESLint, Prettier, TypeScript compiler
    • Unit tests (80%+ coverage)
    • Security scanning
  2. Infrastructure Validation

    • CDK diff validation
    • Infrastructure security scanning
    • Cost estimation
  3. Deployment Stages

    • Automated testing in staging
    • Blue-green deployment
    • Automated rollback on failure

πŸ’° Cost Optimization

Cost Management Strategies

  • Serverless Architecture - Pay only for what you use
  • Auto-scaling - Scale based on demand
  • Reserved Instances - For predictable workloads
  • Cost Monitoring - Real-time cost tracking
  • Resource Optimization - Right-sizing resources

Estimated Costs

  • Development: ~$50-100/month
  • Staging: ~$200-300/month
  • Production: ~$500-1000/month (varies by usage)

πŸ†˜ Troubleshooting

Common Issues

  1. CDK Deployment Fails

    • Check AWS credentials
    • Verify IAM permissions
    • Check for resource conflicts
  2. Lambda Function Errors

    • Check CloudWatch logs
    • Verify environment variables
    • Check IAM permissions
  3. Database Connection Issues

    • Verify VPC configuration
    • Check security group rules
    • Verify DynamoDB table permissions

Getting Help

  • Check CloudWatch logs for detailed error information
  • Review X-Ray traces for performance issues
  • Use the health check endpoint for service status
  • Contact the development team for support

πŸ“š API Documentation

API documentation is available at:

  • Swagger UI: https://your-api-gateway-url/docs
  • OpenAPI Spec: https://your-api-gateway-url/openapi.json
  • Mobile API Optimization: docs/mobile-api-optimization.md - Mobile response optimization guide

πŸ“± Mobile Optimization

The API automatically provides mobile-optimized responses that reduce payload size by ~40% for mobile devices:

  • Automatic Detection: Based on User-Agent headers
  • Field Filtering: Removes internal database fields
  • Performance: Faster parsing and reduced bandwidth usage
  • Backward Compatible: Web/desktop apps continue to work normally

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

Development Guidelines

  • Follow TypeScript best practices
  • Write comprehensive tests
  • Use conventional commit messages
  • Follow the established code style
  • Document new features and APIs

πŸ“„ License

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

πŸ†˜ Support

For support and questions:

  • Documentation: Check this README and inline code comments
  • Issues: Create an issue in the repository
  • Email: Contact the development team
  • Slack: Join our development channel

Built with ❀️ by the Event Management Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published