Last active
July 27, 2021 19:33
-
-
Save jasonblanchard/e45952d96d4f55e6f37828b05a8911f9 to your computer and use it in GitHub Desktop.
Revisions
-
jasonblanchard revised this gist
Jul 27, 2021 . No changes.There are no files selected for viewing
-
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ``` root ├── core - core application logic. Things in here have no knowledge of stores nor interaction ingress/egress │ ├── entities.ts -- domain entities shared throughout the core logic │ └── someFn.ts -- some (probably pure) function that does some business logic. ├── store -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ``` root ├── *core* - core application logic. Things in here have no knowledge of stores nor interaction ingress/egress │ ├── entities.ts -- domain entities shared throughout the core logic │ └── someFn.ts -- some (probably pure) function that does some business logic. ├── store -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # App Structure ``` root ├── core - core application logic. Things in here have no knowledge of stores nor interaction ingress/egress @@ -6,12 +8,15 @@ root ├── store │ ├── SqlStore.ts -- given a DB connection, issues queries and returns plain 'old objects. You could also go nuts and define these as interfaces alongside concrete instances to allow for mocked instances in tests or pre-prod envs. │ └── ObjectStore.ts -- given object store client, issues requests to CRUD files, returns plain 'old objects ├── app.ts - this is all the stuff that your app can do. Wires together `core` and `store`, gets used └── cmd - all interaction ingress/egress. It's how your app gets used. ├── cli │ └── index.ts -- do all the CLI flag parsing in here, calls functions on App ├── http └── index.ts -- do all the HTTP req/res flag parsing in here, calls functions on App ``` `root` _may_ be the actual `src/` root of the project. Your project may also contain multiple of these that encapsulate different application "domains" in a single project. In that case, you may move `cmd` up a level and wire together multiple `app`s. ## Inspiration - https://netflixtechblog.com/ready-for-changes-with-hexagonal-architecture-b315ec967749 -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ ``` root ├── core - core application logic. Things in here have no knowledge of stores nor interaction ingress/egress │ ├── entities.ts -- domain entities shared throughout the core logic │ └── someFn.ts -- some (probably pure) function that does some business logic. ├── store │ ├── SqlStore.ts -- given a DB connection, issues queries and returns plain 'old objects. You could also go nuts and define these as interfaces alongside concrete instances to allow for mocked instances in tests or pre-prod envs. │ └── ObjectStore.ts -- given object store client, issues requests to CRUD files, returns plain 'old objects ├── app.ts - this is all the stuff that your app can do. Wires together `core` and `store`. └── cmd - all interaction ingress/egress. It's how your app gets used. ├── cli │ └── index.ts -- do all the CLI flag parsing in here, calls functions on App ├── http -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 14 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,17 @@ ``` root ├── core │ ├── entities.ts -- domain entities shared throughout the app │ └── someFn.ts -- some (probably pure) function that does some business logic ├── store │ ├── SqlStore.ts -- given a DB connection, issues queries and returns plain 'old objects │ └── ObjectStore.ts -- given object store client, issues requests to CRUD files, returns plain 'old objects ├── app.ts - this is all the stuff that your app can do. Wires together `core` and `store`. └── cmd ├── cli │ └── index.ts -- do all the CLI flag parsing in here, calls functions on App ├── http └── index.ts -- do all the HTTP req/res flag parsing in here, calls functions on App ``` `root` _may_ be the actual `src/` root of the project. Your project may also contain multiple of these that encapsulate different application "domains" in a single project. In that case, you may move `cmd` up a level and wire together multiple `app`s. -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ``` src ├── app.pl ├── cmd @@ -17,3 +18,4 @@ src └── knexfile.ts 3 directories, 13 files ``` -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 19 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,19 @@ src ├── app.pl ├── cmd │ └── cli.ts ├── core │ ├── dayToUTCDateRange.test.ts │ ├── dayToUTCDateRange.ts │ ├── entities.ts │ ├── findMatchedDates.test.ts │ ├── findMatchedDates.ts │ ├── generatePeriodKey.test.ts │ ├── generatePeriodKey.ts │ ├── generateSnapshotMetrics.test.ts │ └── generateSnapshotMetrics.ts └── store ├── SqlStore.ts └── knexfile.ts 3 directories, 13 files -
jasonblanchard revised this gist
Jul 27, 2021 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,2 @@ -> asdf -> sdfasdf -
jasonblanchard created this gist
Jul 27, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ . +-- cmd +-- core