Skip to content

2slow4u/research-hub

Repository files navigation

ResearchHub - AI-Powered Research Management Platform

ResearchHub is a comprehensive AI-powered research management platform that helps users automatically collect, monitor, and summarize research content from various sources. The application provides workspace-based organization, intelligent content aggregation, AI-powered summarization capabilities, comprehensive content management features, and Telegram bot integration for seamless content addition from mobile devices.

🌟 Key Features

Core Research Management

  • Smart Workspace Organization: Create purpose-driven workspaces with advanced relevance scoring (0-100 points)
  • Intelligent Content Monitoring: Automated collection from trusted sources with configurable frequency (hourly to weekly)
  • Advanced Archive System: Complete workspace lifecycle management with archive/restore functionality
  • Expandable Navigation: Smart sidebar with workspace hierarchy and alphabetical sorting
  • Rich Content Display: Full HTML rendering with image preservation and responsive design

AI-Powered Intelligence

  • Multi-Provider AI Support: Configure OpenAI, Anthropic, Google AI, Azure OpenAI, and Vertex AI
  • Cost Tracking & Analytics: Detailed usage logs and cost estimation across providers
  • Advanced Summarization: Generate comprehensive summaries with configurable focus areas
  • Relevance Scoring Algorithm: Sophisticated scoring considering keywords, purpose alignment, and content quality

Enhanced User Experience

  • Visual Annotation System: Direct text highlighting and commenting with color-coded indicators
  • Content Management: Advanced move/copy system for organizing content across workspaces
  • Mobile Integration: Telegram bot (@researchHubBot) for seamless content submission
  • Export Capabilities: Export workspace content in structured Markdown format
  • Dark Mode Support: Beautiful light and dark themes with system preference detection
  • Real-time Updates: Live content and summary updates with TanStack Query caching

Security & Authentication

  • Replit Auth Integration: Secure OpenID Connect authentication with session management
  • Role-Based Access Control: User and admin roles with protected routes
  • Secure API Key Management: Masked display and secure storage of AI provider credentials
  • PostgreSQL Session Storage: Robust session handling with configurable TTL

πŸš€ Technology Stack

Frontend Architecture

  • React 18 with TypeScript and Vite build system
  • Shadcn/UI components built on Radix UI primitives
  • TailwindCSS with custom design system and theme support
  • Wouter for lightweight client-side routing
  • React Hook Form with Zod validation for type-safe forms
  • TanStack Query for server state management and caching

Backend Architecture

  • Node.js with Express.js framework and TypeScript
  • Drizzle ORM for type-safe database operations
  • PostgreSQL with Neon serverless database integration
  • Service-based Architecture for business logic organization
  • Express Sessions with PostgreSQL storage using connect-pg-simple

External Integrations

  • Multi-AI Provider Support: OpenAI, Anthropic, Google AI, Azure OpenAI, Vertex AI
  • Telegram Bot API: node-telegram-bot-api for mobile content ingestion
  • Content Processing: Advanced HTML extraction with image preservation
  • Authentication: Replit Auth service with OpenID Connect

πŸ“‹ Getting Started

Prerequisites

  • Node.js 18+ environment
  • PostgreSQL database (Neon recommended)
  • AI provider API keys (configured securely in-app)
  • Telegram Bot Token (optional for mobile integration - store in environment variables, never in code)

Quick Start on Replit

  1. Configure Secrets: Go to Replit Secrets (lock icon) and add:
    • DATABASE_URL - Your PostgreSQL connection string
    • SESSION_SECRET - A secure random string
    • REPL_ID - Your Replit app ID
    • TELEGRAM_BOT_TOKEN - Your bot token (optional)
  2. Click the "Run" button to start the development server
  3. The application will be available at the provided Replit domain
  4. Use Replit Auth to sign in and create your first workspace
  5. Configure AI providers securely in Settings β†’ AI Models
  6. Optionally set up Telegram bot in Settings β†’ Telegram Bot

Local Development

# Clone the repository
git clone <your-repo-url>
cd research-hub

