Skip to content

Commit

Permalink
Rename "/app" to "/apps" (#38)
Browse files Browse the repository at this point in the history
Using the majority `apps` as name for the `/app` directory [1] conveys a
better understanding of the actual use case and makes it more clear that
it can contain more than one application in the monorepo [2] layout.
This also aligns with the example in the `/web` directory
documentation [3] and the Yarn/NPM workspace configuration in the
`package.json` file [4] where both using the `apps` directory.

[1]: https://github.com/svengreb/tmpl-go/tree/main/app
[2]: https://trunkbaseddevelopment.com/monorepos
[3]: https://github.com/svengreb/tmpl-go/tree/main/web#example
[4]: https://github.com/svengreb/tmpl-go/blob/main/package.json#L24

Closes GH-37
  • Loading branch information
svengreb committed Nov 14, 2020
1 parent 0aec1ae commit 5551df2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The next directory structure shown below is specially designed for Go projects w
```raw
tmpl-go
├─ api
├─ app
├─ apps
├─ config
├─ docs
├─ examples
Expand All @@ -59,7 +59,7 @@ tmpl-go
Please see the [“Features“](#features) section below for more details about provided files in this template repository. The detailed documentation about each directory is located in individual `README.md` files within the directory itself.

- [`/api`][gh-tree-api] — The directory for API definition files like [Protocol Buffers][protobuf], [JSON schemas][json-schema] or [OpenAPI][]/[Swagger][] specifications. See the [dedicated `/api` directory documentation][gh-blob-api-readme] for more details and usage examples.
- [`/app`][gh-tree-app] — The directory for project application(s) using the Go `main` package that can be compiled to the binary executable. See the [dedicated `/app` directory documentation][gh-blob-app-readme] for more details and usage examples.
- [`/apps`][gh-tree-apps] — The directory for project application(s) using the Go `main` package that can be compiled to the binary executable. See the [dedicated `/apps` directory documentation][gh-blob-apps-readme] for more details and usage examples.
- [`/config`][gh-tree-config] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/config` directory documentation][gh-blob-config-readme] for more details and usage examples.
- [`/docs`][gh-tree-docs] — The directory for project documentations, [runbooks][wikip-runbook] and any other kind of textual reference.. See the [dedicated `/docs` directory documentation][gh-blob-docs-readme] for more details and usage examples.
- [`/examples`][gh-tree-examples] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/examples` directory documentation][gh-blob-examples-readme] for more details and usage examples.
Expand Down Expand Up @@ -148,7 +148,7 @@ The guide also includes information about [minimal, complete, and verifiable exa
[dependabot]: https://dependabot.com
[gh-act-ci]: https://github.com/svengreb/tmpl-go/actions?query=workflow%3Aci
[gh-blob-api-readme]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md
[gh-blob-app-readme]: https://github.com/svengreb/tmpl-go/blob/main/app/README.md
[gh-blob-apps-readme]: https://github.com/svengreb/tmpl-go/blob/main/apps/README.md
[gh-blob-config-readme]: https://github.com/svengreb/tmpl-go/blob/main/config/README.md
[gh-blob-docs-readme]: https://github.com/svengreb/tmpl-go/blob/main/docs/README.md
[gh-blob-dot_github-dependabot.yml]: https://github.com/svengreb/tmpl-go/blob/main/.github/dependabot.yml
Expand All @@ -174,7 +174,7 @@ The guide also includes information about [minimal, complete, and verifiable exa
[gh-tmpl#ov]: https://github.com/svengreb/tmpl#overview
[gh-tmpl#usage]: https://github.com/svengreb/tmpl#usage
[gh-tree-api]: https://github.com/svengreb/tmpl-go/tree/main/api
[gh-tree-app]: https://github.com/svengreb/tmpl-go/tree/main/app
[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps
[gh-tree-config]: https://github.com/svengreb/tmpl-go/tree/main/config
[gh-tree-docs]: https://github.com/svengreb/tmpl-go/tree/main/docs
[gh-tree-examples]: https://github.com/svengreb/tmpl-go/tree/main/examples
Expand Down
4 changes: 2 additions & 2 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The `/app` directory stores source code of project application(s) using the Go `main` package that can be compiled to the binary executable. It is often named `/cmd` instead, but because the name is not so appropriate and could lead to false assumptions it has been renamed for this template repository to better describe the actual content.
The `/apps` directory stores source code of project application(s) using the Go `main` package that can be compiled to the binary executable. It is often named `/cmd` instead, but because the name is not so appropriate and could lead to false assumptions it has been renamed for this template repository to better describe the actual content.

## Directory Structure

Expand All @@ -13,7 +13,7 @@ Please see the [example](#example) below for a common and practical usage patter
Given the API defined in the [example of the `/api` directory][gh-blob-api-readme#example] and additionally assuming another service application named `notes-sync` the structure for the application could be created as follows:

```raw
app
apps
├─ notes
│  ├─ config
│  └─ internal
Expand Down
6 changes: 3 additions & 3 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The `/config` directory, also often named `contrib`, stores all configurations of any kind such as…

