Skip to content

Migrate backend from Node.js/TypeScript/Express to Java Spring Boot#1

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/vscode-mn3hxd3g-tc20
Draft

Migrate backend from Node.js/TypeScript/Express to Java Spring Boot#1
Copilot wants to merge 2 commits into
mainfrom
copilot/vscode-mn3hxd3g-tc20

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 23, 2026

Replaces the entire backend/ with a Java 17 + Spring Boot 3.4 application, preserving all existing API contracts so the React frontend requires no changes.

Replaced stack

  • Runtime: Node.js + TypeScript → Java 17
  • Framework: Express → Spring Boot (Spring Web, Spring Security)
  • ODM/ORM: Mongoose → Spring Data MongoDB
  • JWT: jsonwebtoken → JJWT 0.12.6
  • Validation: Zod → Jakarta Bean Validation
  • Password hashing: bcrypt npm → BCryptPasswordEncoder
  • Build: package.json / tsc → Maven (pom.xml)

Project structure

backend/
├── pom.xml
└── src/main/java/com/secondbrain/
    ├── SecondBrainApplication.java
    ├── config/SecurityConfig.java          # CORS, stateless JWT, route auth rules
    ├── security/{JwtUtil,JwtAuthFilter}.java
    ├── model/{User,Content,Link}.java      # @Document mapped to existing collections
    ├── repository/*Repository.java         # Spring Data MongoRepository interfaces
    ├── dto/{Signup,Signin,Content,Share}Request.java
    ├── controller/{User,Content,Share,Root}Controller.java
    └── util/RandomUtil.java                # Same char set as original utils.ts

API compatibility preserved

All endpoints and response shapes are identical. Intentional backward-compat decisions:

  • authorization header read as a bare token (no `****** prefix) — matches existing frontend
  • Env var JWT_SECREAT (original typo) kept to avoid breaking deployed configurations
  • contenetId (typo) preserved in DELETE /api/v1/content request body
  • HTTP 411 responses on share lookup failures match original behavior

Security note

CSRF protection is disabled — correct for this stateless JWT/Authorization-header API (no cookies). CodeQL flags this; it is a false positive in this context.

Configuration

spring.data.mongodb.uri=${MONGODB_URI:mongodb://localhost:27017/secondbrain}
server.port=${PORT:3000}
jwt.secret=${JWT_SECREAT:change-this-secret-in-production}

Same environment variables as the original .env.

Original prompt

hey can you change this code base from node ts express to java spring boot completely

Created from VS Code.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
second-brain Error Error Mar 23, 2026 6:18pm
second-brain-dkkx Ready Ready Preview, Comment Mar 23, 2026 6:18pm

Copilot AI changed the title [WIP] Refactor code base from Node TS Express to Java Spring Boot Migrate backend from Node.js/TypeScript/Express to Java Spring Boot Mar 23, 2026
Copilot AI requested a review from developerbarun March 23, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants