mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> Adds JWT docs and JWT viewer component to docs <img width="1182" height="668" alt="image" src="https://github.com/user-attachments/assets/f4196dd9-e159-420e-9d78-a3928983f126" /> <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR adds comprehensive JWT (JSON Web Token) documentation and an interactive JWT viewer component to the Stack Auth documentation. The main additions are a new documentation page explaining JWT concepts, structure, and usage within Stack Auth, along with a React component that allows users to decode and inspect JWT tokens. The JWT viewer can automatically load the current user's session token if they are signed in, or accept manually pasted tokens. The documentation provides examples of both client-side and server-side JWT usage, security considerations, troubleshooting guidance, and best practices. The PR also includes necessary updates to metadata files and component exports to integrate the new content into the documentation platform. ⏱️ Estimated Review Time: 15-30 minutes <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `docs/templates/concepts/jwt.mdx` | | 2 | `docs/src/components/mdx/jwt-viewer.tsx` | | 3 | `docs/docs-platform.yml` | | 4 | `docs/src/components/mdx/index.ts` | | 5 | `docs/src/mdx-components.tsx` | | 6 | `docs/templates/meta.json` | | 7 | `docs/templates-python/meta.json` | </details> <!-- RECURSEML_SUMMARY:END --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Adds a new JWT concepts page and an interactive `JWTViewer` component, integrating it into MDX and navigation, with `jose` added for decoding. > > - **Docs**: > - Add `concepts/jwt.mdx` with JWT structure, claims, examples, verification, security, and best practices. > - Include JWT page in navigation: `docs-platform.yml`, `templates/meta.json`, and Python `templates-python/meta.json`. > - **UI Component**: > - Add `JWTViewer` in `docs/src/components/mdx/jwt-viewer.tsx` to decode JWTs (header, payload, signature), show time-based indicators, and load current user token via `useUser()`. > - Export and register in MDX: `docs/src/components/mdx/index.ts`, `docs/src/mdx-components.tsx`. > - **Dependencies**: > - Add `jose` to `docs/package.json` (lockfile updated). > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for |
||
|---|---|---|
| .. | ||
| content | ||
| lib | ||
| public | ||
| scripts | ||
| src | ||
| templates | ||
| templates-api | ||
| templates-python | ||
| .env.development | ||
| .eslintrc.json | ||
| .gitignore | ||
| CHANGELOG.md | ||
| cli.json | ||
| docs-platform.yml | ||
| next.config.mjs | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| source.config.ts | ||
| tsconfig.json | ||
stack-docs
This is a Next.js application generated with Create Fumadocs.
Run development server:
npm run dev
# or
pnpm dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
Explore
In the project, you can see:
lib/source.ts: Code for content source adapter,loader()provides the interface to access your content.app/layout.config.tsx: Shared options for layouts, optional but preferred to keep.
| Route | Description |
|---|---|
app/(home) |
The route group for your landing page and other pages. |
app/docs |
The documentation layout and pages. |
app/api |
The documentation for API pages. |
app/api/search/route.ts |
The Route Handler for search. |
Fumadocs MDX
A source.config.ts config file has been included, you can customise different options like frontmatter schema.
Read the Introduction for further details.
Learn More
To learn more about Next.js and Fumadocs, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- Fumadocs - learn about Fumadocs