The /web
directory stores web specific data like SPAs, static websites, web components & packages or server-side rendered templates. These are often build with the JAMStack principles where…
- …the content is written in formats like Markdown or MDX and, depending on the project scope and technology stack, require a preprocessor.
- …the actual applications or web-based documentation are built with static site generators like Gatsby, Next.js or Hugo that leverage reactive UI design through libraries like React and dynamic styling with styled components.
- …the data is fetched from APIs, often built on top of GraphQL, and rendered into templates and customizable data structures through a headless CMS like TinaCMS or Directus so that even non-tech-savvy people can edit and create content.
See references like the JAMStack documentations for more details.
The layout often depends on the individual use case(s) of the project, but it is a good practice to structure it as monorepo by using Yarn or NPM workspaces to store and manage multiple packages and applications. This template repository provides a basic workspace setup that is configured in the package.json
file.
Given the API defined in the example of the /api
directory the structure could be created as follows:
web
├─ api
│ └─ notes
│ └─ v1
│ └─ states
├─ apps
│ ├─ notes
│ │ ├─ src
│ │ │ ├─ components
│ │ │ └─ views
│ │ └─ typings
│ └─ notes-sync
│ ├─ src
│ │ └─ platform
│ │ └─ messaging
│ └─ typings
├─ packages
│ └─ @notes
│ ├─ docs
│ │ └─ content
│ └─ ui
│ └─ src
│ ├─ components
│ ├─ hooks
│ ├─ styles
│ └─ utils
├─ www
│ ├─ assets
│ ├─ src
│ │ ├─ assets
│ │ ├─ components
│ │ ├─ data
│ │ ├─ hooks
│ │ ├─ pages
│ │ ├─ styles
│ │ └─ utils
│ └─ test
└─ utils
├─ eslint
└─ scripts
Next to the experience with own projects and golang-standards/project-layout, many other large, production-grade and well-known projects of the Go ecosystem have been used as references: