Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Last active July 27, 2021 19:33
Show Gist options
  • Save jasonblanchard/e45952d96d4f55e6f37828b05a8911f9 to your computer and use it in GitHub Desktop.
Save jasonblanchard/e45952d96d4f55e6f37828b05a8911f9 to your computer and use it in GitHub Desktop.

Revisions

  1. jasonblanchard revised this gist Jul 27, 2021. No changes.
  2. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion appstructure.md
    Original 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
    ├── 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
  3. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion appstructure.md
    Original 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
    ├── *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
  4. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions appstructure.md
    Original 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`.
    ├── 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.
    `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
  5. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions appstructure.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    ```
    root
    ├── core
    │   ├── entities.ts -- domain entities shared throughout the app
    │   └── someFn.ts -- some (probably pure) function that does some business logic
    ├── 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
    │ ├── 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
    └── 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
  6. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 14 additions and 18 deletions.
    32 changes: 14 additions & 18 deletions appstructure.md
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,17 @@
    ```
    src
    ├── app.pl
    ├── cmd
    │   └── cli.ts
    root
    ├── 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
    │   ├── 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
    ```

    3 directories, 13 files
    ```
    `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.
  7. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions appstructure.md
    Original 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
    ```
  8. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 19 additions and 2 deletions.
    21 changes: 19 additions & 2 deletions appstructure.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,19 @@
    -> asdf
    -> sdfasdf
    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
  9. jasonblanchard revised this gist Jul 27, 2021. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions appstructure.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,2 @@
    .
    +-- cmd
    +-- core
    -> asdf
    -> sdfasdf
  10. jasonblanchard created this gist Jul 27, 2021.
    3 changes: 3 additions & 0 deletions appstructure.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    .
    +-- cmd
    +-- core