Everything else remains the same (Create a new project, add typescript, add express…)
The only thing that’s different is that tsc doesn’t perform great with turborepo
You can use either tsup or esbuild for building your backend application
apps/backendnpm init -y
npx tsc --init
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"lib": ["ES2015"],
"module": "CommonJS",
"outDir": "./dist",
},
"exclude": ["node_modules"],
"include": ["."]
}
npm i express @types/express
src/index.tsimport express from "express";
const app = express()
app.get("/", (req, res) => {
res.json({
message: "hello world"
});
})
{
"extends": ["//"],
"pipeline": {
"build": {
"outputs": ["dist/**"]
}
}
}
npm install esbuild
"build": "esbuild src/index.ts --platform=node --bundle --outdir=dist"