- …container orchestration deployments — tools like Automated scaling and management systems like [Kubernetes][] or [Docker Compose][docker-compose] as well as tools to manage and process their configurations like [Kustomize][] and [Helm][].
- …application configuration templates — reference, example or starter files that contain default values configurations of applications in the [`/app` directory][gh-tree-app].
- …application configuration templates — reference, example or starter files that contain default values configurations of applications in the [`/apps` directory][gh-tree-apps].
- …platform and distribution specific configurations — basic, platform specific configuration files for distribution or deployment purposes like for example [systemd][] units, process managers/supervisors or reverse proxies.

## Directory Structure
Expand All @@ -14,7 +14,7 @@ Given the [example of the `/api` directory][gh-blob-api-readme#example] the stru

```raw
config
├─ app
├─ apps
│  └─ notes
├─ deployment
│  ├─ docker
Expand Down Expand Up @@ -67,7 +67,7 @@ Next to the experience with own projects and [golang-standards/project-layout][]
[gh-loki-tree-production]: https://github.com/grafana/loki/tree/master/production
[gh-moby-tree-contrib]: https://github.com/moby/moby/tree/master/contrib
[gh-nats-server-tree-docker]: https://github.com/nats-io/nats-server/tree/master/docker
[gh-tree-app]: https://github.com/svengreb/tmpl-go/tree/main/app
[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps
[gh-velero-tree-config]: https://github.com/vmware-tanzu/velero/tree/main/config
[golang-standards/project-layout]: https://github.com/golang-standards/project-layout
[helm]: https://helm.sh
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The `/examples` directory stores examples for provided APIs that are defined in the [`/api` directory][gh-tree-api], public packages from the [`/pkg` directory][gh-tree-pkg], ways to use and run applications from the [`/app` directory][gh-tree-app] or to demonstrate the integration with other applications, platforms or systems.
The `/examples` directory stores examples for provided APIs that are defined in the [`/api` directory][gh-tree-api], public packages from the [`/pkg` directory][gh-tree-pkg], ways to use and run applications from the [`/apps` directory][gh-tree-apps] or to demonstrate the integration with other applications, platforms or systems.

## Directory Structure

Expand All @@ -24,7 +24,7 @@ Next to the experience with own projects and [golang-standards/project-layout][]
[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example
[gh-nats-tree-examples]: https://github.com/nats-io/nats.go/tree/master/examples
[gh-tree-api]: https://github.com/svengreb/tmpl-go/tree/main/api
[gh-tree-app]: https://github.com/svengreb/tmpl-go/tree/main/app
[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps
[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg
[gh-velero-tree-examples]: https://github.com/vmware-tanzu/velero/tree/main/examples
[golang-standards/project-layout]: https://github.com/golang-standards/project-layout
7 changes: 4 additions & 3 deletions internal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ The `/internal` directory stores non-exported (“private“) application and pa

## Directory Structure

A common practice is that the `/internal` directory contains sub-directories to separate code targeted only for individual applications using the same pattern like the [`/app` directory][gh-tree-pkg] or module-wide code like stored in the [`/pkg` directory][gh-tree-pkg].
A common practice is that the `/internal` directory contains sub-directories to separate code targeted only for individual applications using the same pattern like the [`/apps` directory][gh-tree-apps] or module-wide code like stored in the [`/pkg` directory][gh-tree-pkg].

each application is placed in an individual directory that should match the name of the resulting binary executable.
Each application is placed in an individual directory that should match the name of the resulting binary executable.
The structure always depends on the type and use case(s) of the application, but in general the code only consists of the `main` package and function that mainly imports and invokes reuseable code from the [`/internal`][gh-tree-internal] and directories. This helps to better visualize the intended package use and distinguish shared and non-shared code.

## Example
Expand All @@ -13,7 +13,7 @@ Given the [example of the `/api` directory][gh-blob-api-readme#example] the stru

```raw
internal
├─ app
├─ apps
│  ├─ notes
│  └─ notes-sync
└─ pkg
Expand Down Expand Up @@ -47,6 +47,7 @@ Next to the experience with own projects and [golang-standards/project-layout][]
[gh-perkeep-tree-internal]: https://github.com/perkeep/perkeep/tree/master/internal
[gh-terraform-tree-internal]: https://github.com/hashicorp/terraform/tree/master/internal
[gh-tree-internal]: https://github.com/svengreb/tmpl-go/tree/main/internal
[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps
[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg
[gh-waypoint-tree-internal-pkg]: https://github.com/hashicorp/waypoint/tree/main/internal/pkg
[go-doc-rln-1.4#int_pkg]: https://golang.org/doc/go1.4#internalpackages
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The `/test` directory, also often named `spec`, stores additional data and tools for automated testing.

Additional external test apps and test data. Feel free to structure the /test directory anyway you want. For bigger projects it makes sense to have a data subdirectory. For example, you can have /test/data or /test/testdata if you need Go to ignore what's in that directory. Note that Go will also ignore directories or files that begin with "." or "\_", so you have more flexibility in terms of how you name your test data directory.
Additional external test applications and test data. Feel free to structure the /test directory anyway you want. For bigger projects it makes sense to have a data subdirectory. For example, you can have /test/data or /test/testdata if you need Go to ignore what's in that directory. Note that Go will also ignore directories or files that begin with "." or "\_", so you have more flexibility in terms of how you name your test data directory.

## Directory Structure

Expand Down

0 comments on commit 5551df2

Please sign in to comment.