# Install dependencies
npm install

# Set up environment variables (NEVER commit .env to git)
cp .env.example .env
# Edit .env with your actual credentials:
# - DATABASE_URL, SESSION_SECRET, REPL_ID, TELEGRAM_BOT_TOKEN

# Push database schema
npm run db:push

# Start development server
npm run dev

πŸ”’ Security Note: Never commit your .env file or any secrets to version control. See SECURITY.md for complete security guidelines.

πŸ—οΈ Project Architecture

β”œβ”€β”€ client/                    # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components and routing
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx        # Main workspace overview
β”‚   β”‚   β”‚   β”œβ”€β”€ Archive.tsx          # Archived workspace management
β”‚   β”‚   β”‚   β”œβ”€β”€ Search.tsx           # Content discovery and monitoring
β”‚   β”‚   β”‚   β”œβ”€β”€ Summaries.tsx        # AI summary management
β”‚   β”‚   β”‚   β”œβ”€β”€ Settings.tsx         # Settings hub
β”‚   β”‚   β”‚   β”œβ”€β”€ AiModelConfig.tsx    # AI provider configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ TelegramIntegration.tsx # Mobile bot setup
β”‚   β”‚   β”‚   β”œβ”€β”€ ArticleReader.tsx    # Rich content viewer with annotations
β”‚   β”‚   β”‚   β”œβ”€β”€ WorkspaceEdit.tsx    # Workspace settings editor
β”‚   β”‚   β”‚   └── Workspaces.tsx       # Workspace overview and management
β”‚   β”‚   β”œβ”€β”€ hooks/           # Custom React hooks (useAuth, useToast)
β”‚   β”‚   β”œβ”€β”€ lib/             # Utilities (queryClient, authUtils)
β”‚   β”‚   └── contexts/        # React context providers
β”œβ”€β”€ server/                   # Express backend API
β”‚   β”œβ”€β”€ services/            # Business logic services
β”‚   β”‚   β”œβ”€β”€ aiService.ts            # Multi-provider AI integration
β”‚   β”‚   β”œβ”€β”€ summaryService.ts       # Summary generation logic
β”‚   β”‚   β”œβ”€β”€ telegramBotService.ts   # Telegram bot handlers
β”‚   β”‚   └── contentExtractor.ts     # Content processing and extraction
β”‚   β”œβ”€β”€ routes.ts           # Comprehensive API route definitions
β”‚   β”œβ”€β”€ storage.ts          # Database operations with Drizzle ORM
β”‚   β”œβ”€β”€ replitAuth.ts       # Authentication setup and middleware
β”‚   β”œβ”€β”€ db.ts               # Database connection and configuration
β”‚   └── index.ts            # Server entry point with Express setup
β”œβ”€β”€ shared/                  # Shared TypeScript types and schemas
β”‚   └── schema.ts           # Complete Drizzle database schema
β”œβ”€β”€ components.json         # Shadcn/UI configuration
β”œβ”€β”€ drizzle.config.ts       # Database migration configuration
└── replit.md              # Project documentation and architecture notes

πŸ—ƒοΈ Database Schema

Core Entities

  • Users: Authentication and user profile data
  • Workspaces: Research containers with purpose and keyword configuration
  • Content Items: Collected research with HTML content and relevance scores
  • Summaries: AI-generated summaries with version tracking
  • Sources: Trusted content sources for monitoring
  • Activities: Comprehensive user activity logging
  • Annotations: Visual highlighting and commenting system

Advanced Features

  • AI Model Configs: Multi-provider configuration with cost tracking
  • AI Usage Logs: Detailed usage analytics and cost monitoring
  • Telegram Connections: User account linking for mobile integration
  • Telegram Submissions: Content submitted via mobile bot
  • Sessions: PostgreSQL-backed session storage for security
  • Content Operations: Move/copy system for cross-workspace content management

πŸ”Œ Key API Endpoints

