|
| 1 | + |
| 2 | + |
| 3 | +# Design |
| 4 | + |
| 5 | +**In this document `zero` is a placeholder for some named utility.** |
| 6 | + |
| 7 | +The guiding principle behind `zero` is to **make it easy for developers to ship |
| 8 | +to production on day 1** |
| 9 | + |
| 10 | +## Developer Experience (DX) |
| 11 | + |
| 12 | +Developer Experience is the equivalent of User Experience when the primary user |
| 13 | +of the product is a developer. DX cares about the developer experience of using |
| 14 | +a product, its libs, SDKs, documentation, frameworks, open-source solutions, |
| 15 | +general tools, APIs, etc. |
| 16 | + |
| 17 | +**DX Pillars** |
| 18 | + |
| 19 | +- Function: Something is only as useful as it is functional. If it doesn't work |
| 20 | + it's of no value. Maintaining function is a key element of quality and |
| 21 | + percetpion of quality. |
| 22 | +- Stability: Performance and reliability |
| 23 | +- Ease of Use: The tool alone only forms one part of the developers journey. |
| 24 | + Resoures like github issues, documentation, clear workflows, snippets, etc |
| 25 | + all help reduce the friction in using and learning a new tool. |
| 26 | +- Clarity: Clear, concise, actionable information makes the world of difference |
| 27 | + when using a tool. |
| 28 | + |
| 29 | +## DX Guidelines |
| 30 | + |
| 31 | +- easy onboarding. it must be easy for someone to get started with the tool, |
| 32 | + and to join an existing \$setup or create a new one. |
| 33 | +- follows [principle of least astonishment][1] |
| 34 | +- use short easy to remember commands |
| 35 | +- help commands on [every sub command][2] |
| 36 | +- pipe-able / machine-readable output |
| 37 | +- feedback at the end of a command. every tool and command is guiding someone |
| 38 | + down a path and we should tell them where to go next. for example, a command |
| 39 | + that results in some build artifact; tell them the typical next step. github |
| 40 | + does the same thing with their post remote push message telling you to open a |
| 41 | + PR. any command that takes a long time to run should let the user know though |
| 42 | + some kind of visual feedback. for scripts, this feedback should be able to be |
| 43 | + suppressed, like curl silent mode. |
| 44 | +- colors; when do we use them? anything needs to work _without_ colors too, so |
| 45 | + they can't be the primary way of labeling / indicating anything. just an |
| 46 | + enhancement to words or symbols that are already on the screen. For an |
| 47 | + example of things to think about [see this mocha issue][3] |
| 48 | + |
| 49 | +## Implementation Principles |
| 50 | + |
| 51 | +- Discoverable: |
| 52 | +- Familiar: |
| 53 | +- Alterable: |
| 54 | +- Parsable: |
| 55 | +- Consistency: as a command line tool we need to establish a convention and |
| 56 | + stick to it. things like `[cmd] [noun] [verb]` with flags. consistent flag options, |
| 57 | + etc. short form flags are possible but we should encourage long form flags |
| 58 | + when scripting usage of the tool so that things are more self-documenting. |
| 59 | +- error messages should be easy to understand and steer someone towards an |
| 60 | + answer / next step. |
| 61 | +- error early: if we can detect things that will be problems do it as early as |
| 62 | + possible before proceeding with an operation. it makes no sense to take |
| 63 | + expensive actions that may mutate state which will only half-finish |
| 64 | +- idempotency |
| 65 | + |
| 66 | +## Users |
| 67 | + |
| 68 | +- Our users are not power users |
| 69 | +- typically experienced but not devops masters |
| 70 | +- havent built their own full environment before or they have but are missing |
| 71 | + best practices / some clear conventions. |
| 72 | +- Users will more often be joining a team or a project much more frequently |
| 73 | + than creating an environment from scratch. That only happens one time. |
| 74 | + |
| 75 | +## Installation |
| 76 | + |
| 77 | +- must be easy to install for users of different platforms with the least |
| 78 | + amount of lift |
| 79 | + linux, osx. should look at mechanisms for installation like brew, apt, curl |
| 80 | +- dont have to worry about windows for now but we shouldn't back ourselves into |
| 81 | + a corner |
| 82 | + |
| 83 | +## Documentation |
| 84 | + |
| 85 | +Documentation should be consistent, easy to follow, and follow the user through |
| 86 | +their own journey. We should only make use of commonly installed utilities which |
| 87 | +come with the prerequisites we define or commands we _know_ are installed. For |
| 88 | +example use `psql` vs `pgcli` in shell examples. |
| 89 | + |
| 90 | +Each README should have an outline on: |
| 91 | + |
| 92 | +- what the tool does |
| 93 | +- which dependencies to install |
| 94 | +- how to install the application |
| 95 | +- how to contribute |
| 96 | +- communication channels |
| 97 | + |
| 98 | +To ensure the README is easy to read, please keep length limited. Any FAQ |
| 99 | +sections or hints / tips / design decisions / etc should go into a separate |
| 100 | +documentation path. |
| 101 | + |
| 102 | +Shell commands should be preceeded with a `$` dollar sign to act as a visual |
| 103 | +representation of the shell. While the world will be moving towards `zsh` we |
| 104 | +should use compatible examples whenever possible. Shell commands should wrap at |
| 105 | +the 80 character limit. For long commands use a `\` to move additional arguments |
| 106 | +or flags onto separate lines, and omit the preceeding `$` so that it can be |
| 107 | +copy-pasted without the dollar sign affecting interpretation. |
| 108 | + |
| 109 | +```shell |
| 110 | +$ zero arg \ |
| 111 | + --flag-one \ |
| 112 | + --flag-two \ |
| 113 | + three |
| 114 | +``` |
| 115 | + |
| 116 | +## Concepts |
| 117 | + |
| 118 | +#### Help |
| 119 | + |
| 120 | +built in help should follow standard conventions. `[option]` with square |
| 121 | +brackets. `<argumennts>` which are required with greater-than and lesser-than |
| 122 | +signs. |
| 123 | + |
| 124 | +```shell |
| 125 | +$ zero --help |
| 126 | +$ zero noun [[]noun] verb --help |
| 127 | +$ zero noun verb [options] --help |
| 128 | +$ |
| 129 | +$ Usage: noun verb [options] <arg> <arg> |
| 130 | +$ # flags list |
| 131 | +``` |
| 132 | + |
| 133 | +or |
| 134 | + |
| 135 | +```shell |
| 136 | +$ zero <command> <subcommand> |
| 137 | +``` |
| 138 | + |
| 139 | +## Glossary |
| 140 | + |
| 141 | +Terms we'll use repeatedly should have clear definitions or use common knowledge |
| 142 | +definitions. Some of these terms may still require definitions. Any frequently |
| 143 | +used word should be added to this list if it applies to usage in `zero`. |
| 144 | + |
| 145 | +- **Project**: A project is the top level (root) entity that contains the infrastructure and configuration. A project is compartmentalized and has no awareness of the details of other projects. Environments are built using Modules as part of a project. |
| 146 | + |
| 147 | +- **Module**: This is a git repository that contains everything Zero needs to set up a piece of a project. |
| 148 | + - What’s included in a single Module? |
| 149 | + - Templates |
| 150 | + - Documentation |
| 151 | + - Potentially definition of something to execute (terraform, api calls, etc) |
| 152 | + - Examples of Current modules: |
| 153 | + - Zero-aws-eks-stack |
| 154 | + - Zero-deployable-backend |
| 155 | + - Zero-deployable-react-frontend |
| 156 | + |
| 157 | +- Application all the pieces of your project working together (Frontend, Service, Infrastructure). |
| 158 | + |
| 159 | +- **Infrastructure**: The systems your application runs on and other required dependencies that are not part of the Frontends or Services. Typically provided by a cloud provider and provisioned with Terraform. (For example AWS EKS, RDS, Cloudfront, etc.) |
| 160 | + |
| 161 | +- **Environment**: A running instance of your entire Application. Examples being Dev / Staging / UAT / Production (one or many set up for a single project) |
| 162 | + |
| 163 | +- **Frontend**: A single page app serving the front-end of a web application. Typically makes requests to a Service. |
| 164 | + |
| 165 | +- **Service**: A backend app serving APIs or providing funtionality for a web application. Typically serves requests from the Frontend App. |
| 166 | + |
| 167 | +- **Pipeline**: CI/CD pipeline responsible for running automated tests and deploying Frontend Apps and/or Services to Environments. |
| 168 | + |
| 169 | + |
| 170 | +<!-- links go here --> |
| 171 | + |
| 172 | +[1]: https://en.wikipedia.org/wiki/Principle_of_least_astonishment |
| 173 | +[2]: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-help.html |
| 174 | +[3]: https://github.com/mochajs/mocha/issues/802 |
0 commit comments