Skip to content

Commit 3f707a7

Browse files
Merge pull request #56 from NexGenStudioDev/Dev
Dev
2 parents ea43319 + e5778f5 commit 3f707a7

32 files changed

Lines changed: 1366 additions & 51 deletions

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged
5+

.prettierignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Dependencies
2+
node_modules
3+
**/node_modules
4+
pnpm-lock.yaml
5+
package-lock.json
6+
yarn.lock
7+
8+
# Build outputs
9+
dist
10+
build
11+
.next
12+
.nuxt
13+
out
14+
*.tsbuildinfo
15+
16+
# Coverage
17+
coverage
18+
.nyc_output
19+
20+
# Logs
21+
*.log
22+
logs
23+
24+
# Environment files
25+
.env
26+
.env.local
27+
.env.*.local
28+
29+
# Cache
30+
.cache
31+
.parcel-cache
32+
.turbo
33+
34+
# OS files
35+
.DS_Store
36+
Thumbs.db
37+
38+
# IDE
39+
.vscode
40+
.idea
41+
42+
# Git
43+
.git
44+
45+
# Generated files
46+
*.min.js
47+
*.min.css
48+
49+
# Lock files
50+
pnpm-lock.yaml
51+
package-lock.json
52+
yarn.lock
53+

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100,
7+
"arrowParens": "avoid",
8+
"endOfLine": "lf",
9+
"bracketSpacing": true,
10+
"jsxSingleQuote": false
11+
}
12+

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"esbenp.prettier-vscode",
4+
"dbaeumer.vscode-eslint",
5+
"bradlc.vscode-tailwindcss"
6+
]
7+
}
8+

.vscode/settings.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": "explicit"
6+
},
7+
"[typescript]": {
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
"[typescriptreact]": {
11+
"editor.defaultFormatter": "esbenp.prettier-vscode"
12+
},
13+
"[javascript]": {
14+
"editor.defaultFormatter": "esbenp.prettier-vscode"
15+
},
16+
"[json]": {
17+
"editor.defaultFormatter": "esbenp.prettier-vscode"
18+
},
19+
"[jsonc]": {
20+
"editor.defaultFormatter": "esbenp.prettier-vscode"
21+
},
22+
"eslint.validate": [
23+
"javascript",
24+
"javascriptreact",
25+
"typescript",
26+
"typescriptreact"
27+
],
28+
"prettier.requireConfig": true,
29+
"typescript.tsdk": "node_modules/typescript/lib",
30+
"typescript.enablePromptUseWorkspaceTsdk": true
31+
}
32+

Dockerfile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# ============================================
2+
# Multi-stage Dockerfile for LocalMind
3+
# Builds both frontend and backend, serves from single container
4+
# ============================================
5+
6+
# ============================================
7+
# Stage 1: Build Frontend
8+
# ============================================
9+
FROM node:20-alpine AS frontend-builder
10+
11+
WORKDIR /app/frontend
12+
13+
# Install pnpm globally
14+
RUN npm install -g pnpm@latest
15+
16+
# Copy frontend package files
17+
COPY LocalMind-Frontend/package.json LocalMind-Frontend/pnpm-lock.yaml ./
18+
19+
# Install frontend dependencies
20+
RUN pnpm install --frozen-lockfile
21+
22+
# Copy frontend source code
23+
COPY LocalMind-Frontend/ ./
24+
25+
# Build frontend for production
26+
RUN pnpm run build
27+
28+
# ============================================
29+
# Stage 2: Build Backend
30+
# ============================================
31+
FROM node:20-alpine AS backend-builder
32+
33+
WORKDIR /app/backend
34+
35+
# Install pnpm globally
36+
RUN npm install -g pnpm@latest
37+
38+
# Copy backend package files
39+
COPY LocalMind-Backend/package.json LocalMind-Backend/pnpm-lock.yaml ./
40+
41+
# Install backend dependencies
42+
RUN pnpm install --frozen-lockfile
43+
44+
# Copy backend source code
45+
COPY LocalMind-Backend/ ./
46+
47+
# Build backend (compile TypeScript to JavaScript)
48+
RUN pnpm run build
49+
50+
# ============================================
51+
# Stage 3: Production Image
52+
# ============================================
53+
FROM node:20-alpine
54+
55+
# Install dumb-init for proper signal handling
56+
RUN apk add --no-cache dumb-init
57+
58+
# Create non-root user for security
59+
RUN addgroup -g 1001 -S localmind && \
60+
adduser -S localmind -u 1001
61+
62+
WORKDIR /app
63+
64+
# Copy backend dependencies and built files
65+
COPY --from=backend-builder /app/backend/package.json ./
66+
COPY --from=backend-builder /app/backend/pnpm-lock.yaml ./
67+
COPY --from=backend-builder /app/backend/node_modules ./node_modules
68+
COPY --from=backend-builder /app/backend/dist ./dist
69+
COPY --from=backend-builder /app/backend/types ./types
70+
71+
# Copy built frontend files to serve statically
72+
COPY --from=frontend-builder /app/frontend/dist ./public
73+
74+
# Create directories for uploads and data
75+
RUN mkdir -p /app/uploads /app/data && \
76+
chown -R localmind:localmind /app
77+
78+
# Switch to non-root user
79+
USER localmind
80+
81+
# Expose application port
82+
EXPOSE 3000
83+
84+
# Health check
85+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
86+
CMD node -e "require('http').get('http://localhost:3000/', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
87+
88+
# Use dumb-init to handle signals properly
89+
ENTRYPOINT ["dumb-init", "--"]
90+
91+
# Start the application
92+
CMD ["node", "dist/server.js"]
93+

