Skip to content
Draft
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
29 changes: 29 additions & 0 deletions .dependency-cruiser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@ module.exports = {
from: { path: '(^|/)src/(routes|ui)/' },
to: { path: '(^|/)src/common/database\\.ts$' },
},
{
name: 'domain-no-outward-deps',
comment:
'domain is the hexagon center: pure business logic with zero dependency on application, ' +
'infrastructure, any app, or Electron/transport libs. Everything else depends on domain, never ' +
'the reverse.',
severity: 'warn',
from: { path: '^domain/' },
to: { path: '^(application|infrastructure|apps)/|^(node_modules/)?electron($|/)' },
},
{
name: 'application-domain-only',
comment:
'application orchestrates domain entities/repositories and depends on domain only - never ' +
'infrastructure (concrete adapters) or a specific app.',
severity: 'warn',
from: { path: '^application/' },
to: { path: '^(infrastructure|apps)/' },
},
{
name: 'infrastructure-no-application-or-apps',
comment:
'infrastructure implements domain-defined ports and depends on domain plus external libs/' +
'Electron/Node - never application (that direction is backwards) or a specific app (infrastructure ' +
'is reached from an app\'s bootstrap/wiring code, not the other way around).',
severity: 'warn',
from: { path: '^infrastructure/' },
to: { path: '^(application|apps)/' },
},
],
options: {
doNotFollow: {
Expand Down
27 changes: 27 additions & 0 deletions application/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"private": true,
"name": "application",
"license": "Apache-2.0",
"version": "13.1.0",
"author": "Kong <office@konghq.com>",
"description": "Use cases that orchestrate domain entities and repositories, plus cross-cutting application-level ports (NetworkClient, TemplatingEngine, Clock, IdGenerator, ...). Depends on domain only.",
"repository": {
"type": "git",
"url": "git+https://github.com/Kong/insomnia.git",
"directory": "application"
},
"bugs": {
"url": "https://github.com/kong/insomnia/issues"
},
"homepage": "https://github.com/Kong/insomnia#readme",
"exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
}
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
"type-check": "tsc --noEmit --project tsconfig.json"
}
}
6 changes: 6 additions & 0 deletions application/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// application: use cases that orchestrate domain entities and repositories, plus
// cross-cutting application-level ports (NetworkClient, TemplatingEngine, Clock,
// IdGenerator, ...). Depends on domain only.
// Populated incrementally, one aggregate at a time.
// eslint-disable-next-line unicorn/require-module-specifiers -- placeholder until real exports land
export {};
20 changes: 20 additions & 0 deletions application/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useUnknownInCatchVariables": false,
"target": "es2022",
"module": "ESNext",
"noEmit": true,
"lib": ["ES2023"]
},
"include": ["src"]
}
27 changes: 27 additions & 0 deletions domain/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"private": true,
"name": "domain",
"license": "Apache-2.0",
"version": "13.1.0",
"author": "Kong <office@konghq.com>",
"description": "Pure business logic - entities, value objects, and the Repository/port interfaces implemented by infrastructure. No I/O, no framework or runtime dependencies.",
"repository": {
"type": "git",
"url": "git+https://github.com/Kong/insomnia.git",
"directory": "domain"
},
"bugs": {
"url": "https://github.com/kong/insomnia/issues"
},
"homepage": "https://github.com/Kong/insomnia#readme",
"exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
}
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
"type-check": "tsc --noEmit --project tsconfig.json"
}
}
5 changes: 5 additions & 0 deletions domain/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// domain: pure business logic - entities, value objects, and the Repository/port
// interfaces implemented by infrastructure. No I/O, no framework or runtime dependencies.
// Populated incrementally, one aggregate at a time.
// eslint-disable-next-line unicorn/require-module-specifiers -- placeholder until real exports land
export {};
20 changes: 20 additions & 0 deletions domain/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useUnknownInCatchVariables": false,
"target": "es2022",
"module": "ESNext",
"noEmit": true,
"lib": ["ES2023"]
},
"include": ["src"]
}
27 changes: 27 additions & 0 deletions infrastructure/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"private": true,
"name": "infrastructure",
"license": "Apache-2.0",
"version": "13.1.0",
"author": "Kong <office@konghq.com>",
"description": "Adapters implementing domain- and application-defined ports (persistence, network, sync, secret storage). Depends on domain plus external libs/Electron/Node. Only reachable from each app's own bootstrap/wiring code, never from route/command logic directly.",
"repository": {
"type": "git",
"url": "git+https://github.com/Kong/insomnia.git",
"directory": "infrastructure"
},
"bugs": {
"url": "https://github.com/kong/insomnia/issues"
},
"homepage": "https://github.com/Kong/insomnia#readme",
"exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
}
},
"scripts": {
"lint": "eslint . --ext .ts,.tsx --cache",
"type-check": "tsc --noEmit --project tsconfig.json"
}
}
6 changes: 6 additions & 0 deletions infrastructure/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// infrastructure: adapters implementing domain- and application-defined ports
// (persistence, network, sync, secret storage). Depends on domain plus external
// libs/Electron/Node. Only reachable from each app's own bootstrap/wiring code.
// Populated incrementally, one aggregate at a time.
// eslint-disable-next-line unicorn/require-module-specifiers -- placeholder until real exports land
export {};
21 changes: 21 additions & 0 deletions infrastructure/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useUnknownInCatchVariables": false,
"target": "es2022",
"module": "ESNext",
"noEmit": true,
"lib": ["ES2023"],
"types": ["node"]
},
"include": ["src"]
}
27 changes: 27 additions & 0 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"workspaces": [
"apps/desktop",
"apps/cli",
"domain",
"application",
"infrastructure",
"packages/insomnia-testing",
"packages/insomnia-data",
"packages/insomnia-analytics",
Expand All @@ -30,9 +33,10 @@
"lint": "npm run lint --workspaces --if-present",
"type-check": "npm run type-check --workspaces --if-present",
"test": "npm run test --workspaces --if-present",
"check-boundaries": "npm run check-boundaries:insomnia-data && npm run check-boundaries:insomnia",
"check-boundaries": "npm run check-boundaries:insomnia-data && npm run check-boundaries:insomnia && npm run check-boundaries:hexagon",
"check-boundaries:insomnia-data": "depcruise packages/insomnia-data/src packages/insomnia-data/node-src packages/insomnia-data/common-src --config .dependency-cruiser.cjs",
"check-boundaries:insomnia": "cd apps/desktop && depcruise src --config ../../.dependency-cruiser.cjs --ts-config tsconfig.json",
"check-boundaries:hexagon": "depcruise domain/src application/src infrastructure/src --config .dependency-cruiser.cjs",
"clean": "git clean -dfX",
"install-libcurl-electron": "node-pre-gyp install --directory node_modules/@getinsomnia/node-libcurl --update-binary --runtime=electron --target=43.2.0",
"install-libcurl-node": "node-pre-gyp install --directory node_modules/@getinsomnia/node-libcurl --update-binary --runtime=node --target=24.18.0",
Expand Down
Loading