mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 07:32:11 +01:00
5fb491214ac7e404791b01b9fc0a172c0fe6bfad
- Add missing offset parameter to query parameters table - Document 10,000 violation entries hard cap for memory management - Ensure documentation matches all code examples - Clarify both time-based and count-based memory constraints Resolves inconsistency between examples and parameter documentation
LiveDash-Node
A comprehensive real-time analytics dashboard for monitoring user sessions with AI-powered analysis, enterprise-grade security features, and advanced processing pipeline.
Features
Core Analytics
- Real-time Session Monitoring: Track and analyze user sessions as they happen
- Interactive Visualizations: Geographic maps, response time distributions, and advanced charts
- AI-Powered Analysis: OpenAI integration with 50% cost reduction through batch processing
- Advanced Analytics: Detailed metrics and insights about user behavior patterns
- Session Details: In-depth analysis of individual user sessions with transcript parsing
Security & Admin Features
- Enterprise Security: Multi-layer security with CSRF protection, CSP, and rate limiting
- Security Monitoring: Real-time threat detection and alerting system
- Audit Logging: Comprehensive security audit trails with retention management
- Admin Dashboard: Advanced administration tools for user and system management
- Geographic Threat Detection: IP-based threat analysis and anomaly detection
Platform Management
- Multi-tenant Architecture: Company-based data isolation and management
- User Management: Role-based access control with platform admin capabilities
- Batch Processing: Optimized AI processing pipeline with automated scheduling
- Data Export: CSV/JSON export capabilities for analytics and audit data
Tech Stack
- Frontend: React 19, Next.js 15, TailwindCSS 4
- Backend: Next.js API Routes, tRPC, Custom Node.js server
- Database: PostgreSQL with Prisma ORM and connection pooling
- Authentication: NextAuth.js with enhanced security features
- Security: CSRF protection, CSP with nonce-based scripts, comprehensive rate limiting
- AI Processing: OpenAI API with batch processing for cost optimization
- Visualization: D3.js, React Leaflet, Recharts, custom chart components
- Monitoring: Real-time security monitoring, audit logging, threat detection
- Data Processing: Node-cron schedulers for automated batch processing and AI analysis
Getting Started
Prerequisites
- Node.js 18+ (LTS version recommended)
- pnpm (recommended package manager)
- PostgreSQL 13+ database
Installation
- Clone this repository:
git clone https://github.com/kjanat/livedash-node.git
cd livedash-node
- Install dependencies:
pnpm install
- Set up environment variables:
cp .env.example .env.local
# Edit .env.local with your configuration
- Set up the database:
pnpm prisma:generate
pnpm prisma:migrate
pnpm prisma:seed
- Start the development server:
pnpm dev
- Open your browser and navigate to http://localhost:3000
Environment Setup
Create a .env.local file in the root directory with the following variables:
# Database Configuration
DATABASE_URL="postgresql://user:password@localhost:5432/livedash"
DATABASE_URL_DIRECT="postgresql://user:password@localhost:5432/livedash"
# Authentication
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-nextauth-secret-key"
# AI Processing (optional - for AI features)
OPENAI_API_KEY="your-openai-api-key"
# Security Configuration
CSRF_SECRET="your-csrf-secret-key"
# Scheduler Configuration (optional)
SCHEDULER_ENABLED="true"
CSV_IMPORT_INTERVAL="*/10 * * * *"
IMPORT_PROCESSING_INTERVAL="*/5 * * * *"
SESSION_PROCESSING_INTERVAL="*/2 * * * *"
BATCH_PROCESSING_INTERVAL="*/1 * * * *"
# Batch Processing (optional)
BATCH_PROCESSING_ENABLED="true"
BATCH_CREATE_INTERVAL="*/5 * * * *"
BATCH_STATUS_CHECK_INTERVAL="*/2 * * * *"
BATCH_RESULT_PROCESSING_INTERVAL="*/1 * * * *"
Project Structure
app/: Next.js App Router pages and API routesapi/: API endpoints including admin, security, and tRPC routesdashboard/: Main analytics dashboard pagesplatform/: Platform administration interface
components/: Reusable React componentsadmin/: Administrative dashboard componentssecurity/: Security monitoring UI componentsforms/: CSRF-protected forms and form utilitiesproviders/: Context providers (CSRF, tRPC, themes)
lib/: Core utilities and business logic- Security modules (CSRF, CSP, rate limiting, audit logging)
- Processing pipelines (batch processing, AI analysis)
- Database utilities and authentication
server/: tRPC server configuration and routersprisma/: Database schema, migrations, and seed scriptstests/: Comprehensive test suite (unit, integration, E2E)docs/: Detailed project documentationscripts/: Migration and utility scripts
Available Scripts
Development
pnpm dev: Start development server with all featurespnpm dev:next-only: Start Next.js only (no background schedulers)pnpm build: Build the application for productionpnpm start: Run the production build
Code Quality
pnpm lint: Run ESLintpnpm lint:fix: Fix ESLint issues automaticallypnpm format: Format code with Prettierpnpm format:check: Check code formatting
Database
pnpm prisma:studio: Open Prisma Studio to view databasepnpm prisma:migrate: Run database migrationspnpm prisma:generate: Generate Prisma clientpnpm prisma:seed: Seed database with test data
Testing
pnpm test: Run all tests (Vitest + Playwright)pnpm test:vitest: Run unit and integration testspnpm test:coverage: Run tests with coverage reportspnpm test:security: Run security-specific testspnpm test:csp: Test CSP implementation
Security & Migration
pnpm migration:backup: Create database backuppnpm migration:health-check: Run system health checkspnpm test:security-headers: Test HTTP security headers
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/my-new-feature - Submit a pull request
License
This project is not licensed for commercial use without explicit permission. Free to use for educational or personal projects.
Acknowledgments
Description
LiveDash-Node: A real-time analytics dashboard for monitoring user sessions and interactions with interactive data visualizations and detailed metrics.
https://test123.kjanat.com
Readme
4.5 MiB
Languages
TypeScript
98.5%
CSS
0.8%
JavaScript
0.7%