LocalMind-Backend/.dockerignore

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Dependencies
2+
node_modules
3+
pnpm-lock.yaml
4+
package-lock.json
5+
yarn.lock
6+
7+
# Build outputs
8+
dist
9+
build
10+
.next
11+
.nuxt
12+
out
13+
14+
# Development files
15+
.env
16+
.env.local
17+
.env.development
18+
.env.test
19+
.env.production
20+
.env.*.local
21+
22+
# Git
23+
.git
24+
.gitignore
25+
.gitattributes
26+
27+
# IDEs
28+
.vscode
29+
.idea
30+
*.swp
31+
*.swo
32+
*~
33+
.DS_Store
34+
35+
# Logs
36+
logs
37+
*.log
38+
npm-debug.log*
39+
yarn-debug.log*
40+
yarn-error.log*
41+
pnpm-debug.log*
42+
lerna-debug.log*
43+
44+
# Testing
45+
coverage
46+
.nyc_output
47+
test-results
48+
*.spec.ts
49+
*.test.ts
50+
__tests__
51+
__mocks__
52+
__test__
53+
54+
# Temporary files
55+
tmp
56+
temp
57+
.cache
58+
.parcel-cache
59+
60+
# OS files
61+
Thumbs.db
62+
.DS_Store
63+
Desktop.ini
64+
65+
# Documentation
66+
README.md
67+
CONTRIBUTING.md
68+
LICENSE
69+
*.md
70+
!package.json
71+
72+
# CI/CD
73+
.github
74+
.gitlab-ci.yml
75+
.travis.yml
76+
azure-pipelines.yml
77+
78+
# Docker
79+
Dockerfile
80+
docker-compose.yml
81+
.dockerignore
82+
83+
# Scripts
84+
setup-cloudflare.sh
85+
a.md
86+
87+
# Prettier/ESLint
88+
.prettierrc
89+
.prettierignore
90+
.eslintrc*
91+
eslint.config.js
92+
93+
# TypeScript config (not needed in runtime)
94+
tsconfig*.json
95+
96+
# Jest config
97+
jest.config.ts
98+
99+
# Uploads and data (should be volumes)
100+
uploads
101+
data
102+

LocalMind-Backend/.prettierignore

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1-
# Ignore artifacts:
1+
# Dependencies
2+
node_modules
3+
pnpm-lock.yaml
4+
package-lock.json
5+
6+
# Build outputs
7+
dist
28
build
39
coverage
10+
.nyc_output
11+
12+
# Logs
13+
*.log
14+
logs
15+
16+
# Environment files
17+
.env
18+
.env.local
19+
20+
# Cache
21+
.cache
22+
23+
# OS files
24+
.DS_Store
25+
26+
# IDE
27+
.vscode
28+
.idea
29+
30+
# Git
31+
.git

LocalMind-Backend/.prettierrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
{}
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100,
7+
"arrowParens": "avoid",
8+
"endOfLine": "lf"
9+
}

0 commit comments

Comments
 (0)