Skip to content

Commit 3001cca

Browse files
authored
Added LIVE_RELOAD.md
1 parent f19501d commit 3001cca

7 files changed

Lines changed: 767 additions & 2 deletions

File tree

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ LOCAL_NEXUS_GITHUB_OAUTH_CLIENT_ID=
2525
# Defaults to enabled for local runs, disabled on hosted platforms.
2626
LOCAL_NEXUS_OPEN_BROWSER=true
2727

28+
# Enable hot-reload for development (watches Python, HTML, CSS, JS files)
29+
# Changes are reflected immediately without manual restart
30+
LOCAL_NEXUS_RELOAD=false
31+
2832
# Reboot/logon widget behavior (Windows)
2933
# Wait for internet connectivity before opening the widget (recommended).
3034
LOCAL_NEXUS_WAIT_FOR_INTERNET=true

CHEAT_SHEET.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# Local Nexus Controller - Cheat Sheet
2+
3+
## 🚀 Quick Commands
4+
5+
```powershell
6+
# Start development server (with live reload)
7+
npm run dev
8+
9+
# Start production server (no reload)
10+
npm start
11+
12+
# Install dependencies
13+
npm install
14+
15+
# Build (verification only for Python)
16+
npm run build
17+
```
18+
19+
## 📁 Key Locations
20+
21+
| What | Where |
22+
|------|-------|
23+
| **Your programs** | `C:\Users\nedpe\Desktop\Repositories` |
24+
| **ZIP drop zone** | `C:\Users\nedpe\Desktop` |
25+
| **Controller code** | `C:\Users\nedpe\LocalNexusController` |
26+
| **Database** | `data/local_nexus.db` |
27+
| **Logs** | `data/logs/` |
28+
| **Config** | `.env` |
29+
30+
## 🌐 URLs
31+
32+
| Service | URL |
33+
|---------|-----|
34+
| **Dashboard** | http://localhost:5010 |
35+
| **API Docs** | http://localhost:5010/docs |
36+
| **Services** | http://localhost:5010/services |
37+
| **Import** | http://localhost:5010/import |
38+
39+
## ⚙️ Configuration (.env)
40+
41+
```bash
42+
# Live reload (instant changes)
43+
LOCAL_NEXUS_RELOAD=true
44+
45+
# Auto-discovery (scan repos folder)
46+
LOCAL_NEXUS_AUTO_DISCOVERY_ENABLED=true
47+
LOCAL_NEXUS_REPOSITORIES_FOLDER=C:\Users\nedpe\Desktop\Repositories
48+
49+
# File watcher (auto-import ZIPs)
50+
LOCAL_NEXUS_FILE_WATCHER_ENABLED=true
51+
LOCAL_NEXUS_FILE_WATCHER_FOLDER=C:\Users\nedpe\Desktop
52+
53+
# Auto-start services on boot
54+
LOCAL_NEXUS_AUTO_START_ALL_ON_BOOT=true
55+
```
56+
57+
## 🔄 Live Reload Workflow
58+
59+
1. **Edit** any file (Python, HTML, CSS, JS)
60+
2. **Save** (Ctrl+S)
61+
3. **Wait** 1-2 seconds for reload
62+
4. **Refresh** browser (F5 or Ctrl+Shift+R)
63+
5. **See changes** instantly!
64+
65+
## 📦 Adding Programs
66+
67+
### Method 1: Direct Copy
68+
```powershell
69+
# Copy program folder to repositories
70+
cp -r "MyApp" "C:\Users\nedpe\Desktop\Repositories\"
71+
# Restart controller to auto-discover
72+
```
73+
74+
### Method 2: ZIP File
75+
```powershell
76+
# Drop ZIP on Desktop
77+
# File watcher automatically extracts and imports
78+
```
79+
80+
### Method 3: API Import
81+
```powershell
82+
# Use the Import page in dashboard
83+
# Or POST to /api/import/bundle
84+
```
85+
86+
## 🎮 Service Control
87+
88+
### Via Dashboard
89+
- Click **"Launch"** button to open in browser
90+
- Click **"Start"** to start the service
91+
- Click **"Stop"** to stop the service
92+
- Click **"Restart"** to restart the service
93+
94+
### Via API
95+
```bash
96+
# Start service
97+
curl -X POST http://localhost:5010/api/services/{id}/start
98+
99+
# Stop service
100+
curl -X POST http://localhost:5010/api/services/{id}/stop
101+
102+
# Restart service
103+
curl -X POST http://localhost:5010/api/services/{id}/restart
104+
105+
# Get service details
106+
curl http://localhost:5010/api/services/{id}
107+
```
108+
109+
## 🔍 Troubleshooting
110+
111+
### Server Won't Start
112+
```powershell
113+
# Check if port is in use
114+
netstat -ano | findstr :5010
115+
116+
# Check Python installed
117+
python --version
118+
119+
# Reinstall dependencies
120+
pip install -r requirements.txt
121+
```
122+
123+
### Changes Not Showing
124+
```bash
125+
# 1. Verify reload enabled
126+
LOCAL_NEXUS_RELOAD=true
127+
128+
# 2. Hard refresh browser
129+
Ctrl + Shift + R
130+
131+
# 3. Check terminal for errors
132+
# Look for syntax errors or exceptions
133+
```
134+
135+
### Service Won't Start
136+
```powershell
137+
# Check service details in dashboard
138+
# Verify start_command is correct
139+
# Check working_directory exists
140+
# Review logs in service detail page
141+
```
142+
143+
## 🪟 Windows Startup
144+
145+
### Enable Auto-Start
146+
```powershell
147+
.\tools\setup_windows_startup.ps1
148+
```
149+
150+
### Disable Auto-Start
151+
```powershell
152+
.\tools\disable_windows_startup.ps1
153+
```
154+
155+
### Check Status
156+
```powershell
157+
Get-ScheduledTask -TaskName "LocalNexusController_AutoStart"
158+
```
159+
160+
## 🗂️ File Structure
161+
162+
```
163+
LocalNexusController/
164+
├── .env # Your configuration
165+
├── package.json # npm scripts
166+
├── requirements.txt # Python dependencies
167+
├── local_nexus_controller/
168+
│ ├── __main__.py # Entry point
169+
│ ├── main.py # FastAPI app
170+
│ ├── models.py # Database models
171+
│ ├── settings.py # Settings loader
172+
│ ├── routers/ # API routes
173+
│ ├── services/ # Business logic
174+
│ ├── templates/ # HTML pages
175+
│ └── static/ # CSS, JS
176+
├── data/
177+
│ ├── local_nexus.db # SQLite database
178+
│ └── logs/ # Service logs
179+
└── tools/ # Utility scripts
180+
```
181+
182+
## 📋 Common Tasks
183+
184+
### View All Services
185+
```bash
186+
curl http://localhost:5010/api/services
187+
```
188+
189+
### Scan for New Programs
190+
```bash
191+
curl -X POST http://localhost:5010/api/autodiscovery/scan \
192+
-H "Content-Type: application/json" \
193+
-d '{"folder_path":"C:\\Users\\nedpe\\Desktop\\Repositories","auto_import":true}'
194+
```
195+
196+
### Get Summary
197+
```bash
198+
curl http://localhost:5010/api/summary
199+
```
200+
201+
### List Ports
202+
```bash
203+
curl http://localhost:5010/api/ports
204+
```
205+
206+
## 🎨 Customization
207+
208+
### Change Port
209+
```bash
210+
# In .env
211+
LOCAL_NEXUS_PORT=8080
212+
```
213+
214+
### Change Theme Colors
215+
```css
216+
/* Edit local_nexus_controller/static/styles.css */
217+
/* Uses Tailwind CSS classes */
218+
```
219+
220+
### Add New Page
221+
1. Create template in `templates/`
222+
2. Add route in `routers/ui.py`
223+
3. Add nav link in `templates/base.html`
224+
225+
## 📚 Documentation
226+
227+
| Guide | Purpose |
228+
|-------|---------|
229+
| **README.md** | Overview and features |
230+
| **LIVE_RELOAD.md** | Live reload guide |
231+
| **DEVELOPMENT.md** | Development practices |
232+
| **RECOMMENDATIONS.md** | Best practices and tips |
233+
| **QUICKSTART.md** | 5-minute setup |
234+
| **CHEAT_SHEET.md** | This file! |
235+
236+
## 💡 Pro Tips
237+
238+
1. **Keep Terminal Visible** - Watch reload status and errors
239+
2. **Use Hard Refresh** - Ctrl+Shift+R ensures CSS updates
240+
3. **Test Incrementally** - Small changes are easier to debug
241+
4. **Check Logs** - Service detail page shows recent logs
242+
5. **Use API Docs** - Visit `/docs` for interactive API testing
243+
6. **Backup Database** - Copy `data/local_nexus.db` regularly
244+
7. **Version Control** - Git everything except `.env` and `data/`
245+
246+
## 🆘 Getting Help
247+
248+
1. Check this cheat sheet
249+
2. Read the relevant guide (see Documentation above)
250+
3. Check API docs at `/docs`
251+
4. Review terminal output for errors
252+
5. Query database directly: `sqlite3 data/local_nexus.db`
253+
254+
## 🎯 Next Steps
255+
256+
- [ ] Configure auto-discovery with your repos folder
257+
- [ ] Enable file watcher for ZIP imports
258+
- [ ] Set up Windows auto-start
259+
- [ ] Import your existing projects
260+
- [ ] Enable live reload for development
261+
- [ ] Add launch links to all services
262+
- [ ] Test the auto-start feature
263+
- [ ] Backup your database
264+
265+
---
266+
267+
**Quick Help:**
268+
- **Dashboard**: http://localhost:5010
269+
- **API Docs**: http://localhost:5010/docs
270+
- **Live Reload**: `LOCAL_NEXUS_RELOAD=true` + `npm run dev`
271+
- **Add Program**: Drop folder in `Repositories` or ZIP on Desktop
272+
273+
Happy coding! 🚀

0 commit comments

Comments
 (0)