Skip to content

Commit c37514c

Browse files
authored
Updated package-lock.json
1 parent dafa342 commit c37514c

11 files changed

+1023
-14
lines changed

AUTO_START_GUIDE.md

Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
# Auto-Start Setup Guide
2+
3+
This guide shows you how to configure Local Nexus Controller to automatically start when Windows boots.
4+
5+
---
6+
7+
## Quick Setup (Recommended)
8+
9+
### Enable Auto-Start
10+
11+
1. Open the `tools` folder in your project
12+
2. **Double-click** `ENABLE_AUTO_START.bat`
13+
3. Click "Yes" when prompted for administrator access
14+
4. Follow the prompts
15+
5. Done! The controller will now start automatically on boot
16+
17+
### Disable Auto-Start
18+
19+
1. Open the `tools` folder in your project
20+
2. **Double-click** `DISABLE_AUTO_START.bat`
21+
3. Click "Yes" when prompted for administrator access
22+
4. Confirm removal when asked
23+
5. Done! Auto-start is disabled
24+
25+
---
26+
27+
## What Gets Configured
28+
29+
When you enable auto-start, the setup script:
30+
31+
1. ✅ Creates a Windows Task Scheduler task
32+
2. ✅ Configures it to run at user logon
33+
3. ✅ Sets the correct working directory (your project folder)
34+
4. ✅ Runs `npm run dev` automatically
35+
5. ✅ Handles dependencies installation on first run
36+
6. ✅ Opens your browser to http://localhost:5010
37+
38+
---
39+
40+
## How It Works
41+
42+
### The Setup Process
43+
44+
1. **Task Scheduler Entry**
45+
- Task Name: "Local Nexus Controller"
46+
- Trigger: At user logon
47+
- Action: Run `npm run dev` from project directory
48+
- User: Your Windows account
49+
- Privilege Level: Highest (to access ports)
50+
51+
2. **Startup Script**
52+
- Location: `tools/start_nexus_on_boot.bat`
53+
- Changes to correct directory
54+
- Runs `npm run dev`
55+
- Keeps window minimized
56+
57+
3. **Application Startup**
58+
- Auto-installs dependencies if needed
59+
- Starts FastAPI server on port 5010
60+
- Opens dashboard in browser
61+
- Runs in background
62+
63+
---
64+
65+
## Verification
66+
67+
### Check If Auto-Start Is Enabled
68+
69+
**Method 1: Task Scheduler GUI**
70+
1. Press `Win + R`
71+
2. Type `taskschd.msc` and press Enter
72+
3. Look for "Local Nexus Controller" in the task list
73+
4. Status should show "Ready"
74+
75+
**Method 2: PowerShell**
76+
```powershell
77+
Get-ScheduledTask -TaskName "Local Nexus Controller"
78+
```
79+
80+
### Test Auto-Start Manually
81+
82+
**Option A: Run the task now**
83+
```powershell
84+
Start-ScheduledTask -TaskName "Local Nexus Controller"
85+
```
86+
87+
**Option B: Log out and log back in**
88+
1. Save all your work
89+
2. Log out of Windows
90+
3. Log back in
91+
4. The controller should start automatically
92+
93+
---
94+
95+
## Troubleshooting
96+
97+
### Issue: "Access Denied" Error
98+
99+
**Cause:** Script needs administrator privileges
100+
101+
**Solution:**
102+
- Right-click the .bat file
103+
- Select "Run as administrator"
104+
105+
### Issue: Task Created But Nothing Happens on Startup
106+
107+
**Check 1: Verify task is enabled**
108+
```powershell
109+
Get-ScheduledTask -TaskName "Local Nexus Controller" | Select-Object State
110+
```
111+
Should show: `Ready`
112+
113+
**Check 2: Check task history**
114+
1. Open Task Scheduler (`taskschd.msc`)
115+
2. Find "Local Nexus Controller"
116+
3. Click the "History" tab
117+
4. Look for errors
118+
119+
**Check 3: Test the batch file manually**
120+
```cmd
121+
cd tools
122+
start_nexus_on_boot.bat
123+
```
124+
125+
### Issue: PowerShell Execution Policy Error
126+
127+
**Symptom:** "Scripts are disabled on this system"
128+
129+
**Solution:**
130+
Run this in PowerShell as Administrator:
131+
```powershell
132+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
133+
```
134+
135+
Then try again.
136+
137+
### Issue: Node/npm Not Found
138+
139+
**Cause:** Node.js not in system PATH for scheduled tasks
140+
141+
**Solution A: Add Node to System PATH**
142+
1. Search for "Environment Variables" in Windows
143+
2. Edit "Path" under System variables
144+
3. Add Node.js installation path (e.g., `C:\Program Files\nodejs`)
145+
4. Restart computer
146+
147+
**Solution B: Modify startup script to use full path**
148+
Edit `tools/start_nexus_on_boot.bat`:
149+
```batch
150+
@echo off
151+
cd /d "C:\full\path\to\project"
152+
"C:\Program Files\nodejs\npm.cmd" run dev
153+
```
154+
155+
### Issue: Python Not Found
156+
157+
**Cause:** Python not in system PATH
158+
159+
**Solution:** Same as Node issue above - add Python to system PATH
160+
161+
### Issue: Multiple Instances Running
162+
163+
**Symptom:** Port 5010 already in use
164+
165+
**Check what's running:**
166+
```powershell
167+
Get-Process | Where-Object {$_.ProcessName -like "*python*"}
168+
```
169+
170+
**Kill existing processes:**
171+
```powershell
172+
Stop-Process -Name python -Force
173+
```
174+
175+
**Or use the dashboard:**
176+
Visit http://localhost:5010 and stop services from there
177+
178+
---
179+
180+
## Advanced Configuration
181+
182+
### Change Startup Delay
183+
184+
Edit the task in Task Scheduler:
185+
1. Open Task Scheduler
186+
2. Find "Local Nexus Controller"
187+
3. Right-click → Properties
188+
4. Triggers tab → Edit
189+
5. Check "Delay task for:" and set delay (e.g., 30 seconds)
190+
191+
### Run Only When Connected to Specific Network
192+
193+
Edit the task:
194+
1. Conditions tab
195+
2. Check "Start only if the following network connection is available"
196+
3. Select your network
197+
198+
### Change Port or Other Settings
199+
200+
Edit `.env` file in project root:
201+
```env
202+
LOCAL_NEXUS_PORT=5010
203+
LOCAL_NEXUS_HOST=0.0.0.0
204+
LOCAL_NEXUS_OPEN_BROWSER=true
205+
```
206+
207+
---
208+
209+
## Files Created by Setup
210+
211+
```
212+
tools/
213+
├── ENABLE_AUTO_START.bat # Double-click to enable
214+
├── DISABLE_AUTO_START.bat # Double-click to disable
215+
├── setup_auto_start.ps1 # PowerShell setup script
216+
├── disable_auto_start.ps1 # PowerShell removal script
217+
├── start_nexus_on_boot.bat # Auto-generated startup script
218+
└── start_on_boot.vbs # Alternative VBS launcher
219+
```
220+
221+
---
222+
223+
## Alternative: Startup Folder Method (Not Recommended)
224+
225+
If Task Scheduler doesn't work, you can use the Startup folder:
226+
227+
1. Press `Win + R`
228+
2. Type `shell:startup` and press Enter
229+
3. Create a shortcut to `tools/start_nexus_on_boot.bat`
230+
4. Restart to test
231+
232+
**Note:** This method is less reliable than Task Scheduler.
233+
234+
---
235+
236+
## Security Considerations
237+
238+
### Why Administrator Access Is Needed
239+
240+
- **Port Binding:** Opening port 5010 requires elevated privileges
241+
- **Task Scheduler:** Creating system tasks requires admin rights
242+
- **Process Management:** Starting/stopping services needs permissions
243+
244+
### What Gets Accessed
245+
246+
- ✅ Task Scheduler (to create startup task)
247+
- ✅ Project directory (to run the application)
248+
- ✅ Network port 5010 (for web interface)
249+
- ❌ No system files are modified
250+
- ❌ No registry changes outside Task Scheduler
251+
- ❌ No data collection or external connections
252+
253+
### Removing Everything
254+
255+
To completely remove auto-start:
256+
257+
1. Run `DISABLE_AUTO_START.bat`
258+
2. Delete `tools/start_nexus_on_boot.bat` (optional)
259+
3. Verify in Task Scheduler that task is gone
260+
261+
---
262+
263+
## FAQ
264+
265+
### Q: Will this slow down my computer startup?
266+
267+
**A:** Minimal impact. The task starts after you log in, not during Windows boot. The actual application takes 2-3 seconds to start.
268+
269+
### Q: Can I change what port it uses?
270+
271+
**A:** Yes, edit the `.env` file:
272+
```env
273+
LOCAL_NEXUS_PORT=8080
274+
```
275+
276+
### Q: Will it start if I'm not logged in?
277+
278+
**A:** No. The task is configured to run at user logon, so you must be logged into Windows.
279+
280+
### Q: Can I start it without opening the browser?
281+
282+
**A:** Yes, edit `.env`:
283+
```env
284+
LOCAL_NEXUS_OPEN_BROWSER=false
285+
```
286+
287+
### Q: How do I see the console output?
288+
289+
**A:** The console window runs minimized. To see output:
290+
1. Open Task Manager
291+
2. Find "cmd.exe" or "python.exe"
292+
3. Right-click → Bring to front
293+
294+
Or check logs at: http://localhost:5010
295+
296+
### Q: Can I run multiple instances?
297+
298+
**A:** Not on the same port. Change the port in `.env` for additional instances.
299+
300+
### Q: Does this work with Python virtual environments?
301+
302+
**A:** Yes, but modify `start_nexus_on_boot.bat` to activate the venv first:
303+
```batch
304+
@echo off
305+
cd /d "C:\path\to\project"
306+
call venv\Scripts\activate
307+
npm run dev
308+
```
309+
310+
---
311+
312+
## Summary
313+
314+
**To enable auto-start:**
315+
```
316+
1. Double-click: tools/ENABLE_AUTO_START.bat
317+
2. Click "Yes" for admin access
318+
3. Done!
319+
```
320+
321+
**To disable auto-start:**
322+
```
323+
1. Double-click: tools/DISABLE_AUTO_START.bat
324+
2. Click "Yes" for admin access
325+
3. Confirm removal
326+
4. Done!
327+
```
328+
329+
**To verify it's working:**
330+
```
331+
1. Log out of Windows
332+
2. Log back in
333+
3. Browser should open to http://localhost:5010
334+
```
335+
336+
That's it! Your Local Nexus Controller will now start automatically every time you log into Windows.

0 commit comments

Comments
 (0)