|
|
||
|---|---|---|
| public | ||
| server | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| deploy.bat | ||
| features.md | ||
| index.html | ||
| package.json | ||
| readme.md | ||
| teacher.html | ||
| vite.config.js | ||
readme.md
Realrobots.net blockly microcontroller IDE
Development
Two processes run side by side:
npm run server— Node/Express backend (auth, WebSocket realtime, arduino-cli). Reads.env(see.env.example). Listens onPORT(default 3001).npm run dev— Vite dev server on port 3000. Proxies/blocks/api/*and/blocks/wsto the backend.
Sign in is optional. Without login the IDE works as before. Once logged in as a student, your Blockly workspace is mirrored in realtime to any teacher viewing /blocks/teacher.html.
Creating a teacher account
There is no public "create teacher" flow. Promote a user to teacher in MySQL after they register:
UPDATE users SET role = 'teacher' WHERE username = 'alice';
Build & deploy
deploy.bat builds to dist/ and scps it to realrobots.net:~/blocks/ as before. The Node server now also needs to run on that host (e.g. via pm2 or systemd) and the web server needs two proxy rules so the browser can reach it under the /blocks/ base path:
/blocks/api/*→http://127.0.0.1:3001/api/*(strip the/blocksprefix)/blocks/ws→http://127.0.0.1:3001/wswith WebSocket upgrade (strip the/blocksprefix)
Example nginx snippet:
location /blocks/api/ {
proxy_pass http://127.0.0.1:3001/api/;
proxy_set_header Host $host;
}
location /blocks/ws {
proxy_pass http://127.0.0.1:3001/ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
}
After deploy.bat, restart the Node process (pm2 restart esp32block-server or equivalent).