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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
# Windows Compatibility Guide for Lin

This guide provides comprehensive Windows-specific instructions and troubleshooting tips for the Lin application. The goal is to prevent ENOENT errors and ensure smooth development on Windows systems.

## 🎯 Objectives

- Fix npm navigation issues that cause ENOENT errors
- Provide clear directory navigation instructions
- Ensure compatibility with both Command Prompt and PowerShell
- Create a comprehensive setup and testing workflow

## 🚨 Common Issues

### 1. ENOENT Error: no such file or directory

**Problem**: Running npm commands from the wrong directory where no package.json exists
**Solution**: Always run npm commands from the project root directory

### 2. Path Separation Issues

**Problem**: Windows uses backslashes (\) while Unix systems use forward slashes (/)
**Solution**: Use forward slashes in all commands or use proper Windows path handling

### 3. Command Syntax Differences

**Problem**: Windows commands differ from Linux/macOS commands
**Solution**: Use Windows-specific command syntax for file operations

## πŸ“ Project Structure Navigation

### Correct Directory Structure

```
C:\Users\YourUser\Documents\Project\Lin_re\Lin\
β”œβ”€β”€ package.json              # Root package.json (NEW)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ package.json          # Frontend package.json
β”‚   β”œβ”€β”€ src/
β”‚   └── public/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app.py                # Main application
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   └── api/
└── README.md                 # This project's README
```

### Navigation Best Practices

**Always run npm commands from the root directory** where the main `package.json` is located.

## πŸ› οΈ Installation and Setup

### Prerequisites Verification

#### Command Prompt
```cmd
@echo off
echo === Checking Prerequisites ===
echo.

echo Checking Node.js...
node --version
if %errorlevel% neq 0 (
    echo ❌ Node.js not found. Please install Node.js from https://nodejs.org
    pause
    exit /b 1
)

echo Checking npm...
npm --version
if %errorlevel% neq 0 (
    echo ❌ npm not found. Please install Node.js from https://nodejs.org
    pause
    exit /b 1
)

echo Checking Python...
python --version
if %errorlevel% neq 0 (
    echo ❌ Python not found. Please install Python from https://python.org
    pause
    exit /b 1
)

echo Checking pip...
pip --version
if %errorlevel% neq 0 (
    echo ❌ pip not found. Please install Python from https://python.org
    pause
    exit /b 1
)

echo.
echo βœ… All prerequisites are installed!
echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Checking Prerequisites ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking Node.js..." -ForegroundColor Yellow
try {
    $nodeVersion = node --version
    Write-Host "βœ… Node.js version: $nodeVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Node.js not found. Please install Node.js from https://nodejs.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking npm..." -ForegroundColor Yellow
try {
    $npmVersion = npm --version
    Write-Host "βœ… npm version: $npmVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ npm not found. Please install Node.js from https://nodejs.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking Python..." -ForegroundColor Yellow
try {
    $pythonVersion = python --version
    Write-Host "βœ… Python version: $pythonVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Python not found. Please install Python from https://python.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking pip..." -ForegroundColor Yellow
try {
    $pipVersion = pip --version
    Write-Host "βœ… pip version: $pipVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ pip not found. Please install Python from https://python.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "βœ… All prerequisites are installed!" -ForegroundColor Green
Write-Host ""
Read-Host "Press Enter to continue"
```

### Environment Setup

