Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9999e86
feat: live server refactor
sriramveeraghanta Sep 3, 2025
e45815f
fix: code refactor
sriramveeraghanta Sep 5, 2025
8be66c7
fix: controller dependency fixes
sriramveeraghanta Sep 5, 2025
25cbd24
fix: cors setup
sriramveeraghanta Sep 8, 2025
550bbe8
fix: env variable validation
sriramveeraghanta Sep 8, 2025
fc9ca0c
fix: trime cors orgins
sriramveeraghanta Sep 8, 2025
37cd162
fix: extensions hoscuspos server
sriramveeraghanta Sep 8, 2025
e5a11cd
chore: code refactor
sriramveeraghanta Sep 9, 2025
63b7b83
Merge branch 'preview' of github.com:makeplane/plane into feat-live-s…
sriramveeraghanta Sep 11, 2025
126b416
chore: code refactor
sriramveeraghanta Sep 11, 2025
5830138
fix: code refactor
sriramveeraghanta Sep 12, 2025
fe36d9a
fix: code refactor
sriramveeraghanta Sep 12, 2025
f6dcc12
Merge branch 'preview' into feat-live-server-sync
Palanikannan1437 Sep 23, 2025
955ab39
Add strong typing to improve type safety
Palanikannan1437 Sep 24, 2025
47c9fc0
fix: live server explicit dependency while setting up routes
Palanikannan1437 Sep 25, 2025
2322b77
fix: types fixed
Palanikannan1437 Sep 29, 2025
b979465
fix: auth and stateless types
Palanikannan1437 Sep 29, 2025
465006b
fix: build and dev scripts
Palanikannan1437 Sep 30, 2025
3d455cc
fix: merge conflicts
sriramveeraghanta Sep 30, 2025
eb1787b
fix: broken lock file
sriramveeraghanta Sep 30, 2025
483fb13
fix: lint skip
sriramveeraghanta Sep 30, 2025
1941fff
fix: api requests to wrong endpoint
Palanikannan1437 Sep 30, 2025
2d568b5
fix: cors allowed origins
sriramveeraghanta Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/live/Dockerfile.live
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ ENV TURBO_TELEMETRY_DISABLED=1

EXPOSE 3000

