Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# App config files (must be mounted at runtime)
keypair_*.pem
.env

# macOS
.DS_Store

# Build artifacts
node_modules
dist
coverage
.nyc_output
openapi_exported.json

# Editor
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Debug logs
*.log

# Git
.git
.github
.gitignore
.husky

# Test files (not needed in production image)
test/
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
FROM node:20-alpine
FROM oven/bun:alpine

ENV RUNTIME_ENV=container
ENV TRUST_PROXY="uniquelocal"
ENV HTTP_HOSTNAME="0.0.0.0"
ENV RUNTIME_ENV="container"

RUN adduser -u 3000 -D recv
RUN addgroup \
-g 3000 \
recv
RUN adduser -HD \
-u 3000 \
-G recv \
-h /app \
recv

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The addgroup and adduser commands can be combined into a single RUN instruction to reduce the number of layers in the Docker image. This is a common optimization practice.

RUN addgroup -g 3000 recv && \
    adduser -HD -u 3000 -G recv -h /app recv


RUN mkdir -p /.npm /workplace
WORKDIR /workplace
ADD . /workplace

RUN chown -R \
3000:3000 \
/.npm /workplace
WORKDIR /app
RUN chown 3000:3000 /app

USER 3000
RUN npm install

COPY --chown=3000:3000 package.json ./
RUN bun install --production

COPY --chown=3000:3000 . .

EXPOSE 3000
CMD ["npm", "start"]
CMD ["bun", "start"]
66 changes: 0 additions & 66 deletions app.js

This file was deleted.

1,672 changes: 1,672 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

File renamed without changes.
32 changes: 0 additions & 32 deletions export_openapi.js

This file was deleted.

18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
"main": "app.js",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The main field still points to app.js, which has been deleted in this refactoring. While it might not be used since you're running the app with bun src/index.ts, it's good practice to keep this field accurate. You could either remove it or point it to the new entry point.

Suggested change
"main": "app.js",
"main": "src/index.ts",

"scripts": {
"export-openapi": "node export_openapi.js",
"dev": "nodemon app.js",
"start": "node app.js",
"lint": "npx lint-staged",
"lint:es": "eslint \"*.js\" \"src/**/*.js\"",
"dev": "bun --hot src/index.ts",
"start": "bun src/index.ts",
"lint": "eslint src --ext .ts",
"lint:es:fix": "eslint \"*.js\" \"src/**/*.js\" --fix",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The lint:es:fix script targets .js files, which are largely removed in this refactor. It should be updated to work with .ts files to remain useful.

Suggested change
"lint:es:fix": "eslint \"*.js\" \"src/**/*.js\" --fix",
"lint:es:fix": "eslint src --ext .ts --fix",

"test": "mocha test --exit --recursive --timeout 5000",
"test": "bun test",
"cover": "nyc mocha test --recursive --timeout 5000 --exit",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The cover script uses nyc and mocha, which may be outdated with the migration to Bun. Bun has built-in support for code coverage via bun test --coverage. You should update this script to use the new toolchain.

Suggested change
"cover": "nyc mocha test --recursive --timeout 5000 --exit",
"cover": "bun test --coverage",

"prepare": "husky install"
},
"lint-staged": {
"*.js": "eslint"
},
Comment on lines 17 to 19

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The lint-staged configuration is still set up for .js files. It should be updated to lint .ts files to be effective with the new TypeScript codebase.

Suggested change
"lint-staged": {
"*.js": "eslint"
},
"lint-staged": {
"*.ts": "eslint"
},

"dependencies": {
"@elysiajs/cors": "^1.4.2",
"@elysiajs/swagger": "^1.3.1",
"@simplewebauthn/server": "^11.0.0",
"@simplewebauthn/types": "^11.0.0",
"@sinclair/typebox": "^0.34.49",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"elysia": "^1.4.28",
"elysia-rate-limit": "^4.6.1",
"express": "^4.18.2",
"express-validator": "^6.14.3",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dependencies express and express-validator appear to be unused after migrating to ElysiaJS. They should be removed to keep the dependency list clean and reduce the project's size.

"http-status-codes": "^2.2.0",
Expand All @@ -40,6 +44,10 @@
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^25.6.2",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The version ^25.6.2 for @types/node is invalid as there is no Node.js version 25. This will cause package installation to fail. You should use a version compatible with your target Node/Bun environment, such as ^20.0.0.

Suggested change
"@types/node": "^25.6.2",
"@types/node": "^20.14.2",

"@types/nodemailer": "^8.0.0",
"@types/ua-parser-js": "^0.7.39",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.17.0",
"eslint-config-google": "^0.14.0",
Expand Down
126 changes: 0 additions & 126 deletions src/config.js

This file was deleted.

Loading