#### Command Prompt
```cmd
@echo off
echo === Setting Up Environment Files ===
echo.

echo Setting up frontend environment...
if not exist "frontend\.env.local" (
    if exist "frontend\.env.example" (
        copy "frontend\.env.example" "frontend\.env.local"
        echo βœ… Frontend .env.local created successfully
    ) else (
        echo ❌ Frontend .env.example not found
    )
) else (
    echo ℹ️  Frontend .env.local already exists
)

echo.
echo Setting up backend environment...
if not exist "backend\.env" (
    if exist "backend\.env.example" (
        copy "backend\.env.example" "backend\.env"
        echo βœ… Backend .env created successfully
    ) else (
        echo ❌ Backend .env.example not found
    )
) else (
    echo ℹ️  Backend .env already exists
)

echo.
echo Environment setup complete!
echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Setting Up Environment Files ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Setting up frontend environment..." -ForegroundColor Yellow
if (-not (Test-Path "frontend\.env.local")) {
    if (Test-Path "frontend\.env.example") {
        Copy-Item "frontend\.env.example" -Destination "frontend\.env.local"
        Write-Host "βœ… Frontend .env.local created successfully" -ForegroundColor Green
    } else {
        Write-Host "❌ Frontend .env.example not found" -ForegroundColor Red
    }
} else {
    Write-Host "ℹ️  Frontend .env.local already exists" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "Setting up backend environment..." -ForegroundColor Yellow
if (-not (Test-Path "backend\.env")) {
    if (Test-Path "backend\.env.example") {
        Copy-Item "backend\.env.example" -Destination "backend\.env"
        Write-Host "βœ… Backend .env created successfully" -ForegroundColor Green
    } else {
        Write-Host "❌ Backend .env.example not found" -ForegroundColor Red
    }
} else {
    Write-Host "ℹ️  Backend .env already exists" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "Environment setup complete!" -ForegroundColor Green
Write-Host ""
Read-Host "Press Enter to continue"
```

### Dependency Installation

#### Command Prompt
```cmd
@echo off
echo === Installing Dependencies ===
echo.

echo Installing root dependencies...
npm install
if %errorlevel% neq 0 (
    echo ❌ Failed to install root dependencies
    pause
    exit /b 1
)
echo βœ… Root dependencies installed successfully

echo.
echo Installing frontend dependencies...
cd frontend
npm install
if %errorlevel% neq 0 (
    echo ❌ Failed to install frontend dependencies
    cd ..
    pause
    exit /b 1
)
echo βœ… Frontend dependencies installed successfully

echo.
echo Installing backend dependencies...
cd ..\backend
pip install -r requirements.txt
if %errorlevel% neq 0 (
    echo ❌ Failed to install backend dependencies
    cd ..
    pause
    exit /b 1
)
echo βœ… Backend dependencies installed successfully

echo.
echo Returning to root directory...
cd ..

echo.
echo βœ… All dependencies installed successfully!
echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Installing Dependencies ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Installing root dependencies..." -ForegroundColor Yellow
try {
    npm install
    Write-Host "βœ… Root dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install root dependencies" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Installing frontend dependencies..." -ForegroundColor Yellow
try {
    Set-Location frontend
    npm install
    Write-Host "βœ… Frontend dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install frontend dependencies" -ForegroundColor Red
    Set-Location ..
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Installing backend dependencies..." -ForegroundColor Yellow
try {
    Set-Location backend
    pip install -r requirements.txt
    Write-Host "βœ… Backend dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install backend dependencies" -ForegroundColor Red
    Set-Location ..
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Returning to root directory..." -ForegroundColor Yellow
Set-Location ..

Write-Host ""
Write-Host "βœ… All dependencies installed successfully!" -ForegroundColor Green
Write-Host ""
Read-Host "Press Enter to continue"
```

## πŸš€ Development Workflow

### Starting Development Servers

#### Command Prompt
```cmd
@echo off
echo === Starting Development Servers ===
echo.

echo Checking if we're in the correct directory...
if not exist "package.json" (
    echo ❌ Error: package.json not found
    echo Please navigate to the project root directory
    echo Current directory: %CD%
    pause
    exit /b 1
)

echo βœ… Found package.json in current directory
echo.

echo Starting development servers...
echo Frontend will be available at: http://localhost:3000
echo Backend will be available at: http://localhost:5000
echo.
echo Press Ctrl+C to stop the servers
echo.

npm run dev:all
```

