# DJ Management System ## Overview This is a full-stack web application for managing DJs, events, and scheduling. The system provides a comprehensive platform for DJ profile management, event scheduling, availability tracking, and administrative oversight. Built with modern web technologies, it features a React frontend with a Node.js/Express backend, utilizing PostgreSQL for data persistence. ## User Preferences Preferred communication style: Simple, everyday language. ## System Architecture ### Frontend Architecture - **Framework**: React with TypeScript - **Build Tool**: Vite for fast development and optimized builds - **UI Components**: Shadcn/UI components built on Radix UI primitives - **Styling**: Tailwind CSS with custom design tokens - **Routing**: Wouter for lightweight client-side routing - **State Management**: TanStack Query for server state management - **Form Handling**: React Hook Form with Zod validation ### Backend Architecture - **Runtime**: Node.js with Express.js framework - **Language**: TypeScript with ES modules - **Database**: PostgreSQL with Drizzle ORM - **Authentication**: Replit Auth with OpenID Connect - **Session Management**: Express sessions with PostgreSQL storage - **Database Connection**: Neon serverless PostgreSQL ### Authentication & Authorization - **Provider**: Replit Auth (OpenID Connect) - **Session Storage**: PostgreSQL-backed sessions using connect-pg-simple - **Role-based Access**: Two roles - DJ and Admin - **Protected Routes**: Authentication middleware for API endpoints - **User Management**: Admin-initiated invitations with secure registration links ## Key Components ### User Management - **DJ Users**: Profile management, event creation, availability setting - **Admin Users**: System oversight, user management, event approval - **Invitation System**: Secure invitation links for DJ onboarding - **Profile Features**: Display names, profile images, social media links ### Event Management - **Event Types**: Configurable event categories (radio, club, special events) - **Event Creation**: DJs can create personal events, admins manage all events - **Scheduling**: Date, time, location, and description management - **Removal Requests**: DJs can request removal from admin-assigned events ### Availability System - **Calendar Interface**: Visual availability management - **Date Ranges**: Support for single dates or date ranges - **Frequency Limits**: Maximum events per month configuration - **Conflict Prevention**: Automatic checking against existing commitments ### Administrative Tools - **DJ Management**: Invite, activate/deactivate, role management - **Event Oversight**: Approve/deny removal requests, manage all events - **Schedule Templates**: Recurring event templates (e.g., weekly radio shows) - **Assignment Tool**: Automated DJ assignment with rotation logic ## Data Flow ### User Authentication Flow 1. User accesses protected route 2. Replit Auth middleware validates session 3. User data retrieved from PostgreSQL 4. Role-based access control applied 5. Frontend receives user context ### Event Management Flow 1. DJ creates event through form 2. Client-side validation with Zod schema 3. API request to Express backend 4. Database validation and storage 5. Real-time updates via TanStack Query 6. Admin notifications for approval workflows ### Availability Management Flow 1. DJ selects unavailable dates on calendar 2. Date range validation and conflict checking 3. Database storage with user association 4. Integration with assignment algorithms 5. Real-time calendar updates ## External Dependencies ### Core Dependencies - **@neondatabase/serverless**: PostgreSQL connection for serverless environments - **drizzle-orm**: Type-safe database ORM with PostgreSQL dialect - **@tanstack/react-query**: Server state management and caching - **@radix-ui/react-***: Accessible UI component primitives - **react-hook-form**: Form state management and validation - **zod**: Schema validation for forms and API endpoints ### Development Dependencies - **vite**: Fast build tool with HMR support - **typescript**: Static type checking - **tailwindcss**: Utility-first CSS framework - **drizzle-kit**: Database migration and introspection tools ### Authentication Dependencies - **openid-client**: OpenID Connect client implementation - **passport**: Authentication middleware - **connect-pg-simple**: PostgreSQL session store - **express-session**: Session management middleware ## Deployment Strategy ### Build Process - **Frontend**: Vite builds optimized static assets to `dist/public` - **Backend**: esbuild bundles server code to `dist/index.js` - **Database**: Drizzle migrations manage schema changes - **Environment**: Supports both development and production modes ### Environment Configuration - **DATABASE_URL**: PostgreSQL connection string (required) - **SESSION_SECRET**: Session encryption key - **REPLIT_DOMAINS**: Allowed domains for Replit Auth - **NODE_ENV**: Environment mode (development/production) ### Hosting Requirements - **Node.js**: Version 18+ with ES modules support - **PostgreSQL**: Compatible with Neon serverless or traditional PostgreSQL - **SSL/TLS**: Required for secure authentication flows - **File Storage**: Local storage for uploaded profile images (can be extended to cloud storage) ### Database Architecture - **Schema Management**: Drizzle ORM with TypeScript schema definitions - **Migrations**: Version-controlled database changes - **Indexing**: Optimized for query performance on events and availability - **Relationships**: Proper foreign key constraints and relations - **Session Storage**: Dedicated table for authentication sessions The system is designed to be easily deployable on platforms like Replit, Vercel, or traditional hosting environments, with PostgreSQL as the primary database requirement.