How private-dev-ph/libreflow-annotate works
Purpose and entry points
This is a browser-based image annotation and project-management application with model/inference support. The Node.js HTTP server starts at server.js; static user interfaces are served from public/index.html, public/annotator.html, and related page-specific HTML files. Inference is a separate Python process rooted at py_scripts/infer_server.py.
Browser application
The frontend is a multi-page vanilla JavaScript application rather than a SPA. Shared API and application behavior are centered in public/js/api.js and public/js/app.js. Page controllers separate major workflows:
• Annotation workspace: public/annotator.html, public/js/canvas.js, public/js/project.js
• Dashboard and jobs: public/dashboard.html, public/js/dashboard.js, public/js/jobs-page.js
• Model management: public/models.html, public/js/models-page.js
The browser-to-server boundary is the API client in public/js/api.js; UI code should not directly own backend persistence or inference execution.
Authentication and user-scoped experience
Authentication is handled through routes/auth.js, with corresponding browser behavior in public/js/auth.js and public/login.html. Notification/inbox behavior is independently surfaced through routes/notifications.js, public/js/notifications.js, and public/js/nav-inbox.js, indicating user-facing asynchronous status or activity is part of the core experience.
Projects, images, and annotations
The central data domain appears to be projects containing images and annotation data. Backend ownership is partitioned by resource:
• Projects: routes/projects.js
• Images: routes/images.js
• Annotations: routes/annotations.js
The annotation UI combines the project controller with an interactive drawing/rendering layer in public/js/project.js and public/js/canvas.js. The expected control flow is: select or load a project/image, retrieve image and existing annotation state through route APIs, edit on the canvas, then persist annotation changes through the annotations API.
Batch jobs and model lifecycle
Longer-running work is modeled separately from interactive annotation. routes/batches.js exposes batch-oriented operations, while public/js/jobs.js and public/js/jobs-page.js present job status or controls. Model-facing operations are isolated in routes/models.js and public/js/models-page.js.
This separation suggests a key boundary: browser interactions initiate work through the Node server, while job/batch processing and model inference should remain asynchronous rather than block annotation requests.
Python inference boundary and runtime
Inference functionality is implemented outside the Node runtime in py_scripts/infer_server.py, with supporting execution logic in py_scripts/pipeline.py and Python dependencies in py_scripts/requirements.txt. The repository includes separate launch scripts—start_app.bat, start_app.ps1, and start_inference.bat—which reinforce that the web/API service and inference service are independently started processes.
The material runtime architecture is therefore:
1. Node.js server/API (server.js, routes/*.js)
2. Static browser client (public/)
3. Python inference service/pipeline (py_scripts/)
No database, message broker, cloud provider, or third-party model service can be confirmed from the supplied tree.
Main entry points: api.js API client · server.js HTTP server · project.js Project controller · batches.js Batch jobs API
Components 19
Browser client
Multi-page vanilla JavaScript application.
- Shared app behavior
public/js/app.js - API client · Browser-to-server boundary for UI code.
public/js/api.js - Login experience
public/js/auth.js - Annotation workspace
public/annotator.html - Project controller
public/js/project.js - Drawing canvas · Interactive annotation rendering and editing.
public/js/canvas.js - Dashboard and jobs
public/js/jobs-page.js - Model management
public/js/models-page.js - Inbox notifications
public/js/nav-inbox.js
Node.js API
HTTP server and resource routes.
- HTTP server · Serves static pages and API routes.
server.js - Auth API
routes/auth.js - Projects API
routes/projects.js - Images API
routes/images.js - Annotations API
routes/annotations.js - Batch jobs API
routes/batches.js - Models API
routes/models.js - Notifications API
routes/notifications.js
Python inference
Independently started inference runtime.
- Inference service · Separate runtime for model inference.
py_scripts/infer_server.py - Inference pipeline
py_scripts/pipeline.py
Connections 27
- HTTP server → Auth API: mounts
- HTTP server → Projects API: mounts
- HTTP server → Images API: mounts
- HTTP server → Annotations API: mounts
- HTTP server → Batch jobs API: mounts
- HTTP server → Models API: mounts
- HTTP server → Notifications API: mounts
- HTTP server → Shared app behavior: serves
- Shared app behavior → API client: uses
- Login experience → API client: auth requests
- Annotation workspace → Project controller: loads
- Project controller → Drawing canvas: edits with
- Project controller → API client: loads and saves
- Dashboard and jobs → API client: job controls
- Model management → API client: model operations
- Inbox notifications → API client: activity requests
- API client → HTTP server: HTTP API
- API client → Auth API: authentication
- API client → Projects API: projects
- API client → Images API: images
- API client → Annotations API: annotation state
- API client → Batch jobs API: batch status
- API client → Models API: models
- API client → Notifications API: notifications
- Batch jobs API → Inference service: asynchronous work
- Models API → Inference service: inference operations
- Inference service → Inference pipeline: runs