#### PowerShell
```powershell
Write-Host "=== Starting Development Servers ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking if we're in the correct directory..." -ForegroundColor Yellow
if (-not (Test-Path "package.json")) {
    Write-Host "❌ Error: package.json not found" -ForegroundColor Red
    Write-Host "Please navigate to the project root directory" -ForegroundColor Yellow
    Write-Host "Current directory: $(Get-Location)" -ForegroundColor Yellow
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "βœ… Found package.json in current directory" -ForegroundColor Green
Write-Host ""

Write-Host "Starting development servers..." -ForegroundColor Yellow
Write-Host "Frontend will be available at: http://localhost:3000" -ForegroundColor Green
Write-Host "Backend will be available at: http://localhost:5000" -ForegroundColor Green
Write-Host ""
Write-Host "Press Ctrl+C to stop the servers" -ForegroundColor Yellow
Write-Host ""

npm run dev:all
```

### Building for Production

#### Command Prompt
```cmd
@echo off
echo === Building for Production ===
echo.

echo Checking if we're in the correct directory...
if not exist "package.json" (
    echo ❌ Error: package.json not found
    echo Please navigate to the project root directory
    pause
    exit /b 1
)

echo Building frontend for production...
npm run build
if %errorlevel% neq 0 (
    echo ❌ Build failed
    pause
    exit /b 1
)

echo βœ… Build completed successfully!
echo.
echo Frontend build files are in: frontend\build\
echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Building for Production ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking if we're in the correct directory..." -ForegroundColor Yellow
if (-not (Test-Path "package.json")) {
    Write-Host "❌ Error: package.json not found" -ForegroundColor Red
    Write-Host "Please navigate to the project root directory" -ForegroundColor Yellow
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Building frontend for production..." -ForegroundColor Yellow
try {
    npm run build
    Write-Host "βœ… Build completed successfully!" -ForegroundColor Green
    Write-Host ""
    Write-Host "Frontend build files are in: frontend\build\" -ForegroundColor Green
} catch {
    Write-Host "❌ Build failed" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Read-Host "Press Enter to continue"
```

## πŸ” Troubleshooting

### Directory Navigation Issues

#### Problem Detection Script

**Command Prompt:**
```cmd
@echo off
echo === Directory Navigation Check ===
echo.

echo Current directory: %CD%
echo.

echo Checking for package.json...
if exist "package.json" (
    echo βœ… package.json found in current directory
) else (
    echo ❌ package.json NOT found in current directory
    echo This is likely causing ENOENT errors
    echo.
    echo Please navigate to the project root directory:
    echo C:\Users\YourUser\Documents\Project\Lin_re\Lin
    echo.
    echo To navigate to the root directory, run:
    echo cd C:\Users\YourUser\Documents\Project\Lin_re\Lin
)

echo.
echo Checking directory structure...
if exist "frontend" (
    echo βœ… frontend directory found
) else (
    echo ❌ frontend directory NOT found
)

if exist "backend" (
    echo βœ… backend directory found
) else (
    echo ❌ backend directory NOT found
)

echo.
pause
```

**PowerShell:**
```powershell
Write-Host "=== Directory Navigation Check ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Current directory: $(Get-Location)" -ForegroundColor Yellow
Write-Host ""

Write-Host "Checking for package.json..." -ForegroundColor Yellow
if (Test-Path "package.json") {
    Write-Host "βœ… package.json found in current directory" -ForegroundColor Green
} else {
    Write-Host "❌ package.json NOT found in current directory" -ForegroundColor Red
    Write-Host "This is likely causing ENOENT errors" -ForegroundColor Yellow
    Write-Host ""
    Write-Host "Please navigate to the project root directory:" -ForegroundColor Yellow
    Write-Host "C:\Users\YourUser\Documents\Project\Lin_re\Lin" -ForegroundColor Yellow
    Write-Host ""
    Write-Host "To navigate to the root directory, run:" -ForegroundColor Yellow
    Write-Host "cd C:\Users\YourUser\Documents\Project\Lin_re\Lin" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "Checking directory structure..." -ForegroundColor Yellow
if (Test-Path "frontend") {
    Write-Host "βœ… frontend directory found" -ForegroundColor Green
} else {
    Write-Host "❌ frontend directory NOT found" -ForegroundColor Red
}

if (Test-Path "backend") {
    Write-Host "βœ… backend directory found" -ForegroundColor Green
} else {
    Write-Host "❌ backend directory NOT found" -ForegroundColor Red
}

Write-Host ""
Read-Host "Press Enter to continue"
```

