feat: monorepo workspaces, repo layout, basic CI#24
Conversation
Co-authored-by: aurelianware <194855645+aurelianware@users.noreply.github.com>
Co-authored-by: aurelianware <194855645+aurelianware@users.noreply.github.com>
Co-authored-by: aurelianware <194855645+aurelianware@users.noreply.github.com>
aurelianware
left a comment
There was a problem hiding this comment.
Overall: Great foundation for the monorepo + CI. A few small fixes will make this rock-solid and future-proof.
✅ What’s good
Clear intent: move to npm workspaces and standard layout.
CI uses Node 20 and least-privileged permissions.
❗ Required before merge
Make CI workspace-aware (so scripts run across apps/, services/, packages/).
.github/workflows/ci.yml (replace job steps)
- name: Install deps
run: npm ci - name: Type check
run: npm run -ws type-check --if-present - name: Lint
run: npm run -ws lint --if-present - name: Build
run: npm run -ws build --if-present - name: Test
run: npm run -ws test --if-present - name: Audit (non-blocking)
run: npm audit --audit-level=high || true
Root dispatcher scripts (prevents CI 404s while workspaces are empty).
// package.json (root)
{
"name": "ai-security-monitoring-app",
"private": true,
"workspaces": ["apps/", "services/", "packages/*"],
"scripts": {
"build": "npm run -ws build --if-present",
"test": "npm run -ws test --if-present",
"lint": "npm run -ws lint --if-present",
"type-check": "npm run -ws type-check --if-present",
"security:audit": "npm audit --audit-level=high || true"
},
"engines": { "node": ">=20" }
}
Docs should match current state (mark future components as planned so contributors aren’t confused).
Replace the “Technology Stack” section with:
Planned Technology Stack (roadmap)
These components land in later PRs. This PR only establishes the monorepo layout + CI.
- Auth: NextAuth (OIDC/Entra ID)
- DB/ORM: Prisma (EMR API)
- Client ML demos: TensorFlow.js (COCO-SSD)
- PWA: Workbox
- XR helper app: Electron
👍 Nice to have (can be a follow-up PR)
Add CodeQL so we actually have a security check:
.github/workflows/codeql.yml
name: codeql
on:
push: { branches: [ "main" ] }
pull_request: { branches: [ "main" ] }
schedule: [{ cron: '26 3 * * 3' }]
jobs:
analyze:
permissions: { actions: read, contents: read, security-events: write }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with: { languages: javascript }
- uses: github/codeql-action/analyze@v3
Add .nvmrc or "engines" (included above) to pin Node 20 for contributors.
💬 Rationale (answers reviewers’ likely questions)
Why -ws? Ensures build/test/lint/type-check execute in every workspace as they’re added, preventing silent CI gaps.
Why drop --legacy-peer-deps? It can hide real dependency issues; only add it if we document a specific conflict.
Why dispatcher scripts at root? Keeps CI stable when some packages don’t define a given script yet.
Why mark stack as “planned”? Avoids misleading contributors until those pieces actually land.
✅ Merge checklist
CI updated to use -ws and passes on a clean clone
Root package.json dispatcher scripts present
Architecture doc updated to “Planned Technology Stack (roadmap)”
(Optional) CodeQL workflow added
Once these land, this PR is GTM from my side.
|
Closing: This PR attempts to convert the security monitoring app to a monorepo with clinic features, which doesn't match the current codebase architecture. The repository is actually a single-app security monitoring system using React/TensorFlow.js for real-time object detection. |
Summary
Converts the repository to an npm workspaces monorepo structure with standardized layout and minimal CI workflow. This establishes the foundation for future modularization without moving existing code.
What Changed
Monorepo Structure
Established standard monorepo layout with dedicated directories:
apps/- User-facing applications (prepared for web app in PR ci: bump actions/setup-node from 4 to 5 #2)services/- Backend microservicespackages/- Shared libraries and utilitiesinfra/- Infrastructure as codedocs/- Centralized documentationEach workspace directory includes a README.md explaining its purpose and future structure.
Root Configuration
Updated
package.jsonwith workspace support:{ "name": "ai-security-monitoring-app", "private": true, "workspaces": ["apps/*", "services/*", "packages/*"] }Modified scripts to support both root and workspace execution:
npm run build- Builds root project, then all workspace packagesnpm run test- Runs root tests, then all workspace testsnpm run lint- Lints root and all workspaces--if-presentflag to gracefully handle empty workspacesCI/CD Pipeline
Created
.github/workflows/ci.ymlwith:contents: read) for GITHUB_TOKEN securityDocumentation
Added comprehensive documentation in
/docs:ARCHITECTURE.md- System design overview:SECURITY.md- Security guidelines:DEPLOY.md- Deployment guide:Verification
All checks passing:
Next Steps
As outlined in the plan:
apps/web/This approach minimizes risk by separating infrastructure changes from code migration.
Breaking Changes
None. The existing application continues to build and run exactly as before. Workspace infrastructure is additive.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkpoint.prisma.io/usr/local/bin/node /home/REDACTED/work/ai-security-monitoring-app/ai-security-monitoring-app/node_modules/prisma/build/child {"product":"prisma","version":"6.17.1","cli_install_type":"local","information":"","local_timestamp":"2025-10-15T04:37:48Z","project_hash":"09f815c9","cli_path":"/home/REDACTED/work/ai-security-monitoring-app/ai-security-monitoring-app/node_modules/.bin/prisma","cli_path_hash":"0cad3ab3","endpoint":"REDACTED","disable":false,"arch":"x64","os":"linux","node_version":"v20.19.5","ci":true,"ci_name":"GitHub Actions","command":"generate --postinstall \"UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING\"","schema_providers":["sqlite"],"schema_preview_features":[],"schema_generators_providers":["prisma-client-js"],"cache_file":"/home/REDACTED/.cache/checkpoint-nodejs/prisma-0cad3ab3","cache_duration":43200000,"remind_duration":172800000,"force":false,"timeout":5000,"unref":true,"child_path":"/home/REDACTED/work/ai-security-monitoring-app/ai-security-monitoring-app/node_modules/prisma/build/child","client_event_id":"","previous_client_event_id":"","check_if_update_available":true}(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.