CMD ["node", "apps/live/dist/server.js"]
CMD ["node", "apps/live/dist/start.js"]
15 changes: 10 additions & 5 deletions apps/live/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"license": "AGPL-3.0",
"description": "A realtime collaborative server powers Plane's rich text editor",
"main": "./src/server.ts",
"main": "./dist/start.js",
"private": true,
"type": "module",
"scripts": {
"build": "tsdown",
"dev": "tsdown --watch",
"start": "node --env-file=.env dist/server.js",
"build": "tsc --noEmit && tsdown",
"dev": "tsdown --watch --onSuccess \"node --env-file=.env dist/start.js\"",
"start": "node --env-file=.env dist/start.js",
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify Node.js version requirement is documented.

The scripts use node --env-file=.env, which requires Node.js ≥20.11. The past review comment mentions "engines": { "node": ">=22.18.0" } was added, but it's not visible in the current file.

Run the following to confirm the engines field is present:


🏁 Script executed:

#!/bin/bash
# Check if engines field exists in package.json
cat apps/live/package.json | jq -r '.engines'

Length of output: 4


Add Node.js engine requirement in apps/live/package.json
Include an engines entry specifying Node.js ≥20.11.0 to guarantee support for the --env-file flag.

{
  "engines": {
    "node": ">=20.11.0"
  }
}
🤖 Prompt for AI Agents
In apps/live/package.json around lines 10 to 12, add an "engines" field to
require Node.js >=20.11.0 so the CLI "--env-file" flag is supported; update the
package.json by inserting an "engines": { "node": ">=20.11.0" } entry at the
top-level (near other metadata like name/version/scripts) and run a JSON
linter/validator to ensure the file remains valid.

"check:lint": "eslint . --max-warnings 10",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
Expand All @@ -20,11 +20,14 @@
"keywords": [],
"author": "",
"dependencies": {
"@dotenvx/dotenvx": "^1.49.0",
"@hocuspocus/extension-database": "^2.15.0",
"@hocuspocus/extension-logger": "^2.15.0",
"@hocuspocus/extension-redis": "^2.15.0",
"@hocuspocus/server": "^2.15.0",
"@plane/decorators": "workspace:*",
"@plane/editor": "workspace:*",
"@plane/logger": "workspace:*",
"@plane/types": "workspace:*",
"@tiptap/core": "^2.22.3",
"@tiptap/html": "^2.22.3",
Expand All @@ -42,7 +45,8 @@
"uuid": "catalog:",
"y-prosemirror": "^1.2.15",
"y-protocols": "^1.0.6",
"yjs": "^13.6.20"
"yjs": "^13.6.20",
"zod": "^3.25.76"
},
"devDependencies": {
"@plane/eslint-config": "workspace:*",
Expand All @@ -54,6 +58,7 @@
"@types/node": "^20.14.9",
"@types/pino-http": "^5.8.4",
"@types/uuid": "^9.0.1",
"@types/ws": "^8.18.1",
"concurrently": "^9.0.1",
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
Expand Down
14 changes: 0 additions & 14 deletions apps/live/src/ce/lib/fetch-document.ts

This file was deleted.

15 changes: 0 additions & 15 deletions apps/live/src/ce/lib/update-document.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/live/src/ce/types/common.d.ts

This file was deleted.

33 changes: 33 additions & 0 deletions apps/live/src/controllers/collaboration.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Hocuspocus } from "@hocuspocus/server";
import type { Request } from "express";
import type WebSocket from "ws";
// plane imports
import { Controller, WebSocket as WSDecorator } from "@plane/decorators";
import { logger } from "@plane/logger";

@Controller("/collaboration")
export class CollaborationController {
[key: string]: unknown;
private readonly hocusPocusServer: Hocuspocus;

constructor(hocusPocusServer: Hocuspocus) {
this.hocusPocusServer = hocusPocusServer;
}

@WSDecorator("/")
handleConnection(ws: WebSocket, req: Request) {
try {
// Initialize the connection with Hocuspocus
this.hocusPocusServer.handleConnection(ws, req);

// Set up error handling for the connection
ws.on("error", (error: Error) => {
logger.error("WebSocket connection error:", error);
ws.close(1011, "Internal server error");
});
} catch (error) {
logger.error("WebSocket connection error:", error);
ws.close(1011, "Internal server error");
}
}
}
37 changes: 37 additions & 0 deletions apps/live/src/controllers/convert-document.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Request, Response } from "express";
// plane imports
import { Controller, Post } from "@plane/decorators";
import { logger } from "@plane/logger";
// types
import type { TConvertDocumentRequestBody } from "@/types";
// utils
import { convertHTMLDocumentToAllFormats } from "@/utils";

@Controller("/convert-document")
export class ConvertDocumentController {
@Post("/")
handleConvertDocument(req: Request, res: Response) {
const { description_html, variant } = req.body as TConvertDocumentRequestBody;
try {
if (typeof description_html !== "string" || variant === undefined) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Endpoint Validation Issues Cause Unexpected Behavior

The handleConvertDocument endpoint's input validation has two issues. The variant field isn't validated against its allowed values, potentially passing unexpected input to convertHTMLDocumentToAllFormats. Also, the description_html validation now strictly checks for string type, which is a breaking change from previous undefined checks and could reject requests that were previously considered valid.

Fix in Cursor Fix in Web

res.status(400).json({
message: "Missing required fields",
});
return;
}
const { description, description_binary } = convertHTMLDocumentToAllFormats({
document_html: description_html,
variant,
});
res.status(200).json({
description,
description_binary,
});
} catch (error) {
logger.error("Error in /convert-document endpoint:", error);
res.status(500).json({
message: `Internal server error.`,
});
}
}
}
15 changes: 15 additions & 0 deletions apps/live/src/controllers/health.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Request, Response } from "express";
import { Controller, Get } from "@plane/decorators";
import { env } from "@/env";

@Controller("/health")
export class HealthController {
@Get("/")
async healthCheck(_req: Request, res: Response) {
res.status(200).json({
status: "OK",
timestamp: new Date().toISOString(),
version: env.APP_VERSION,
});
}
}
5 changes: 5 additions & 0 deletions apps/live/src/controllers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { CollaborationController } from "./collaboration.controller";
import { ConvertDocumentController } from "./convert-document.controller";
import { HealthController } from "./health.controller";

export const CONTROLLERS = [CollaborationController, ConvertDocumentController, HealthController];
117 changes: 0 additions & 117 deletions apps/live/src/core/extensions/index.ts

This file was deleted.

44 changes: 0 additions & 44 deletions apps/live/src/core/helpers/convert-document.ts

This file was deleted.

18 changes: 0 additions & 18 deletions apps/live/src/core/helpers/error-handler.ts

This file was deleted.

Loading
Loading