### Port Conflict Resolution

#### Command Prompt
```cmd
@echo off
echo === Port Conflict Resolution ===
echo.

echo Checking port 3000 (Frontend)...
netstat -ano | findstr :3000
if %errorlevel% equ 0 (
    echo ⚠️  Port 3000 is already in use
    echo To resolve this, find the process ID above and run:
    echo taskkill /F /PID [PROCESS_ID]
) else (
    echo βœ… Port 3000 is available
)

echo.
echo Checking port 5000 (Backend)...
netstat -ano | findstr :5000
if %errorlevel% equ 0 (
    echo ⚠️  Port 5000 is already in use
    echo To resolve this, find the process ID above and run:
    echo taskkill /F /PID [PROCESS_ID]
) else (
    echo βœ… Port 5000 is available
)

echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Port Conflict Resolution ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking port 3000 (Frontend)..." -ForegroundColor Yellow
$port3000 = netstat -ano | Select-String ":3000"
if ($port3000) {
    Write-Host "⚠️  Port 3000 is already in use" -ForegroundColor Yellow
    Write-Host "To resolve this, find the process ID above and run:" -ForegroundColor Yellow
    Write-Host "Stop-Process -Id [PROCESS_ID] -Force" -ForegroundColor Yellow
} else {
    Write-Host "βœ… Port 3000 is available" -ForegroundColor Green
}

Write-Host ""
Write-Host "Checking port 5000 (Backend)..." -ForegroundColor Yellow
$port5000 = netstat -ano | Select-String ":5000"
if ($port5000) {
    Write-Host "⚠️  Port 5000 is already in use" -ForegroundColor Yellow
    Write-Host "To resolve this, find the process ID above and run:" -ForegroundColor Yellow
    Write-Host "Stop-Process -Id [PROCESS_ID] -Force" -ForegroundColor Yellow
} else {
    Write-Host "βœ… Port 5000 is available" -ForegroundColor Green
}

Write-Host ""
Read-Host "Press Enter to continue"
```

### Environment Variable Setup

#### Command Prompt
```cmd
@echo off
echo === Environment Variable Setup ===
echo.

echo Setting up frontend environment variables...
set REACT_APP_API_URL=http://localhost:5000
set REACT_APP_ENVIRONMENT=development
echo βœ… Frontend environment variables set

echo.
echo Setting up backend environment variables...
set SUPABASE_URL=your_supabase_url_here
set SUPABASE_KEY=your_supabase_key_here
set CLIENT_ID=your_linkedin_client_id_here
set CLIENT_SECRET=your_linkedin_client_secret_here
set REDIRECT_URL=http://localhost:5000/api/auth/callback
set HUGGING_KEY=your_huggingface_key_here
set JWT_SECRET_KEY=your_jwt_secret_here
set SECRET_KEY=your_flask_secret_here
set DEBUG=True
set SCHEDULER_ENABLED=True
set PORT=5000
echo βœ… Backend environment variables set

echo.
echo Note: Replace placeholder values with your actual credentials
echo.
pause
```

