The Local Nexus Controller now supports live reloading for rapid development and testing.
When you make changes to any of these file types, the server automatically restarts:
- Python files (
.py) - Backend logic, models, routes - HTML templates (
.html) - Jinja2 templates intemplates/ - CSS stylesheets (
.css) - Styles instatic/ - JavaScript files (
.js) - Frontend scripts instatic/
1. Set in .env file:
LOCAL_NEXUS_RELOAD=true2. Start the development server:
# Using npm
npm run dev
# OR using Python directly
python -m local_nexus_controllerThe server will now watch for file changes and automatically reload when you save.
In Bolt.new:
- Make changes to any file
- Save the file (Ctrl+S or Cmd+S)
- The server automatically detects the change
- Server restarts in ~1-2 seconds
- Refresh your browser to see changes
In Cursor:
- Edit files in your local folder
- Save changes
- Server auto-reloads
- Refresh browser to see updates
- Keep browser tab open: Just refresh after making changes
- Use browser dev tools: Press F12 to inspect and debug
- Check terminal output: Server logs show reload status
- Make incremental changes: Test small changes before making large ones
- Disable auto-start features: Turn off
AUTO_START_ALL_ON_BOOTduring development
When a file changes:
- Uvicorn detects the file modification
- Current server process stops gracefully
- New server process starts with updated code
- Database connections are re-established
- Routes and templates are reloaded
- Server is ready in 1-2 seconds
Server not reloading:
- Verify
LOCAL_NEXUS_RELOAD=truein.env - Check terminal for error messages
- Make sure you're running
npm run dev(notnpm start) - Restart the server manually if needed
Changes not visible in browser:
- Hard refresh: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Clear browser cache
- Check browser console for errors (F12)
- Verify file was saved correctly
Server crashes on reload:
- Check syntax errors in Python files
- Verify template syntax in HTML files
- Review terminal output for error details
- Fix the error and save again
local_nexus_controller/
├── main.py # FastAPI app setup
├── models.py # SQLModel database models
├── settings.py # Configuration management
├── db.py # Database initialization
├── routers/ # API route handlers
│ ├── api_services.py
│ ├── api_databases.py
│ └── ui.py # Web page routes
├── services/ # Business logic
│ ├── process_manager.py
│ ├── auto_discovery.py
│ └── file_watcher.py
├── templates/ # Jinja2 HTML templates
│ ├── base.html
│ ├── dashboard.html
│ └── services.html
└── static/ # CSS, JS, images
├── styles.css
└── app.js
Adding a new route:
- Create or edit file in
routers/ - Define route handler function
- Include router in
main.py - Test with browser or API client
Modifying templates:
- Edit HTML file in
templates/ - Use Jinja2 syntax:
{{ variable }},{% block %} - Save and refresh browser
- Check for template errors in terminal
Updating styles:
- Edit
static/styles.css - Save changes
- Hard refresh browser (Ctrl+Shift+R)
- Use browser dev tools to debug
Adding JavaScript:
- Edit
static/app.js - Add functions or event listeners
- Save and refresh browser
- Test in browser console
Modifying models:
- Edit
models.py - Add/modify SQLModel classes
- Update
db._sqlite_migrate()if needed - Restart server (auto-reload handles this)
- Test with database queries
Note: SQLite schema changes require migration logic in db._sqlite_migrate()
Manual testing:
# Start development server
npm run dev
# In another terminal, test API endpoints
curl http://localhost:5010/api/services
# Or use the Swagger docs
# Open: http://localhost:5010/docsTesting process management:
# Test service start/stop
curl -X POST http://localhost:5010/api/services/{id}/start
curl -X POST http://localhost:5010/api/services/{id}/stopPython debugging:
- Add
print()statements - Check terminal output
- Use Python debugger:
import pdb; pdb.set_trace()
Frontend debugging:
- Open browser DevTools (F12)
- Check Console tab for JavaScript errors
- Use Network tab to inspect API calls
- Use Elements tab to debug HTML/CSS
Database debugging:
- Query SQLite directly:
sqlite3 data/local_nexus.db - Check database file exists:
ls data/local_nexus.db - View schema:
.schemain sqlite3
- Create route in appropriate router file
- Define request/response models with Pydantic
- Implement handler function
- Test with Swagger docs at
/docs
- Create HTML template in
templates/ - Extend
base.htmltemplate - Add route in
routers/ui.py - Add navigation link in
base.html - Style with Tailwind CSS classes
- Update
models.pywith new fields - Add migration in
db._sqlite_migrate() - Update API endpoints in routers
- Update templates to display new data
- Test end-to-end
- Minimize auto-discovery scope: Only scan necessary folders
- Disable features during dev: Turn off file watcher if not needed
- Use SQLite WAL mode: Better concurrent access
- Keep logs small: Rotate logs regularly
- Profile slow endpoints: Use timing decorators
# Start feature branch
git checkout -b feature/my-feature
# Make changes with live reload
# Test thoroughly
# Commit changes
git add .
git commit -m "Add my feature"
# Push to remote
git push origin feature/my-featureWhen deploying to production:
- Disable reload: Set
LOCAL_NEXUS_RELOAD=false - Use production host: Set
LOCAL_NEXUS_HOST=127.0.0.1 - Set secure token: Generate strong
LOCAL_NEXUS_TOKEN - Configure firewall: Restrict access to port 5010
- Enable startup: Use
setup_windows_startup.ps1
- Documentation: Check
README.mdand this file - API docs: Visit
/docswhen server is running - Logs: Check terminal output for errors
- Database: Query SQLite file directly
- Community: Search GitHub issues or create new one
- Read
RECOMMENDATIONS.mdfor best practices - Review
README.mdfor feature overview - Check
QUICKSTART.mdfor setup guide - Explore API at
/docsendpoint
Happy developing!