Infiwall
Canvas Application - Backend Server Node.js/Express/MongoDB backend server with MVC architecture for the collaborative canvas application. Features - RESTful API with Express.js - ...
Technical Architecture & Engineering Overview
Detailed system design and core implementation
The backend is organized under server/src with distinct layers: controllers contain business logic for users, canvases, and elements; routes expose RESTful endpoints guarded by the protect middleware that validates JWT tokens; models define MongoDB schemas for User, Canvas, and Element, each embedding references to enable relational‑like queries. Data flow starts at an HTTP request, passes through validation middleware (e.g., validation.js), reaches the controller, which interacts with Mongoose to persist or retrieve data, and finally returns a standardized JSON response.
Security is enforced at multiple levels. The auth.js middleware verifies the Authorization: Bearer <token> header, while Helmet, CORS, and bcryptjs protect against common web vulnerabilities and ensure password hashing. Input validation using express‑validator prevents malformed payloads, and a global error‑handling middleware normalizes error responses.
The frontend leverages a modular component library (src/components/ui) and a typed API layer (src/lib/api). The apiClient provides get, post, put, patch, and delete methods that automatically serialize request bodies and parse responses into a unified ApiResponse<T> shape. Services such as canvasService consume these methods, translating raw API data into domain models used by React components.
Build and deployment are streamlined with Vite for fast development bundling and ESLint for code quality. The project is configured as an ES module ("type": "module") and uses npm scripts for dev (vite), production builds, and linting. The repository is ready for containerization or serverless deployment, given its clear separation of concerns and stateless API design.
System Diagrams & Flow Visualizations
Interactive Mermaid architecture & execution flows
Core System Features
Key capabilities & architectural features
User registration and login with hashed passwords
User registration and login with hashed passwords
JWT‑protected routes for all CRUD operations
JWT‑protected routes for all CRUD operations
Canvas creation, retrieval, update, and deletion
Canvas creation, retrieval, update, and deletion
Collaborator management on canvases
Collaborator management on canvases
Element CRUD including position, rotation, and custom data
Element CRUD including position, rotation, and custom data
Bulk element updates to reduce network overhead
Bulk element updates to reduce network overhead
Typed API client with generic response handling
Typed API client with generic response handling
React UI components styled with TailwindCSS
React UI components styled with TailwindCSS
Responsive carousel component with keyboard navigation
Responsive carousel component with keyboard navigation
Comprehensive error handling middleware
Comprehensive error handling middleware
Engineering Challenges & Solutions
Problem statements & resolution strategies
Balancing schema flexibility for diverse element types against MongoDB document size limits
Balancing schema flexibility for diverse element types against MongoDB document size limits
Ensuring atomicity of bulk updates without native transaction support in a sharded cluster
Ensuring atomicity of bulk updates without native transaction support in a sharded cluster
Managing JWT token expiration and refresh without a dedicated auth service
Managing JWT token expiration and refresh without a dedicated auth service
Preventing race conditions when multiple collaborators edit the same canvas simultaneously
Preventing race conditions when multiple collaborators edit the same canvas simultaneously
Optimizing query performance for fetching large numbers of elements per canvas
Optimizing query performance for fetching large numbers of elements per canvas
API Reference & Endpoints
REST API surface & route documentation
| METHOD | ENDPOINT PATH | DESCRIPTION | COPY |
|---|---|---|---|
| POST | /:id/collaborators | Endpoint defined in server/src/routes/canvasRoutes.js | |
| POST | / | Endpoint defined in server/src/routes/elementRoutes.js | |
| GET | /canvas/:canvasId | Endpoint defined in server/src/routes/elementRoutes.js | |
| PATCH | /bulk | Endpoint defined in server/src/routes/elementRoutes.js | |
| POST | /register | Endpoint defined in server/src/routes/userRoutes.js | |
| POST | /login | Endpoint defined in server/src/routes/userRoutes.js | |
| GET | /profile | Endpoint defined in server/src/routes/userRoutes.js | |
| PUT | /profile | Endpoint defined in server/src/routes/userRoutes.js | |
| GET | /health | Endpoint defined in server/src/server.js |
Key Code Modules & Architecture
Core file entrypoints and service responsibilities
serverModule component managing server source logic
srcModule component managing src source logic
server/src/configModule component managing config source logic
server/src/controllersModule component managing controllers source logic
server/src/middlewareModule component managing middleware source logic
server/src/modelsModule component managing models source logic
server/src/routesModule component managing routes source logic
src/componentsModule component managing components source logic
src/components/uiModule component managing ui source logic
src/hooksModule component managing hooks source logic
src/libModule component managing lib source logic
src/lib/apiModule component managing api source logic
src/pagesModule component managing pages source logic
src/typesModule component managing types source logic
User Journey Pipeline
- 1User accesses application user interface via browser
- 2User triggers action invoking HTTP/WebSocket API endpoints
- 3Data persisted or retrieved from database storage layer
Execution Code Flow
- 1Client or caller initiates request to application entrypoint
- 2Backend router validates request parameters and applies middleware
- 3Database ORM/client executes storage query
- 4Application serializes JSON/audio/data response back to client
System FAQ & Technical Specifications
Frequently asked questions and core architecture details
Q: What technologies are used in Infiwall?
Infiwall is engineered using modern full-stack frameworks.
Q: What core engineering problem does Infiwall solve?
Canvas Application - Backend Server Node.js/Express/MongoDB backend server with MVC architecture for the collaborative canvas application. Features - RESTful API with Express.js - ...
Q: How is 'Balancing schema flexibility for diverse element types against MongoDB document size limits' resolved in Infiwall?
Resolved through specialized system architecture and resilient state handling.
Related Systems & Case Studies
Explore similar technical architectures and projects