#### PowerShell
```powershell
Write-Host "=== Environment Variable Setup ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Setting up frontend environment variables..." -ForegroundColor Yellow
$env:REACT_APP_API_URL = "http://localhost:5000"
$env:REACT_APP_ENVIRONMENT = "development"
Write-Host "βœ… Frontend environment variables set" -ForegroundColor Green

Write-Host ""
Write-Host "Setting up backend environment variables..." -ForegroundColor Yellow
$env:SUPABASE_URL = "your_supabase_url_here"
$env:SUPABASE_KEY = "your_supabase_key_here"
$env:CLIENT_ID = "your_linkedin_client_id_here"
$env:CLIENT_SECRET = "your_linkedin_client_secret_here"
$env:REDIRECT_URL = "http://localhost:5000/api/auth/callback"
$env:HUGGING_KEY = "your_huggingface_key_here"
$env:JWT_SECRET_KEY = "your_jwt_secret_here"
$env:SECRET_KEY = "your_flask_secret_here"
$env:DEBUG = "True"
$env:SCHEDULER_ENABLED = "True"
$env:PORT = "5000"
Write-Host "βœ… Backend environment variables set" -ForegroundColor Green

Write-Host ""
Write-Host "Note: Replace placeholder values with your actual credentials" -ForegroundColor Yellow
Write-Host ""
Read-Host "Press Enter to continue"
```

## πŸ“‹ Complete Setup Script

### Automated Setup Script

**Command Prompt (setup.bat):**
```cmd
@echo off
echo ========================================
echo           Lin Setup for Windows
echo ========================================
echo.

REM Check if we're in the correct directory
if not exist "package.json" (
    echo ❌ Error: package.json not found
    echo Please run this script from the project root directory
    echo Current directory: %CD%
    echo.
    echo Expected directory: C:\Users\YourUser\Documents\Project\Lin_re\Lin
    pause
    exit /b 1
)

echo βœ… Found package.json in current directory
echo.

REM Check prerequisites
echo === Checking Prerequisites ===
echo.

echo Checking Node.js...
node --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Node.js not found. Please install Node.js from https://nodejs.org
    pause
    exit /b 1
)
echo βœ… Node.js installed

echo Checking npm...
npm --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ npm not found. Please install Node.js from https://nodejs.org
    pause
    exit /b 1
)
echo βœ… npm installed

echo Checking Python...
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Python not found. Please install Python from https://python.org
    pause
    exit /b 1
)
echo βœ… Python installed

echo Checking pip...
pip --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ pip not found. Please install Python from https://python.org
    pause
    exit /b 1
)
echo βœ… pip installed

echo.
echo βœ… All prerequisites are installed!
echo.

REM Setup environment files
echo === Setting Up Environment Files ===
echo.

echo Setting up frontend environment...
if not exist "frontend\.env.local" (
    if exist "frontend\.env.example" (
        copy "frontend\.env.example" "frontend\.env.local" >nul
        echo βœ… Frontend .env.local created successfully
    ) else (
        echo ❌ Frontend .env.example not found
    )
) else (
    echo ℹ️  Frontend .env.local already exists
)

echo.
echo Setting up backend environment...
if not exist "backend\.env" (
    if exist "backend\.env.example" (
        copy "backend\.env.example" "backend\.env" >nul
        echo βœ… Backend .env created successfully
    ) else (
        echo ❌ Backend .env.example not found
    )
) else (
    echo ℹ️  Backend .env already exists
)

echo.
echo Environment setup complete!
echo.

REM Install dependencies
echo === Installing Dependencies ===
echo.

echo Installing root dependencies...
npm install
if %errorlevel% neq 0 (
    echo ❌ Failed to install root dependencies
    pause
    exit /b 1
)
echo βœ… Root dependencies installed successfully

echo.
echo Installing frontend dependencies...
cd frontend
npm install
if %errorlevel% neq 0 (
    echo ❌ Failed to install frontend dependencies
    cd ..
    pause
    exit /b 1
)
echo βœ… Frontend dependencies installed successfully

echo.
echo Installing backend dependencies...
cd ..\backend
pip install -r requirements.txt
if %errorlevel% neq 0 (
    echo ❌ Failed to install backend dependencies
    cd ..
    pause
    exit /b 1
)
echo βœ… Backend dependencies installed successfully

echo.
echo Returning to root directory...
cd ..

echo.
echo βœ… All dependencies installed successfully!
echo.

REM Build the project
echo === Building Project ===
echo.

echo Building frontend for production...
npm run build
if %errorlevel% neq 0 (
    echo ❌ Build failed
    pause
    exit /b 1
)

echo βœ… Build completed successfully!
echo.

REM Final check
echo === Final Verification ===
echo.

echo Checking if everything is working...
echo.

echo Testing npm scripts...
npm run lint >nul 2>&1
if %errorlevel% equ 0 (
    echo βœ… Lint test passed
) else (
    echo ⚠️  Lint test failed (this is normal for initial setup)
)

echo.
echo βœ… Setup completed successfully!
echo.
echo Next steps:
echo 1. Edit frontend\.env.local with your configuration
echo 2. Edit backend\.env with your configuration
echo 3. Run 'npm start' to start development servers
echo 4. Open http://localhost:3000 in your browser
echo.
echo ========================================
echo Setup Complete! πŸŽ‰
echo ========================================
pause
```

