How canvasbird/canvasboard-backend works
Project Type and Purpose
• This is the backend for Canvasboard, a Node.js/Express API service that supports an interactive teaching/presentation platform.
• It exposes REST endpoints for user auth, board management, file and folder operations, sharing, and Google OAuth.
File Structure Overview
• APIs/
• app.js – Express app entry point
• Routes/ – API route definitions
• controllers/ – Business logic split by feature (auth, file, folder, board, share, upload)
• models/ – MongoDB schemas and connection setup
• middlewares/ – JWT/permission checks
• config/ – DB config, MinIO (object storage) config
• passportSetup.js – Google OAuth strategy
• docker-compose.yaml, local/docker-compose.yaml – Service definitions (API, MongoDB, MinIO)
• ansible/ – Playbook for provisioning servers
• .github/ – CI/CD workflows and custom Ansible action
Key Components
• Clients: Browser or Front‑end app
• API Layer:
• NGINX (optional reverse proxy)
• Express server (app.js)
• Middleware: Authentication, error handlers
• Controllers: authCtrl, boardCtrl, file/*, folder/*, shareCtrl, uploadCtrl
• Data Layer:
• MongoDB (collections: users, boards, files, folders, sharedFiles, passwordResets)
• MinIO object storage for file blobs
• External Services: Google OAuth endpoint
• Deployment/Infra: Docker containers, Ansible provisioning
Relationships and Interactions
• Client → NGINX → Express routes
• Routes → Middleware → Controllers
• Controllers → Models → MongoDB
• File upload/download → Controllers → MinIO
• Auth requests → Controllers → Google OAuth / MongoDB
• CI/CD pipeline triggers Ansible playbook
Architectural Patterns and Technologies
• MVC‑inspired separation: routes → controllers → models
• Token‑based auth with JWT middleware
• External OAuth integration (Passport + Google)
• Containerized deployment (Docker Compose + Ansible)