Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node-version: [20.10.0]
node-version: [22.14.0]
os: [ubuntu-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-linker=hoisted
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ test/jest-e2e.json
tsconfig.json
tsconfig.build.json
turbo.json
yarn.lock

.eslintrc
.eslintrc.*
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,28 @@ You can clone the full repo and keep only the packages you need in your monorepo

## Get Started

This package uses [yarn](https://yarnpkg.com/) as the workspace `packageManager`.

```
npm install -g yarn
```

Place the shared packages in the `packages` folder & the applications code in the `apps` folder.
If you do not wish to use Turborepo, delete `turbo.json` and remove it from `devDependencies` of the package.json in the root directory.

Install `node_modules`

```
yarn
yarn install
```

Add relavant scripts in the root package.json for the frontend and backend apps of your choice.

Run specific commands,
```
yarn <workspace> run <command>
```

Build, run, lint or test all your apps in one command thanks to [Turborepo's Pipelines](https://turborepo.org/docs/core-concepts/pipelines)

## Support Me
Expand Down
3 changes: 0 additions & 3 deletions apps/express-server/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/express-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM node:20-alpine3.18 AS phase1
FROM node:22.14.0-alpine3.20 AS phase1

WORKDIR /app

Expand Down
5 changes: 5 additions & 0 deletions apps/express-server/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import jsConfig from '@nish1896/eslint-flat-config/js';

export default [
...jsConfig,
];
18 changes: 9 additions & 9 deletions apps/express-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
},
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.0",
"winston": "3.15.0"
"dotenv": "^16.4.7",
"express": "^4.21.2",
"winston": "3.17.0"
},
"devDependencies": {
"@nish1896/eslint-config": "^2.0.5",
"@nish1896/eslint-flat-config": "^1.1.4",
"@types/cors": "^2.8.17",
"@types/node": "^22.7.4",
"eslint": "^8.57.0",
"nodemon": "^3.1.7",
"@types/node": "^22.13.10",
"eslint": "^9.22.0",
"nodemon": "^3.1.9",
"rimraf": "^6.0.1",
"tsc-alias": "^1.8.10",
"tsc-alias": "^1.8.11",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.6.2"
"typescript": "^5.8.2"
}
}
4 changes: 2 additions & 2 deletions apps/express-server/src/routes/auth/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class AuthService {
password
})
.end();
} catch (err) {
res.status(500).send('Internal Server Error');
} catch (error) {
res.status(500).send(`Internal Server Error: ${JSON.stringify(error)}`);
}
res.end();
}
Expand Down
6 changes: 4 additions & 2 deletions apps/express-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"compilerOptions": {
"target": "ES2024",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"baseUrl": "./",
"outDir": "dist",
"rootDir": "src",
"paths": {
"@/*": ["src/*"]
},
"esModuleInterop": true,
"moduleResolution": "node"
"esModuleInterop": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"],
Expand Down
14 changes: 0 additions & 14 deletions apps/nestjs-server/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/nestjs-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM node:20-alpine3.18 as phase1
FROM node:22.14.0-alpine3.20 as phase1

WORKDIR /app

Expand Down
37 changes: 37 additions & 0 deletions apps/nestjs-server/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// @ts-check
import eslint from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import jsConfig from '@nish1896/eslint-flat-config/js';

export default tseslint.config(
{
ignores: ['eslint.config.mjs'],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...jsConfig,
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
ecmaVersion: 5,
sourceType: 'module',
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn'
},
},
);
42 changes: 27 additions & 15 deletions apps/nestjs-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"dev": "nest start --watch",
"prebuild": "rimraf dist",
"build": "nest build",
"start": "NODE_ENV=production node dist/main",
"start:debug": "nest start --debug --watch",
Expand All @@ -17,30 +18,41 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^10.4.4",
"@nestjs/core": "^10.4.4",
"@nestjs/platform-express": "^10.4.4",
"@nestjs/platform-fastify": "^10.4.4",
"@nestjs/common": "^11.0.11",
"@nestjs/core": "^11.0.11",
"@nestjs/platform-express": "^11.0.11",
"@nestjs/platform-fastify": "^11.0.11",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
"rxjs": "^7.8.2"
},
"devDependencies": {
"@nestjs/cli": "^10.4.5",
"@nestjs/schematics": "^10.1.4",
"@nestjs/testing": "^10.4.4",
"@nish1896/eslint-config": "^2.0.5",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.4",
"@eslint/eslintrc": "^3.3.0",
"@eslint/js": "^9.22.0",
"@nestjs/cli": "^11.0.5",
"@nestjs/schematics": "^11.0.2",
"@nestjs/testing": "^11.0.11",
"@nish1896/eslint-flat-config": "^1.1.4",
"@swc/cli": "^0.6.0",
"@swc/core": "^1.10.8",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.13.10",
"@types/supertest": "^6.0.2",
"eslint": "^8.57.0",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.3",
"globals": "^16.0.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-jest": "^29.2.6",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.6.2"
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.1"
},
"jest": {
"moduleFileExtensions": [
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { HomeModule } from './routes';
@Module({
imports: [HomeModule],
controllers: [],
providers: []
providers: [],
})
export class AppModule {}
17 changes: 10 additions & 7 deletions apps/nestjs-server/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NestFactory } from '@nestjs/core';
import {
FastifyAdapter,
NestFastifyApplication
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { AppModule } from './app.module';

Expand All @@ -15,20 +15,23 @@ async function bootstrap() {
// const app = await NestFactory.create(AppModule);

/**
* Unfortunately NestJs prod build with fastify, works on local
* Unfortunately NestJs prod build with fastify, works on local
* machine, but it does not port map on docker...
*
* Soln link -
*
* Soln link -
* https://stackoverflow.com/questions/66086427/docker-container-with-nodejs-appnestjs-is-not-accessible-from-both-other-conta
*/
*/
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({
ignoreTrailingSlash: true,
caseSensitive: false
caseSensitive: false,
})
);
await app.listen(4000, '0.0.0.0');
}

bootstrap();
bootstrap().catch(error => {
console.error('Error during app startup: ', error);
process.exit(1);
});
2 changes: 1 addition & 1 deletion apps/nestjs-server/src/routes/home/controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('HomeController', () => {
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [HomeController],
providers: [HomeService]
providers: [HomeService],
}).compile();

homeController = app.get<HomeController>(HomeController);
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/src/routes/home/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { HomeService } from './service';

@Module({
controllers: [HomeController],
providers: [HomeService]
providers: [HomeService],
})
export class HomeModule {}
23 changes: 16 additions & 7 deletions apps/nestjs-server/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import * as request from 'supertest';
import { App } from 'supertest/types';
import { AppModule } from './../src/app.module';

describe('AppController (e2e)', () => {
let app: INestApplication;
let app: INestApplication<App>;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule] }).compile();
beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();

app = moduleFixture.createNestApplication();
await app.init();
});

it('/ (GET)', () =>
request(app.getHttpServer()).get('/')
afterAll(async () => {
await app.close();
});

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!'));
.expect('Hello World!');
});
});
7 changes: 0 additions & 7 deletions apps/next-client/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions apps/next-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine3.18 AS base
FROM node:22.14.0-alpine3.20 AS base

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine
# to understand why libc6-compat might be needed.
Expand All @@ -11,7 +11,7 @@ WORKDIR /app
RUN mkdir -p apps/next-client

COPY --chown=node:node package.json .
COPY --chown=node:node yarn.lock .
COPY --chown=node:node yarn-lock.yaml .
COPY --chown=node:node ./apps/next-client/package.json ./apps/next-client

# Install dependencies
Expand Down
Loading