**PowerShell (setup.ps1):**
```powershell
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "           Lin Setup for Windows" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

# Check if we're in the correct directory
if (-not (Test-Path "package.json")) {
    Write-Host "❌ Error: package.json not found" -ForegroundColor Red
    Write-Host "Please run this script from the project root directory" -ForegroundColor Yellow
    Write-Host "Current directory: $(Get-Location)" -ForegroundColor Yellow
    Write-Host ""
    Write-Host "Expected directory: C:\Users\YourUser\Documents\Project\Lin_re\Lin" -ForegroundColor Yellow
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "βœ… Found package.json in current directory" -ForegroundColor Green
Write-Host ""

# Check prerequisites
Write-Host "=== Checking Prerequisites ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking Node.js..." -ForegroundColor Yellow
try {
    $nodeVersion = node --version
    Write-Host "βœ… Node.js installed: $nodeVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Node.js not found. Please install Node.js from https://nodejs.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking npm..." -ForegroundColor Yellow
try {
    $npmVersion = npm --version
    Write-Host "βœ… npm installed: $npmVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ npm not found. Please install Node.js from https://nodejs.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking Python..." -ForegroundColor Yellow
try {
    $pythonVersion = python --version
    Write-Host "βœ… Python installed: $pythonVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Python not found. Please install Python from https://python.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host "Checking pip..." -ForegroundColor Yellow
try {
    $pipVersion = pip --version
    Write-Host "βœ… pip installed: $pipVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ pip not found. Please install Python from https://python.org" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "βœ… All prerequisites are installed!" -ForegroundColor Green
Write-Host ""

# Setup environment files
Write-Host "=== Setting Up Environment Files ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Setting up frontend environment..." -ForegroundColor Yellow
if (-not (Test-Path "frontend\.env.local")) {
    if (Test-Path "frontend\.env.example") {
        Copy-Item "frontend\.env.example" -Destination "frontend\.env.local" -Force
        Write-Host "βœ… Frontend .env.local created successfully" -ForegroundColor Green
    } else {
        Write-Host "❌ Frontend .env.example not found" -ForegroundColor Red
    }
} else {
    Write-Host "ℹ️  Frontend .env.local already exists" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "Setting up backend environment..." -ForegroundColor Yellow
if (-not (Test-Path "backend\.env")) {
    if (Test-Path "backend\.env.example") {
        Copy-Item "backend\.env.example" -Destination "backend\.env" -Force
        Write-Host "βœ… Backend .env created successfully" -ForegroundColor Green
    } else {
        Write-Host "❌ Backend .env.example not found" -ForegroundColor Red
    }
} else {
    Write-Host "ℹ️  Backend .env already exists" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "Environment setup complete!" -ForegroundColor Green
Write-Host ""

# Install dependencies
Write-Host "=== Installing Dependencies ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Installing root dependencies..." -ForegroundColor Yellow
try {
    npm install
    Write-Host "βœ… Root dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install root dependencies" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Installing frontend dependencies..." -ForegroundColor Yellow
try {
    Set-Location frontend
    npm install
    Write-Host "βœ… Frontend dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install frontend dependencies" -ForegroundColor Red
    Set-Location ..
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Installing backend dependencies..." -ForegroundColor Yellow
try {
    Set-Location backend
    pip install -r requirements.txt
    Write-Host "βœ… Backend dependencies installed successfully" -ForegroundColor Green
} catch {
    Write-Host "❌ Failed to install backend dependencies" -ForegroundColor Red
    Set-Location ..
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "Returning to root directory..." -ForegroundColor Yellow
Set-Location ..

Write-Host ""
Write-Host "βœ… All dependencies installed successfully!" -ForegroundColor Green
Write-Host ""

# Build the project
Write-Host "=== Building Project ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Building frontend for production..." -ForegroundColor Yellow
try {
    npm run build
    Write-Host "βœ… Build completed successfully!" -ForegroundColor Green
} catch {
    Write-Host "❌ Build failed" -ForegroundColor Red
    Read-Host "Press Enter to exit"
    exit
}

Write-Host ""
Write-Host "βœ… Build completed successfully!" -ForegroundColor Green
Write-Host ""

# Final check
Write-Host "=== Final Verification ===" -ForegroundColor Cyan
Write-Host ""

Write-Host "Checking if everything is working..." -ForegroundColor Yellow
Write-Host ""

Write-Host "Testing npm scripts..." -ForegroundColor Yellow
try {
    npm run lint
    Write-Host "βœ… Lint test passed" -ForegroundColor Green
} catch {
    Write-Host "⚠️  Lint test failed (this is normal for initial setup)" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "βœ… Setup completed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Edit frontend\.env.local with your configuration" -ForegroundColor Yellow
Write-Host "2. Edit backend\.env with your configuration" -ForegroundColor Yellow
Write-Host "3. Run 'npm start' to start development servers" -ForegroundColor Yellow
Write-Host "4. Open http://localhost:3000 in your browser" -ForegroundColor Yellow
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Setup Complete! πŸŽ‰" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Read-Host "Press Enter to continue"
```

