File size: 7,841 Bytes
e09e580
25f22bf
e09e580
be73adb
25f22bf
e09e580
 
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
---
title: Lin - LinkedIn Community Manager
sdk: docker
app_file: start_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
- `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

#### 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