| --- |
| title: Lin - LinkedIn Community Manager |
| sdk: docker |
| app_file: backend/app.py |
| license: mit |
| --- |
| |
| # Lin - Community Manager Assistant for LinkedIn |
|
|
| A comprehensive community management tool that helps you automate and streamline your LinkedIn activities. |
|
|
| ## π Quick Start |
|
|
| ### Prerequisites |
|
|
| - Node.js (v16 or higher) |
| - Python (v3.8 or higher) |
| - npm (v8 or higher) |
|
|
| ### Installation |
|
|
| **Option 1: Using the root package.json (Recommended)** |
|
|
| ```bash |
| # Clone the repository |
| git clone <repository-url> |
| cd Lin |
| |
| # Install all dependencies |
| npm install |
| |
| # Setup the project |
| npm run setup |
| |
| # Start both frontend and backend |
| npm start |
| ``` |
|
|
| **Option 2: Manual installation** |
|
|
| ```bash |
| # Install frontend dependencies |
| cd frontend |
| npm install |
| |
| # Install backend dependencies |
| cd ../backend |
| pip install -r requirements.txt |
| |
| # Return to root directory |
| cd .. |
| ``` |
|
|
| ## π Project Structure |
|
|
| ``` |
| Lin/ |
| βββ package.json # Root package.json with combined scripts |
| βββ frontend/ # React frontend application |
| β βββ package.json # Frontend-specific dependencies |
| β βββ src/ # React source code |
| β βββ public/ # Static assets |
| β βββ build/ # Build output |
| βββ backend/ # Flask backend API |
| β βββ app.py # Main application file |
| β βββ requirements.txt # Python dependencies |
| β βββ api/ # API endpoints |
| β βββ models/ # Data models |
| β βββ services/ # Business logic |
| β βββ utils/ # Utility functions |
| βββ README.md # This file |
| ``` |
|
|
| ## π οΈ Development |
|
|
| ### Available Scripts |
|
|
| From the project root directory, you can use the following commands: |
|
|
| #### Installation |
| - `npm install` - Install root dependencies |
| - `npm run install:frontend` - Install frontend dependencies |
| - `npm run install:backend` - Install backend dependencies |
| - `npm run install:all` - Install all dependencies |
| - `npm run install:all:win` - Install all dependencies (Windows-specific) |
|
|
| #### Development Servers |
| - `npm run dev:frontend` - Start frontend development server |
| - `npm run dev:backend` - Start backend development server (Flask development server) |
| - `npm run dev:all` - Start both servers concurrently |
| - `npm run start` - Alias for `npm run dev:all` |
| - `npm run start:frontend` - Start frontend only |
| - `npm run start:backend` - Start backend only (Flask development server) |
|
|
| #### Production Deployment |
| - `python start_gunicorn.py` - Start backend with Gunicorn (for local testing) |
| - Use Docker to run with Gunicorn as configured in the Dockerfile |
|
|
| #### Build & Test |
| - `npm run build` - Build frontend for production |
| - `npm run build:prod` - Build frontend for production |
| - `npm run preview` - Preview production build |
| - `npm run test` - Run frontend tests |
| - `npm run test:backend` - Run backend tests |
| - `npm run lint` - Run ESLint |
| - `npm run lint:fix` - Fix ESLint issues |
|
|
| #### Setup & Maintenance |
| - `npm run setup` - Full setup (install + build) |
| - `npm run setup:win` - Full setup (Windows-specific) |
| - `npm run clean` - Clean build artifacts |
| - `npm run reset` - Reset project (clean + install) |
|
|
| ### Directory Navigation |
|
|
| **Important:** Most npm commands should be run from the project root directory where the main `package.json` is located. |
|
|
| #### Command Prompt (Windows) |
| ```cmd |
| # Navigate to project root (if not already there) |
| cd C:\Users\YourUser\Documents\Project\Lin_re\Lin |
| |
| # Install dependencies |
| npm install |
| |
| # Start development servers |
| npm start |
| |
| # Or start individually |
| npm run dev:frontend |
| npm run dev:backend |
| ``` |
|
|
| #### PowerShell (Windows) |
| ```powershell |
| # Navigate to project root (if not already there) |
| cd C:\Users\YourUser\Documents\Project\Lin_re\Lin |
| |
| # Install dependencies |
| npm install |
| |
| # Start development servers |
| npm start |
| |
| # Or start individually |
| npm run dev:frontend |
| npm run dev:backend |
| ``` |
|
|
| #### Linux/macOS |
| ```bash |
| # Navigate to project root (if not already there) |
| cd /path/to/your/project/Lin |
| |
| # Install dependencies |
| npm install |
| |
| # Start development servers |
| npm start |
| |
| # Or start individually |
| npm run dev:frontend |
| npm run dev:backend |
| ``` |
|
|
| ## π§ Environment Setup |
|
|
| ### Frontend Environment |
|
|
| ```bash |
| # Copy environment file |
| cd frontend |
| cp .env.example .env.local |
| |
| # Edit environment variables |
| # Open .env.local and add your required values |
| ``` |
|
|
| ### Backend Environment |
|
|
| ```bash |
| # Copy environment file |
| cd backend |
| cp .env.example .env |
| |
| # Edit environment variables |
| # Open .env and add your required values |
| ``` |
|
|
| ### Required Environment Variables |
|
|
| **Frontend (.env.local)** |
| - `REACT_APP_API_URL` - Backend API URL (default: http://localhost:5000) |
|
|
| **Backend (.env)** |
| - `SUPABASE_URL` - Your Supabase project URL |
| - `SUPABASE_KEY` - Your Supabase API key |
| - `CLIENT_ID` - LinkedIn OAuth client ID |
| - `CLIENT_SECRET` - LinkedIn OAuth client secret |
| - `REDIRECT_URL` - LinkedIn OAuth redirect URL |
| - `HUGGING_KEY` - Hugging Face API key |
| - `JWT_SECRET_KEY` - Secret key for JWT token generation |
| - `SECRET_KEY` - Flask secret key |
| - `DEBUG` - Debug mode (True/False) |
| - `SCHEDULER_ENABLED` - Enable/disable task scheduler (True/False) |
| - `PORT` - Port to run the application on (default: 5000) |
|
|
| ## π Development URLs |
|
|
| - **Frontend**: http://localhost:3000 |
| - **Backend API**: http://localhost:5000 |
|
|
| ## π Troubleshooting |
|
|
| ### Common Issues |
|
|
| #### 1. ENOENT Error: no such file or directory |
| **Problem**: Running npm commands from the wrong directory |
| **Solution**: Always run npm commands from the project root directory where `package.json` is located |
|
|
| ```bash |
| # Check if you're in the right directory |
| ls package.json |
| |
| # If not, navigate to the root directory |
| cd /path/to/project/Lin |
| ``` |
|
|
| #### 2. Port Already in Use |
| **Problem**: Port 3000 or 5000 is already in use |
| **Solution**: Change ports or stop conflicting services |
|
|
| **Command Prompt:** |
| ```cmd |
| # Check what's using port 3000 |
| netstat -ano | findstr :3000 |
| |
| # Check what's using port 5000 |
| netstat -ano | findstr :5000 |
| ``` |
|
|
| **PowerShell:** |
| ```powershell |
| # Check what's using port 3000 |
| netstat -ano | Select-String ":3000" |
| |
| # Check what's using port 5000 |
| netstat -ano | Select-String ":5000" |
| ``` |
|
|
| #### 3. Python/Node.js Not Recognized |
| **Problem**: Python or Node.js commands not found |
| **Solution**: Ensure Python and Node.js are added to your system PATH |
|
|
| **Windows:** |
| 1. Open System Properties > Environment Variables |
| 2. Add Python and Node.js installation directories to PATH |
| 3. Restart your terminal |
|
|
| #### 4. Permission Issues |
| **Problem**: Permission denied errors |
| **Solution**: Run terminal as Administrator or check file permissions |
|
|
| ### Windows-Specific Issues |
|
|
| #### File Copy Commands |
| **Command Prompt:** |
| ```cmd |
| # Copy frontend environment file |
| copy frontend\.env.example frontend\.env.local |
| |
| # Copy backend environment file |
| copy backend\.env.example backend\.env |
| ``` |
|
|
| **PowerShell:** |
| ```powershell |
| # Copy frontend environment file |
| Copy-Item frontend\.env.example -Destination frontend\.env.local |
| |
| # Copy backend environment file |
| Copy-Item backend\.env.example -Destination backend\.env |
| ``` |
|
|
| #### Python Installation Issues |
| ```cmd |
| # If pip fails, try using python -m pip |
| cd backend |
| python -m pip install -r requirements.txt |
| ``` |
|
|
| ## π Additional Resources |
|
|
| - [Windows Compatibility Guide](./test_windows_compatibility.md) |
| - [Backend API Documentation](./backend/README.md) |
| - [Frontend Development Guide](./frontend/README.md) |
|
|
| ## π€ Contributing |
|
|
| 1. Fork the repository |
| 2. Create a feature branch (`git checkout -b feature/amazing-feature`) |
| 3. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 4. Push to the branch (`git push origin feature/amazing-feature`) |
| 5. Open a Pull Request |
|
|
| ## π License |
|
|
| This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
|
|
| ## π Acknowledgments |
|
|
| - Built with React, Flask, and Tailwind CSS |
| - Powered by Supabase for authentication and database |
| - LinkedIn API integration for social media management |
| - Hugging Face for AI-powered content generation |