Skip to content

onixrose/HumanLenk

Repository files navigation

HumanLenk MVP - Premium PWA with GPT-Powered Chat

A production-ready Progressive Web App (PWA) with AI-powered chat functionality, intelligent file processing, and comprehensive admin management.

πŸš€ Features

Core Features

  • AI-Powered Chat: GPT integration for summarizing, editing, and clarifying content
  • File Processing: Upload and analyze PDF, DOCX, and TXT files
  • Progressive Web App: Installable on mobile and desktop with offline support
  • Real-time Messaging: Streaming chat responses with message history
  • User Authentication: Secure JWT-based authentication with role management

Admin Features

  • User Management: View, manage, and analyze user accounts
  • File Management: Monitor file uploads, processing status, and storage
  • Analytics Dashboard: Comprehensive statistics and insights
  • Survey Collection: Gather user feedback and ratings
  • Role-based Access: Admin-only features with proper security

Technical Features

  • Performance Optimized: Sub-2-second load times with caching
  • Mobile-First Design: Responsive design with premium UI/UX
  • Security: Comprehensive security headers and input validation
  • Scalable Architecture: AWS-ready with auto-scaling capabilities
  • CI/CD Pipeline: Automated testing, building, and deployment

πŸ—οΈ Architecture

Monorepo Structure

humanlenk/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ frontend/          # Next.js 14 PWA
β”‚   └── backend/           # Express.js API
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ types/             # Shared TypeScript types
β”‚   β”œβ”€β”€ api-client/        # React Query hooks
β”‚   β”œβ”€β”€ utils/             # Shared utilities
β”‚   └── ui/                # Reusable UI components
β”œβ”€β”€ .github/workflows/     # CI/CD pipelines
└── docs/                  # Documentation

Tech Stack

  • Frontend: Next.js 14, React 18, TypeScript, Tailwind CSS, shadcn/ui
  • Backend: Node.js, Express, TypeScript, Prisma, PostgreSQL
  • AI Integration: OpenAI GPT API
  • File Storage: AWS S3
  • Authentication: JWT with bcrypt
  • Database: PostgreSQL with Prisma ORM
  • Deployment: AWS (S3, CloudFront, Elastic Beanstalk)
  • CI/CD: GitHub Actions
  • Monitoring: Winston logging, Lighthouse CI

πŸ› οΈ Development Setup

Prerequisites

  • Node.js 18+
  • Yarn 1.22+
  • PostgreSQL 15+
  • AWS Account (for file storage)
  • OpenAI API Key

Installation

  1. Clone the repository

    git clone https://github.com/ronniexy/HumanLenk.git
    cd HumanLenk
  2. Install dependencies

    yarn install
  3. Set up environment variables

    # Copy environment templates
    cp apps/backend/env.example apps/backend/.env
    cp env.example .env
    
    # Edit the files with your configuration
  4. Set up the database

    # Generate Prisma client
    yarn db:generate
    
    # Run database migrations
    yarn db:migrate
    
    # (Optional) Open Prisma Studio
    yarn db:studio
  5. Start development servers

    # Start both frontend and backend
    yarn dev
    
    # Or start individually
    yarn start:frontend  # http://localhost:4000
    yarn start:backend   # http://localhost:5000

Environment Variables

Backend (.env)

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/humanlenk"

# Authentication
JWT_SECRET="your-super-secret-jwt-key-here"
JWT_EXPIRES_IN="7d"

# AWS Configuration
AWS_S3_BUCKET="humanlenk-files"
AWS_REGION="us-east-1"
AWS_ACCESS_KEY_ID="your-aws-access-key"
AWS_SECRET_ACCESS_KEY="your-aws-secret-key"

# OpenAI Configuration
OPENAI_API_KEY="your-openai-api-key"

# Server Configuration
PORT=5000
NODE_ENV="development"
LOG_LEVEL="info"

Frontend (.env.local)

NEXT_PUBLIC_API_URL="http://localhost:5000"

πŸ“± Usage

For Users

  1. Sign Up/Login: Create an account or sign in
  2. Chat: Start conversations with the AI assistant
  3. Upload Files: Drag and drop PDF, DOCX, or TXT files
  4. Get AI Help: Ask questions about uploaded files
  5. Provide Feedback: Rate your experience and leave feedback

For Admins

  1. Access Admin Panel: Click "Admin" button in header (admin users only)
  2. Monitor Users: View user statistics and manage accounts
  3. Track Files: Monitor file uploads and processing status
  4. Analyze Feedback: Review user surveys and ratings
  5. View Analytics: Access comprehensive dashboard metrics

πŸš€ Deployment

AWS Deployment

Frontend (S3 + CloudFront)

# Build the frontend
cd apps/frontend
yarn build

# Deploy to S3
aws s3 sync out/ s3://your-bucket-name --delete

# Invalidate CloudFront
aws cloudfront create-invalidation --distribution-id YOUR_DISTRIBUTION_ID --paths "/*"

Backend (Elastic Beanstalk)

# Build the backend
cd apps/backend
yarn build

# Create deployment package
zip -r ../backend-deployment.zip . -x "node_modules/*" "src/*" "*.ts"

# Deploy to Elastic Beanstalk
eb deploy

Docker Deployment

# Build and run with Docker Compose
docker-compose up -d

# Or build individual services
docker build -f apps/frontend/Dockerfile -t humanlenk-frontend .
docker build -f apps/backend/Dockerfile -t humanlenk-backend .

πŸ§ͺ Testing

Run Tests

# Run all tests
yarn test

# Run frontend tests
cd apps/frontend && yarn test

# Run backend tests
cd apps/backend && yarn test

Performance Testing

# Run Lighthouse CI
yarn analyze

# Bundle analysis
cd apps/frontend && yarn analyze

πŸ“Š Monitoring & Analytics

Performance Monitoring

  • Lighthouse CI: Automated performance testing
  • Bundle Analysis: Webpack bundle size optimization
  • Core Web Vitals: LCP, FID, CLS monitoring

Application Monitoring

  • Winston Logging: Structured logging with different levels
  • Error Tracking: Comprehensive error handling and reporting
  • Database Monitoring: Query performance and connection pooling

User Analytics

  • Admin Dashboard: Real-time user and file statistics
  • Survey Collection: User feedback and satisfaction tracking
  • Usage Metrics: File uploads, messages, and engagement

πŸ”§ Scripts

Development

yarn dev              # Start development servers
yarn build            # Build all packages
yarn lint             # Lint all code
yarn type-check       # TypeScript type checking
yarn format           # Format code with Prettier

Database

yarn db:generate      # Generate Prisma client
yarn db:migrate       # Run database migrations
yarn db:push          # Push schema changes
yarn db:studio        # Open Prisma Studio

Production

yarn start:frontend   # Start production frontend
yarn start:backend    # Start production backend
yarn audit            # Security audit

πŸ›‘οΈ Security

Implemented Security Measures

  • JWT Authentication: Secure token-based authentication
  • Input Validation: Zod schemas for all API inputs
  • Rate Limiting: Prevent abuse and DDoS attacks
  • CORS Protection: Configured for production domains
  • Security Headers: Helmet.js for security headers
  • File Validation: Strict file type and size limits
  • SQL Injection Prevention: Prisma ORM with parameterized queries
  • XSS Protection: Content Security Policy headers

Security Best Practices

  • Environment variables for sensitive data
  • Regular dependency updates
  • Security scanning in CI/CD
  • Role-based access control
  • Audit logging for admin actions

🀝 Contributing

Development Workflow

  1. Create a feature branch: git checkout -b feature/your-feature
  2. Make your changes and commit: git commit -m "feat: your feature"
  3. Push to GitHub: git push origin feature/your-feature
  4. Create a Pull Request

Code Standards

  • TypeScript for type safety
  • ESLint for code quality
  • Prettier for code formatting
  • Conventional commits for changelog generation
  • Test coverage for new features

πŸ“„ License

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

πŸ†˜ Support

Getting Help

  • Documentation: Check this README and inline code comments
  • Issues: Create GitHub issues for bugs or feature requests
  • Discussions: Use GitHub Discussions for questions

Common Issues

Database Connection Issues

# Check PostgreSQL is running
pg_isready -h localhost -p 5432

# Reset database
yarn db:push --force-reset

Build Issues

# Clear caches
yarn clean
rm -rf node_modules
yarn install

Environment Issues

# Verify environment variables
yarn db:generate  # Should work without errors

🎯 Roadmap

Phase 1 (Current MVP)

  • βœ… Core chat functionality
  • βœ… File upload and processing
  • βœ… User authentication
  • βœ… Admin panel
  • βœ… PWA features

Phase 2 (Future Enhancements)

  • Advanced AI models integration
  • Real-time collaboration features
  • Advanced file processing (OCR, image analysis)
  • Mobile app (React Native)
  • Enterprise features (SSO, advanced admin tools)

Phase 3 (Scale)

  • Multi-tenant architecture
  • Advanced analytics and reporting
  • API marketplace
  • Third-party integrations
  • White-label solutions

Built with ❀️ for the HumanLenk MVP project

For more information, visit our GitHub repository or contact the development team.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published