Skip to content

Commit 46e43b3

Browse files
committed
align the project
1 parent 93dba0f commit 46e43b3

100 files changed

Lines changed: 13410 additions & 4717 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Dependencies and build output
2+
node_modules
3+
dist
4+
.pnpm-store
5+
6+
# Git and IDE
7+
.git
8+
.gitignore
9+
.cursor
10+
.vscode
11+
*.code-workspace
12+
13+
# Env and secrets (use runtime env or secrets)
14+
.env
15+
.env.*
16+
!.env.example
17+
18+
# Tests and coverage
19+
coverage
20+
**/__tests__
21+
**/*.test.ts
22+
**/*.spec.ts
23+
jest.config.js
24+
jest.setup.js
25+
26+
# Docs and misc
27+
docs
28+
*.md
29+
!README.md
30+
31+
# CI
32+
.github
33+
34+
# Local and OS
35+
.DS_Store
36+
Thumbs.db
37+
*.log

‎.editorconfig‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# EditorConfig: keep indentation consistent so format-on-save doesn't break spec.ts
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf

‎.eslintrc.cjs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* ESLint config for TypeScript and Node.js (ESLint 8 compatible).
3+
* Ensures consistent style and catches common issues before push/CI.
4+
*/
5+
module.exports = {
6+
root: true,
7+
env: { node: true, es2022: true },
8+
parser: "@typescript-eslint/parser",
9+
parserOptions: { ecmaVersion: 2022, sourceType: "module" },
10+
plugins: ["@typescript-eslint"],
11+
extends: [
12+
"eslint:recommended",
13+
"plugin:@typescript-eslint/recommended",
14+
"prettier",
15+
],
16+
ignorePatterns: ["node_modules", "dist", "*.js", "drizzle", "config/openapi"],
17+
rules: {
18+
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
19+
"@typescript-eslint/no-explicit-any": "warn",
20+
"@typescript-eslint/explicit-function-return-type": "off",
21+
"@typescript-eslint/no-require-imports": "off",
22+
"no-console": ["warn", { allow: ["warn", "error"] }],
23+
},
24+
};

‎.prettierignore‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Dependencies and build
2+
node_modules
3+
dist
4+
build
5+
*.min.js
6+
7+
# Lockfiles and generated
8+
pnpm-lock.yaml
9+
package-lock.json
10+
*.config.js
11+
12+
# Drizzle and migrations (generated)
13+
drizzle/**/*.sql
14+
15+
# Env (secrets)
16+
.env
17+
.env.*
18+
!.env.example
19+
20+
# OpenAPI spec (manual formatting; do not strip curly braces or reformat)
21+
config/openapi/
22+
config/openapi/spec.ts
23+
**/config/openapi/**

‎.prettierrc‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100
7+
}

‎.vscode/settings.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"[typescript]": {
4+
"editor.defaultFormatter": "esbenp.prettier-vscode"
5+
},
6+
"editor.detectIndentation": false,
7+
"editor.tabSize": 2,
8+
"editor.insertSpaces": true,
9+
"prettier.ignorePath": ".prettierignore"
10+
}

‎Dockerfile‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Museum Management REST API — multi-stage build (smallest image)
2+
# =============================================================
3+
# Stage 1: Dependencies and build
4+
FROM node:20-alpine AS builder
5+
6+
RUN corepack enable && corepack prepare pnpm@latest --activate
7+
WORKDIR /app
8+
9+
COPY package.json pnpm-lock.yaml* ./
10+
RUN pnpm install --frozen-lockfile
11+
12+
COPY tsconfig.json ./
13+
COPY index.ts app.ts ./
14+
COPY config config/
15+
COPY middlewares middlewares/
16+
COPY server server/
17+
COPY drizzle.config.ts ./
18+
COPY drizzle drizzle/
19+
20+
RUN pnpm run build
21+
22+
# Prune dev dependencies so runner only gets production node_modules
23+
RUN pnpm prune --prod
24+
25+
# Stage 2: Production runner (minimal: no pnpm, no dev deps)
26+
FROM node:20-alpine AS runner
27+
28+
WORKDIR /app
29+
30+
ENV NODE_ENV=production
31+
ENV PORT=5001
32+
33+
# Copy only runtime artifacts from builder (no source, no devDependencies)
34+
COPY --from=builder /app/package.json ./
35+
COPY --from=builder /app/node_modules ./node_modules
36+
COPY --from=builder /app/dist ./dist
37+
COPY --from=builder /app/drizzle ./drizzle
38+
COPY --from=builder /app/drizzle.config.ts ./
39+
40+
# Non-root user for security
41+
RUN addgroup -g 1001 -S app && adduser -u 1001 -S app -G app
42+
USER app
43+
44+
EXPOSE ${PORT}
45+
46+
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)