Skip to content

Mastra server.build config for swaggerUI, openAPIDocs, apiReqLogs #3674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

TheIsrael1
Copy link
Contributor

Description

Related Issue(s)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test update

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have generated a changeset for this PR

Copy link

codesandbox bot commented Apr 16, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: c54f9c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 54 packages
Name Type
@mastra/deployer-cloudflare Patch
@mastra/deployer-netlify Patch
@mastra/deployer Patch
@mastra/deployer-vercel Patch
@mastra/core Patch
mastra Patch
create-mastra Patch
@mastra/evals Patch
@mastra/loggers Patch
@mastra/mcp-docs-server Patch
@mastra/mcp-registry-registry Patch
@mastra/mcp Patch
@mastra/memory Patch
@mastra/playground-ui Patch
@mastra/rag Patch
@mastra/server Patch
@mastra/astra Patch
@mastra/chroma Patch
@mastra/clickhouse Patch
@mastra/cloudflare-d1 Patch
@mastra/cloudflare Patch
@mastra/pg Patch
@mastra/pinecone Patch
@mastra/qdrant Patch
@mastra/turbopuffer Patch
@mastra/upstash Patch
@mastra/vectorize Patch
@mastra/speech-azure Patch
@mastra/speech-deepgram Patch
@mastra/speech-elevenlabs Patch
@mastra/speech-google Patch
@mastra/speech-ibm Patch
@mastra/speech-murf Patch
@mastra/speech-openai Patch
@mastra/speech-playai Patch
@mastra/speech-replicate Patch
@mastra/speech-speechify Patch
@mastra/voice-azure Patch
@mastra/voice-cloudflare Patch
@mastra/voice-deepgram Patch
@mastra/voice-elevenlabs Patch
@mastra/voice-google Patch
@mastra/voice-murf Patch
@mastra/voice-openai-realtime Patch
@mastra/voice-openai Patch
@mastra/voice-playai Patch
@mastra/voice-sarvam Patch
@mastra/voice-speechify Patch
@mastra/client-js Patch
@mastra/firecrawl Patch
@mastra/github Patch
@mastra/mem0 Patch
@mastra/ragie Patch
@mastra/dane Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
assistant-ui ❌ Failed (Inspect) Apr 22, 2025 3:09pm
bird-checker ❌ Failed (Inspect) Apr 22, 2025 3:09pm
crypto-chatbot ❌ Failed (Inspect) Apr 22, 2025 3:09pm
mastra-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2025 3:09pm
openapi-spec-writer ❌ Failed (Inspect) Apr 22, 2025 3:09pm
travel-ai 🛑 Canceled (Inspect) Apr 22, 2025 3:09pm

Copy link

promptless bot commented Apr 16, 2025

📝 Documentation updates detected! You can review documentation updates here

@pechitook
Copy link
Contributor

Hey @TheIsrael1 - I tried to do something similar in #3641. Also not a contributor [yet 😄] so I probably don't have enough context but still gonna throw some comments - hopefully some of them are useful

  1. How about defaulting the same way for OpenAPI? Opting out from exposing SwaggerUI by default but keeping the OpenAPI detailed spec including all API endpoints seems inconsistent in terms of hiding sensitive endpoint data.
  2. Can we delete dev.entry.js now in favor of the new bundle file? Seems unused outside BuildBundler.ts at least by following code around.
  3. I know it's a draft, but bundleOptions is probably worth typing as custom deployers may need to use it directly when implementing bundle

Copy link

promptless bot commented Apr 17, 2025

📝 Documentation updates detected! You can review documentation updates here

@vercel vercel bot temporarily deployed to Preview – openapi-spec-writer April 17, 2025 12:01 Inactive
@vercel vercel bot temporarily deployed to Preview – bird-checker April 17, 2025 12:01 Inactive
@TheIsrael1 TheIsrael1 changed the title Omit playground, swaggerUI, openAPIDocs from server build by default, Add ability to enable via Mastra Instance server config Omit playground, swaggerUI, openAPIDocs from server build, Configure via Mastra instance server config Apr 17, 2025
@TheIsrael1 TheIsrael1 changed the title Omit playground, swaggerUI, openAPIDocs from server build, Configure via Mastra instance server config Add ability to enable swaggerUI, openAPIDocs, apiReqLogs via Mastra Instance server config Apr 17, 2025
@@ -82,6 +82,36 @@ You can then leverage the [Mastra Client](/docs/deployment/client) SDK to intera

`mastra dev` provides an OpenAPI spec at http://localhost:4111/openapi.json

To enable OpenAPI documentation in your Mastra instance, add the following configuration:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably always enable all of these on dev and only read the config on production builds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok, we can do that, we can have a build property on the server config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok we have a server.build config now that applies if !isDev in the hono server

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TheIsrael1 . Could you help me understand if I'm using this wrong? It tried these options on a production build, but they are not being respected. Following the built code I noticed it's calling await createNodeServer(mastra); without options, and inside it there's a call for const app = await createHonoServer(mastra, options);, which makes it look like these options under Mastra.server.build are not being read. Do I need to set something else? Also, would it make sense to also keep the playground option?

Copy link
Contributor

github-actions bot commented Apr 22, 2025

Braintrust eval report

No experiments to report

@TheIsrael1 TheIsrael1 requested a review from wardpeet April 22, 2025 12:24
@TheIsrael1 TheIsrael1 changed the title Add ability to enable swaggerUI, openAPIDocs, apiReqLogs via Mastra Instance server config Mastra server.build config for swaggerUI, openAPIDocs, apiReqLogs Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants