-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: migrate from Express/Node.js to ElysiaJS/Bun #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rolling
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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/ |
| 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 | ||
|
|
||
| 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"] | ||
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,23 +7,27 @@ | |||||
| "main": "app.js", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| "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", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| "test": "mocha test --exit --recursive --timeout 5000", | ||||||
| "test": "bun test", | ||||||
| "cover": "nyc mocha test --recursive --timeout 5000 --exit", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| "prepare": "husky install" | ||||||
| }, | ||||||
| "lint-staged": { | ||||||
| "*.js": "eslint" | ||||||
| }, | ||||||
|
Comment on lines
17
to
19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| "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", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| "http-status-codes": "^2.2.0", | ||||||
|
|
@@ -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", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| "@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", | ||||||
|
|
||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
addgroupandaddusercommands can be combined into a singleRUNinstruction to reduce the number of layers in the Docker image. This is a common optimization practice.