Authentication & Users

  • GET /api/auth/user - Current user profile
  • GET /api/login - Initiate Replit Auth flow
  • GET /api/logout - Secure logout with session cleanup

Workspace Management

  • GET /api/workspaces - List active workspaces
  • GET /api/workspaces/archived - List archived workspaces
  • POST /api/workspaces - Create new workspace
  • PATCH /api/workspaces/:id - Update workspace settings
  • POST /api/workspaces/:id/archive - Archive workspace (stops monitoring)
  • POST /api/workspaces/:id/restore - Restore archived workspace
  • POST /api/workspaces/:id/recalculate-scores - Recalculate content relevance

Content & Annotations

  • GET /api/workspaces/:id/content - Workspace content with pagination
  • GET /api/content/:id - Individual content item with annotations
  • POST /api/content/:id/annotations - Add text highlights and comments
  • DELETE /api/annotations/:id - Remove annotations
  • POST /api/content/:id/move - Move content between workspaces
  • POST /api/content/:id/copy - Copy content to other workspaces

AI & Summarization

  • GET /api/ai-model-configs - List configured AI providers
  • POST /api/ai-model-configs - Add new AI provider
  • POST /api/workspaces/:id/summaries - Generate AI summary
  • GET /api/workspaces/:id/summaries - List workspace summaries

Telegram Integration

  • GET /api/telegram/connections - User Telegram connections
  • POST /api/telegram/connections - Link Telegram account
  • GET /api/telegram/submissions - Mobile content submissions

🎯 Recent Major Updates

System Architecture Cleanup (Latest)

  • Complete removal of legacy sharing system components and database tables
  • Streamlined codebase with modern move/copy content management
  • Enhanced error handling and UI refresh system for immediate updates
  • Cleaned backend routes and storage methods for better maintainability
  • Comprehensive code audit ensuring no leftover functionality

Archive System Enhancement

  • Complete workspace lifecycle management with archive/restore functionality
  • Monitoring control: archive stops content monitoring, restore resumes it
  • User-friendly terminology: "restore" instead of "unarchive" throughout
  • Comprehensive activity logging for archive/restore actions
  • Enhanced navigation with dedicated Archive page

Security & Secrets Management

  • Comprehensive SECURITY.md with security guidelines and best practices
  • Enhanced .gitignore to prevent any secret files from being committed
  • Secure environment configuration with .env.example and .env.template
  • Updated setup instructions emphasizing Replit Secrets over file-based config
  • Added incident response procedures for compromised tokens

Visual Annotation System

  • Direct text highlighting with persistent visual indicators
  • Color-coded comment system for collaborative research
  • HTML content preservation with rich formatting
  • Responsive annotation interface with proper click handling

AI Provider Configuration

  • Multi-provider support: OpenAI, Anthropic, Google AI, Azure OpenAI, Vertex AI
  • Cost tracking and usage analytics across providers
  • Secure API key management with masked display
  • Default provider selection for seamless operations

Enhanced Content Management

  • Modern move/copy system replacing legacy sharing functionality
  • Immediate UI updates with forced cache refresh
  • Content operations with comprehensive activity logging
  • Streamlined workspace content organization

🚒 Deployment

The application is optimized for Replit's deployment system:

  1. Environment Setup: Configure DATABASE_URL and SESSION_SECRET
  2. AI Configuration: Set up providers through Settings β†’ AI Models
  3. Mobile Integration: Configure Telegram bot (optional)
  4. Database Migration: Automatic schema push with Drizzle
  5. Deployment: Use Replit's one-click deployment

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/enhancement)
  3. Follow TypeScript and React best practices
  4. Test thoroughly with the development server
  5. Update documentation in replit.md for architectural changes
  6. Submit a pull request with detailed description

πŸ“„ License

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

πŸ†˜ Support

For support, questions, or feature requests:

  • Open an issue on GitHub
  • Contact the development team
  • Check replit.md for architectural documentation

Built with modern web technologies, AI-powered intelligence, and comprehensive research management capabilities.

About

AI-powered research management platform with cross-workspace collaboration

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages