Skip to content

Commit cbfe0a4

Browse files
authored
docs: improve docs contribution guidelines (medusajs#13605)
* docs: improve docs contribution guidelines * fix build error * fix build errors * fix build * fix build
1 parent ea94c8b commit cbfe0a4

File tree

10 files changed

+221
-52
lines changed

10 files changed

+221
-52
lines changed

www/apps/api-reference/.env.sample

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# ESSENTIAL FOR DEV
2+
NEXT_PUBLIC_BASE_PATH=/api
3+
NEXT_PUBLIC_ENV=development # change to production when running npm start
4+
NEXT_PUBLIC_BASE_URL=http://localhost:3000
5+
6+
# OPTIONAL FOR DEV
7+
ANALYZE_BUNDLE=
8+
9+
# REQUIRED FOR PROD
110
NEXT_PUBLIC_SEGMENT_API_KEY=
2-
NEXT_PUBLIC_BASE_PATH=
311
NEXT_PUBLIC_DOCS_ALGOLIA_INDEX_NAME=
412
NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME=
513
NEXT_PUBLIC_ALGOLIA_API_KEY=
614
NEXT_PUBLIC_ALGOLIA_APP_ID=
7-
NEXT_PUBLIC_ENV=development # change to production when running npm start
8-
NEXT_PUBLIC_BASE_URL=
915
NEXT_PUBLIC_DOCS_URL=
1016
NEXT_PUBLIC_UI_URL=
1117
NEXT_PUBLIC_RESOURCES_URL=
@@ -14,7 +20,6 @@ NEXT_PUBLIC_CLOUD_URL=
1420
NEXT_PUBLIC_DOCS_V1_URL=
1521
NEXT_PUBLIC_API_V1_URL=
1622
ALGOLIA_WRITE_API_KEY=
17-
ANALYZE_BUNDLE=
1823
NEXT_PUBLIC_INTEGRATION_ID=
1924
NEXT_PUBLIC_GA_ID=
2025
NEXT_PUBLIC_REO_DEV_CLIENT_ID=

www/apps/book/.env.sample

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1+
# ESSENTIAL FOR DEV
2+
NEXT_PUBLIC_ENV=development
3+
NEXT_PUBLIC_BASE_URL=http://localhost:3000
4+
NEXT_PUBLIC_BASE_PATH= # should be left empty
5+
NEXT_PUBLIC_PROD_BASE_URL=https://docs.medusajs.com # required for generating llms files
6+
7+
# OPTIONAL FOR DEV
8+
ANALYZE_BUNDLE=
9+
10+
# REQUIRED FOR PROD
111
NEXT_PUBLIC_SEGMENT_API_KEY=
212
NEXT_PUBLIC_DOCS_ALGOLIA_INDEX_NAME=
313
NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME=
414
NEXT_PUBLIC_ALGOLIA_API_KEY=
515
NEXT_PUBLIC_ALGOLIA_APP_ID=
6-
NEXT_PUBLIC_ENV=
7-
NEXT_PUBLIC_BASE_URL=
816
NEXT_PUBLIC_RESOURCES_URL=
917
NEXT_PUBLIC_USER_GUIDE_URL=
1018
NEXT_PUBLIC_CLOUD_URL=
1119
NEXT_PUBLIC_UI_URL=
1220
NEXT_PUBLIC_API_URL=
1321
NEXT_PUBLIC_DOCS_V1_URL=
1422
ALGOLIA_WRITE_API_KEY=
15-
ANALYZE_BUNDLE=
1623
CLOUDINARY_CLOUD_NAME=
17-
NEXT_PUBLIC_BASE_PATH=
1824
NEXT_PUBLIC_GA_ID=
19-
NEXT_PUBLIC_PROD_BASE_URL=
2025
NEXT_PUBLIC_INTEGRATION_ID=
2126
NEXT_MCP_SERVER_URL=
2227
NEXT_PUBLIC_REO_DEV_CLIENT_ID=

www/apps/book/app/learn/resources/contribution-guidelines/docs/page.mdx

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Thank you for your interest in contributing to the documentation! You will be he
1010

1111
<Note title="Tip">
1212

13+
Making a quick fix to a page's content? You can scroll down to the bottom of the page and click on the "Edit this page" link to make quick edits directly in GitHub. If you're making bigger changes, such as adding a new page or making changes to the codebase, check out the rest of this guide.
14+
15+
</Note>
16+
17+
<Note title="Tip">
18+
1319
This guide is specific to contributing to the documentation. If you’re interested in contributing to Medusa’s codebase, check out the [contributing guidelines in the Medusa GitHub repository](https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md).
1420

1521
</Note>
@@ -31,11 +37,13 @@ Medusa's documentation projects are all part of the documentation `yarn` workspa
3137

3238
The workspace has the following two directories:
3339

34-
- `apps`: this directory holds the different documentation websites and projects.
35-
- `book`: includes the codebase for the [main Medusa documentation](https://docs.medusajs.com/). It's built with [Next.js 15](https://nextjs.org/).
36-
- `resources`: includes the codebase for the resources documentation, which powers different sections of the docs such as the [Integrations](!resources!/integrations) or [How-to & Tutorials](!resources!/how-to-tutorials) sections. It's built with [Next.js 15](https://nextjs.org/).
37-
- `api-reference`: includes the codebase for the API reference website. It's built with [Next.js 15](https://nextjs.org/).
38-
- `ui`: includes the codebase for the Medusa UI documentation website. It's built with [Next.js 15](https://nextjs.org/).
40+
- `apps`: this directory holds the different documentation websites and projects. All projects are built with [Next.js 15](https://nextjs.org/).
41+
- `book`: includes the codebase and content for the [main Medusa documentation](../../../page.mdx).
42+
- `resources`: includes the codebase and content for the resources documentation, which powers different sections of the docs such as the [Integrations](!resources!/integrations) or [How-to & Tutorials](!resources!/how-to-tutorials) sections.
43+
- `api-reference`: includes the codebase and content for the [API reference](!api!/store).
44+
- `ui`: includes the codebase and content for the [Medusa UI documentation](!ui!).
45+
- `user-guide`: includes the codebase and content for the [user guide documentation](!user-guide!).
46+
- `cloud`: includes the codebase and content for the [Medusa Cloud documentation](!cloud!).
3947
- `packages`: this directory holds the shared packages and components necessary for the development of the projects in the `apps` directory.
4048
- `docs-ui` includes the shared React components between the different apps.
4149
- `remark-rehype-plugins` includes Remark and Rehype plugins used by the documentation projects.
@@ -104,6 +112,53 @@ The UI documentation also shows code examples, which are under the `www/apps/ui/
104112

105113
The UI component props are generated from the source code and placed into the `www/apps/ui/specs/components` directory. To contribute to these props and their comments, check the comments in the source code under the `packages/design-system/ui` directory.
106114

115+
### Medusa User Guide
116+
117+
The content of all pages under the `/user-guide` path are under the `www/apps/user-guide/app` directory.
118+
119+
### Medusa Cloud Docs
120+
121+
The content of all pages under the `/cloud` path are under the `www/apps/cloud/app` directory.
122+
123+
---
124+
125+
## Run Documentation Projects Locally
126+
127+
To run a documentation project locally, such as `book` or `resources`, change into the directory of that project.
128+
129+
Then, copy the `.env.example` file to a new `.env.local` file. This should sufficiently set up the environment variables needed to run the project.
130+
131+
Finally, run the `dev` command to start the development server. For example, in the `book` project:
132+
133+
```bash npm2yarn
134+
npm run dev
135+
```
136+
137+
You can then access the documentation site by going to the following URLs in your browser:
138+
139+
- `book`: `http://localhost:3000`
140+
- `resources`: `http://localhost:3000/resources`
141+
- `api-reference`: `http://localhost:3000/api` (Store API routes at `/api/store` and Admin API routes at `/api/admin`)
142+
- `ui`: `http://localhost:3000/ui`
143+
- `user-guide`: `http://localhost:3000/user-guide`
144+
- `cloud`: `http://localhost:3000/cloud`
145+
146+
<Note>
147+
148+
When you access the documentation site, you might see errors or warning messages related to missing environment variables of services like Algolia. You can ignore these errors and warnings when working locally.
149+
150+
</Note>
151+
152+
### Prep Command
153+
154+
Each documentation project has a `prep` command that runs scripts to prepare data useful for development or production.
155+
156+
The common task that `prep` does is generate the sidebar files, which is useful for both development and production. If you make changes to sidebar items, make sure to run the `prep` command before starting the development server.
157+
158+
```bash npm2yarn
159+
npm run prep
160+
```
161+
107162
---
108163

109164
## Style Guide
@@ -114,9 +169,9 @@ When you contribute to the documentation content, make sure to follow the [docum
114169

115170
## How to Contribute
116171

117-
If you’re fixing errors in an existing documentation page, you can scroll down to the end of the page and click on the “Edit this page” link. You’ll be redirected to the GitHub edit form of that page and you can make edits directly and submit a pull request (PR).
172+
If you’re fixing small errors in an existing documentation page, you can scroll down to the end of the page and click on the “Edit this page” link. You’ll be redirected to the GitHub edit form of that page and you can make edits directly and submit a pull request (PR).
118173

119-
If you’re adding a new page or contributing to the codebase, fork the repository, create a new branch, and make all changes necessary in your repository. Then, once you’re done, create a PR in the Medusa repository.
174+
If you’re adding a new page or contributing to the codebase, fork the repository, create a new branch, and make all changes necessary in your repository. Then, once you’re done, create a PR in the Medusa repository.
120175

121176
### Base Branch
122177

@@ -132,13 +187,27 @@ Make sure that the branch name starts with `docs/`. For example, `docs/fix-servi
132187

133188
When you create a pull request, prefix the title with `docs:` or `docs(PROJECT_NAME):`, where `PROJECT_NAME` is the name of the documentation project this pull request pertains to. For example, `docs(ui): fix titles`.
134189

135-
In the body of the PR, explain clearly what the PR does. If the PR solves an issue, use [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) with the issue number. For example, “Closes #1333”.
190+
In the body of the PR, explain clearly what the PR does. If the PR solves an issue, use [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) with the issue number. For example, `Closes #1333`.
191+
192+
#### Prep Command Before PR
193+
194+
If you made changes to the content of any documentation project, you must run the [prep](#prep-command) command in the `book` project before creating a pull request. It will generate the `llms-full.txt` file with the updated content. You should also run it in the project you made changes to, as that will generate other necessary files for the project, such as edit dates.
195+
196+
```bash npm2yarn title="www/apps/book"
197+
npm run prep
198+
```
199+
200+
<Note>
201+
202+
Some files are ignored by the script. So, if you don't see that the `llms-full.txt` file is updated after running the `prep` command, you can safely ignore it.
203+
204+
</Note>
136205

137206
---
138207

139208
## Images
140209

141-
If you are adding images to a documentation page, you can host the image on [Imgur](https://imgur.com) for free to include it in the PR. Our team will later upload it to our image hosting.
210+
If you are adding images to a documentation page, you can host the image on [Imgur](https://imgur.com) for free to include it in the PR. Our team will later upload it to our image hosting CDN.
142211

143212
---
144213

@@ -244,7 +313,7 @@ If you want to check content ESLint errors locally and fix them, you can do that
244313
yarn install
245314
```
246315

247-
2\. Run the turbo command in the `www` directory:
316+
2\. Run the turbo command in the `www` directory or the specific documentation's directory (for example, `www/apps/book`):
248317

249318
```bash
250319
turbo run lint:content
@@ -264,7 +333,7 @@ If you want to check code ESLint errors locally and fix them, you can do that by
264333
yarn install
265334
```
266335

267-
2\. Run the turbo command in the `www` directory:
336+
2\. Run the turbo command in the `www` directory or the specific documentation's directory (for example, `www/apps/book`):
268337

269338
```bash
270339
yarn lint

www/apps/book/generated/edit-dates.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const generatedEditDates = {
109109
"app/learn/fundamentals/api-routes/parse-body/page.mdx": "2025-08-20T09:58:37.704Z",
110110
"app/learn/fundamentals/admin/routing/page.mdx": "2025-07-25T07:35:18.038Z",
111111
"app/learn/resources/contribution-guidelines/admin-translations/page.mdx": "2025-02-11T16:57:46.726Z",
112-
"app/learn/resources/contribution-guidelines/docs/page.mdx": "2025-08-20T06:41:30.822Z",
112+
"app/learn/resources/contribution-guidelines/docs/page.mdx": "2025-09-26T12:22:07.615Z",
113113
"app/learn/resources/usage/page.mdx": "2025-02-26T13:35:34.824Z",
114114
"app/learn/configurations/medusa-config/page.mdx": "2025-09-02T08:09:21.283Z",
115115
"app/learn/configurations/ts-aliases/page.mdx": "2025-07-23T15:32:18.008Z",

0 commit comments

Comments
 (0)