feat: scaffold writing-platform Express + TypeScript backend

- Initialize npm project with express, cors, jsonwebtoken, dotenv, socket.io, openai, uuid
- Configure TypeScript with strict mode, ES2020 target, declarations and source maps
- Create src directory structure: routes/, middleware/, services/, models/
- Add minimal server.ts with health check at /api/writing/health (port 3100)
- Add .gitignore for node_modules, dist, .env

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-25 12:46:46 +00:00
parent 143795f3c1
commit 6f22eca607
9 changed files with 1998 additions and 0 deletions

3
writing-platform/backend/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
dist/
.env

1915
writing-platform/backend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon --exec ts-node src/server.ts",
"build": "tsc",
"start": "node dist/server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"dependencies": {
"cors": "^2.8.6",
"dotenv": "^17.3.1",
"express": "^5.2.1",
"jsonwebtoken": "^9.0.3",
"openai": "^6.32.0",
"socket.io": "^4.8.3",
"uuid": "^13.0.0"
},
"devDependencies": {
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^25.5.0",
"nodemon": "^3.1.14",
"ts-node": "^10.9.2",
"typescript": "^6.0.2"
}
}

View File

@ -0,0 +1,28 @@
import express from 'express';
import cors from 'cors';
import http from 'http';
import dotenv from 'dotenv';
dotenv.config();
const app = express();
const server = http.createServer(app);
app.use(cors());
app.use(express.json());
app.get('/api/writing/health', (_req, res) => {
res.json({
status: 'ok',
service: 'writing-platform-backend',
timestamp: new Date().toISOString(),
});
});
const PORT = process.env.PORT || 3100;
server.listen(PORT, () => {
console.log(`Writing platform backend running on port ${PORT}`);
});
export { app, server };

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}