In the last few months I have given a lot of thought on the minimal technical documentation that all projects should have. I consider it essential to building a quick understanding of the project and quickly onboard new developers. These documents should be maintained in the version control just like the code. The technical documentation should sit in the same version control repository as your code.
The documents that I consider essential are:
README.md is the first file that people interact with when they look at your project source code. I still find projects where README is essentially empty or it does not exist. README.md gives a perfect opportunity to the development team to explain their project to others or future developers who will be joining their team. The details that I look for in the README.md are:
- High level overview of the project. In 3-4 explain what this project does
- Project CI and quality badges
- Requirements. Programming languages, Tools, etc required to be installed on the machine
- Build instructions
- Running local instructions. This should cover both the dockerized version and step by step running instructions
- Configuration. Any configuration that could be useful for the developer like changing port number
- Links to important services
- CI server like Jenkins, Github Actions, CircleCI
- Project management tool like JIRA
- Prototyping tool like InVision
This file should describe the high-level architecture of the project. You should share this file with anyone who wants to understand the technical details and architecture of the project. This should have the high level architecture and details that don’t change often. If you use the C4 model to document your architecture then this document should only have context and container diagrams. I store this file in the project root docs directory.
The minimal details that I look for in architecture.md are:
- Constraints. Any business or technical constraint that you had while you designed the system. You need to call out these constraints and how they influenced the design.
- Non-functional requirements. Most important quality attributes required to meet the business goals.
- Architecture style. Based on the quality attributes which architecture style meets the need.
- Solution context diagram. This is a high level context diagram that shows system as a black box, its main user personas, and external integrations
- Solution container diagram. You create the solution diagram showing different components that make the system. You should call out if it is a library or a service.
- Technology stack along with versions. The list of important technologies that you use to build the system and the reason you choose them.
Diagrams should also be stored as code so that it is easier for people to change when required. The documentation should also follow the code review process just like code. There are not many good diagrams as code solutions. I version control Draw.io JSON files.
api.md documents the external facing API of the project. This is usually a REST API but it could be GraphQL as well. Most teams use Swagger to document REST APIs. Swagger documents are written in either YAML or JSON format. The JSON and YAML are not easily readable documents. I use a tool called swagger-markdown to convert a Swagger document to a markdown document. This file is automatically generated each time a Swagger document is updated.
Well documented README.md, architecture.md, and api.md can take a development team a long way. You can onboard new developers faster and communicate your architecture and design effectively. The other positive impact of good documentation is that it saves a lot of time as people can read it themselves. I also think development teams can keep half a day every 3-4 sprints to revisit the document and make any revisions if required. Good documentation is the cost effective way to scale engineering teams.