docs: add routing page (#9550)

- Add a new homepage to `book` project for the routing page
- Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs)
- Other: add admin components to resources dropdown + fixes to search on mobile.

Closes DX-955

Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
This commit is contained in:
Shahed Nasser
2024-10-18 08:24:34 +00:00
committed by GitHub
parent 7a47f5211d
commit 0a37675f0e
223 changed files with 2549 additions and 696 deletions
@@ -0,0 +1,67 @@
import { Prerequisites, BetaBadge } from "docs-ui"
export const metadata = {
title: `${pageNumber} Next.js Starter`,
}
# {metadata.title} <BetaBadge text="Beta" tooltipText="The Next.js Starter is currently in development to fully support Medusa v2." />
In this chapter, youll learn how to install and use the Next.js Starter storefront.
## Install Next.js Starter
<Prerequisites items={[
{
text: "Node.js v20+",
link: "https://nodejs.org/en/download"
},
{
text: "At least one region in the Medusa application.",
},
]} />
1. Clone the `v2` branch of the [Next.js Starter](https://github.com/medusajs/nextjs-starter-medusa/tree/v2):
```bash
git clone https://github.com/medusajs/nextjs-starter-medusa -b v2 my-medusa-storefront
```
2. Change to the `my-medusa-storefront` directory, install the dependencies, and rename the template environment variable:
```bash npm2yarn
cd my-medusa-storefront
npm install
mv .env.template .env.local
```
3. While the Medusa application is running, start the Next.js storefront:
```bash npm2yarn
npm run dev
```
Your Next.js Starter Storefront is now running at `localhost:8000`.
---
## Customize Storefront
To customize the storefront, refer to the following directories:
- `src/app`: The storefronts pages.
- `src/modules`: The storefronts components.
- `src/styles`: The storefronts styles.
<Note title="Tip">
You can learn more about development with Next.js through [their documentation](https://nextjs.org/docs/getting-started).
</Note>
---
## Configurations and Integrations
The Next.js Starter is compatible with some Medusa integrations out-of-the-box, such as the Stripe provider module. You can also change some of its configurations if necessary.
Refer to the [Next.js Starter reference](!resources!/nextjs-starter) for more details.
@@ -0,0 +1,27 @@
export const metadata = {
title: `${pageNumber} Storefront Development`,
}
# {metadata.title}
Storefronts are built separately from the Medusa application. They interact with the Medusa application through the Store API routes.
You're free to choose how to build your storefront. You can start with our Next.js starter storefront, as explained in the next chapter, or build a storefront from scratch using your preferred framework or tech stack.
<Note title="Tip">
To learn how to build a storefront from scratch, check out the [Storefront Development guides](!resources!/storefront-development) in the Development Resources documentation.
</Note>
---
## Passing a Publishable API Key in Storefront Requests
When sending a request to an API route starting with `/store`, you must include a publishable API key in the header of your request.
A publishable API key sets the scope of your request to one or more sales channels.
Then, when you retrieve products, only products of those sales channels are retrieved. This also ensures you retrieve correct inventory data, and associate created orders with the scoped sales channel.
Learn more about passing the publishable API key in [this storefront development guide](!resources!/storefront-development/publishable-api-keys).