## 🎯 Best Practices

### 1. Always Run from Root Directory
- Always run npm commands from the project root directory
- Use the provided setup scripts to ensure correct navigation
- Verify you're in the right directory before running commands

### 2. Use the Right Shell
- Command Prompt: Use `.bat` files for batch operations
- PowerShell: Use `.ps1` files for advanced operations
- Choose the shell that works best for your workflow

### 3. Regular Maintenance
- Update dependencies regularly
- Clean build artifacts before building
- Check for port conflicts before starting servers

### 4. Environment Management
- Keep environment files secure
- Use different environment files for development and production
- Never commit sensitive information to version control

## πŸ“ž Support

If you encounter issues not covered in this guide:

1. Check the [main README](./README.md) for general information
2. Review the [setup guide](./SETUP_GUIDE.md) for detailed instructions
3. Run the diagnostic scripts provided in this guide
4. Create an issue on GitHub with:
   - Windows version (e.g., Windows 11 Pro)
   - PowerShell and Command Prompt versions
   - Error messages and screenshots
   - Steps to reproduce the issue

## πŸ”„ Quick Reference

### Essential Commands

**From Project Root Directory:**
```cmd
# Check if you're in the right place
dir package.json

# Install everything
npm install

# Start development
npm start

# Build for production
npm run build

# Run tests
npm test
```

**Navigation:**
```cmd
# Go to project root (from any directory)
cd C:\Users\YourUser\Documents\Project\Lin_re\Lin

# Check current location
cd

# List files
dir
```

**Environment Setup:**
```cmd
# Setup environment files
copy frontend\.env.example frontend\.env.local
copy backend\.env.example backend\.env

# Install dependencies
npm install
cd frontend && npm install
cd ..\backend && pip install -r requirements.txt
cd ..
```

This comprehensive guide should resolve the npm navigation issues and provide clear instructions for Windows users. The key is to always run npm commands from the project root directory where the main `package.json` is located.