Skip to content

Commit

Permalink
Refactor NestJS server setup to use Fastify adapter for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
vasapolrittideah committed Jan 8, 2025
1 parent d34323a commit be1f211
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 308 deletions.
Binary file modified bun.lockb
Binary file not shown.
17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"private": true,
"version": "0.0.0",
"type": "module",
"packageManager": "[email protected].42",
"packageManager": "[email protected].43",
"scripts": {},
"dependencies": {
"@fastify/autoload": "^6.0.3",
"supabase": "^2.2.1",
"turbo": "^2.3.3"
},
"devDependencies": {
"@eslint/compat": "^1.2.4",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.17.0",
"@types/bun": "latest",
"check-file": "^1.1.2",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -26,7 +28,10 @@
"eslint-plugin-react-refresh": "^0.4.16",
"eslint-plugin-storybook": "^0.11.2",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9"
"prettier-plugin-tailwindcss": "^0.6.9",
"typescript-eslint": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest"
},
"eslintConfig": {
"extends": [
Expand All @@ -35,5 +40,11 @@
"plugin:storybook/recommended"
]
},
"workspaces": ["packages/*"]
"workspaces": [
"packages/*"
],
"module": "index.ts",
"peerDependencies": {
"typescript": "^5.0.0"
}
}
47 changes: 25 additions & 22 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "",
"private": true,
"license": "UNLICENSED",
"packageManager": "[email protected].42",
"packageManager": "[email protected].43",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
Expand All @@ -21,34 +21,37 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"reflect-metadata": "^0.2.0",
"@fastify/helmet": "^13.0.1",
"@nestjs/common": "^10.4.15",
"@nestjs/core": "^10.4.15",
"@nestjs/platform-express": "^10.4.15",
"@nestjs/platform-fastify": "^10.4.15",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@nestjs/cli": "^10.4.9",
"@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.15",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^8.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/supertest": "^6.0.2",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
"typescript": "^5.7.2",
"typescript-eslint": "^8.19.1",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest"
},
"jest": {
"moduleFileExtensions": [
Expand Down
9 changes: 8 additions & 1 deletion packages/server/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';

async function bootstrap() {
const app = await NestFactory.create(AppModule);
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter(),
);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
4 changes: 0 additions & 4 deletions supabase/.gitignore

This file was deleted.

Loading

0 comments on commit be1f211

Please sign in to comment.