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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,6 @@ InitTestScene*.unity*

.env
.kilo/
node_modules/
node_modules/
*.zip
SECURITY_AUDIT.md
278 changes: 253 additions & 25 deletions README.md

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
FROM node:alpine
# Pinned to a Node.js LTS line (24, supported until 2028-04-30) on a supported
# Alpine release (3.24, supported until 2028-06-01). Do not use floating tags
# like "node:alpine".
#
# For fully reproducible builds, also pin the digest:
# docker buildx imagetools inspect node:24-alpine3.24 # copy the "Digest:" line
# FROM node:24-alpine3.24@sha256:<digest>
# and let Renovate/Dependabot bump it, otherwise it never receives updates.
FROM node:24-alpine3.24

ENV NODE_ENV=production

WORKDIR /app

# Update Alpine packages, then remove package-index/cache files in the same layer.
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
# Apply Alpine security updates without leaving a package cache behind.
RUN apk upgrade --no-cache

# Production dependencies only (devDependencies are not installed).
# Omitting lifecycle scripts prevents untrusted packages from running arbitrary code during install.
COPY package*.json ./
RUN npm ci
RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force

COPY --chown=node:node src ./src

COPY src ./src
# Drop root: the "node" user (uid 1000) ships with the official image.
USER node

CMD ["node", "--watch", "src/server.js"]
# No --watch in production. Restarts are handled by Docker's restart policy,
# and `docker compose watch` (sync+restart) covers local development.
CMD ["node", "src/server.js"]
61 changes: 45 additions & 16 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MailMetrix-backend",
"version": "1.1.1",
"version": "1.1.2",
"description": "MailMetrix SMTP and email infrastructure diagnostics backend",
"main": "src/server.js",
"scripts": {
Expand All @@ -9,6 +9,7 @@
"dependencies": {
"dotenv": "^18.0.7",
"express": "^5.3.0",
"express-rate-limit": "^8.7.3",
"nodemailer": "^10.1.1"
}
}
10 changes: 8 additions & 2 deletions backend/src/routes/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ const { generateRecords } = require("../services/generator");

const router = express.Router();

router.post("/", (req, res) => {
router.post("/", async (req, res) => {
try {
const result = generateRecords(req.body || {});
const result = await generateRecords(req.body || {});

// Key generation queue full: tell clients when to retry.
if (result.httpStatus === 503) {
res.set("Retry-After", "5");
}

return res.status(result.httpStatus).json(result.body);
} catch (error) {
console.error("Generator error:", error);
Expand Down
Loading
Loading