OpenAPI Playground
The docs site embeds a Swagger UI playground so developers can explore and try API endpoints without leaving the docs.
Embedding Swagger UI
The wrapper component lives at docs/app/components/utilities/swaggerdocs/SwaggerDocs.tsx and wires Swagger UI to the docs environment:
import SwaggerDocs from '@components/utilities/swaggerdocs/SwaggerDocs'
<SwaggerDocs tag="Token Status" />Tag filtering
Swagger UI can be filtered by tag so each endpoint page only shows its relevant slice of the OpenAPI spec. The tag must match the OpenAPI tag name.
Use tag for filtered views, or omit it for the full API surface.
Local vs production API host
The Swagger UI base URL switches based on NEXT_PUBLIC_LOCAL_DOCS:
true→http://localhost:3000- default →
https://ritoswap.com
This is handled inside SwaggerDocs.tsx, so pages do not need to branch manually.
Local OpenAPI with the docs running on a different port
When you want the docs to hit a local dApp API while the docs site runs on a different port, set up a local env file and use the alternate dev command:
- Create
docs/.env.localwith:
NEXT_PUBLIC_LOCAL_DOCS=true- Run the docs site on port 3001:
pnpm dev1This keeps the docs site on http://localhost:3001 while Swagger pulls OpenAPI from http://localhost:3000 .
Styling
Swagger UI is themed to match RitoVision in docs/app/components/utilities/swaggerdocs/css-override.css.
Step 1: Update or add a new API tag
Ensure your OpenAPI tag exists and matches the page.
Step 2: Embed Swagger UI
Drop <SwaggerDocs tag=“Your Tag” /> into the MDX page.
References
- API overview:
/dapp/api - Swagger UI component:
docs/app/components/utilities/swaggerdocs/SwaggerDocs.tsx