Go to file
realrobotshk be5b95b311 teacher view shows realtime updates, allows student account creation, pushes code 2026-04-21 04:08:35 +00:00
public esp32 firmware flashing good 2026-04-17 18:34:46 +08:00
server teacher view shows realtime updates, allows student account creation, pushes code 2026-04-21 04:08:35 +00:00
src teacher view shows realtime updates, allows student account creation, pushes code 2026-04-21 04:08:35 +00:00
.env.example login 2026-04-21 10:16:18 +08:00
.gitignore tweaks to esp32 flashing 2026-04-19 19:28:00 +08:00
deploy.bat esp32 firmware flashing good 2026-04-17 18:34:46 +08:00
features.md tweaks to esp32 flashing 2026-04-19 19:28:00 +08:00
index.html save/load projects and robots now stores on server 2026-04-21 03:45:12 +00:00
package.json login 2026-04-21 10:16:18 +08:00
readme.md login 2026-04-21 10:16:18 +08:00
teacher.html teacher view shows realtime updates, allows student account creation, pushes code 2026-04-21 04:08:35 +00:00
vite.config.js login 2026-04-21 10:16:18 +08:00

readme.md

Realrobots.net blockly microcontroller IDE

Development

Two processes run side by side:

  1. npm run server — Node/Express backend (auth, WebSocket realtime, arduino-cli). Reads .env (see .env.example). Listens on PORT (default 3001).
  2. npm run dev — Vite dev server on port 3000. Proxies /blocks/api/* and /blocks/ws to 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 /blocks prefix)
  • /blocks/wshttp://127.0.0.1:3001/ws with WebSocket upgrade (strip the /blocks prefix)

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).