Not Undersetting, Node Template Session for development

Topic summary

A developer new to Shopify app development is building a Node.js app (not Remix) with MongoDB and encountering session storage challenges.

Current Setup:

  • Using @shopify/shopify-app-session-storage-mongodb instead of the default SQLite storage
  • Offline sessions automatically save to a “Shopify_sessions” collection during app installation
  • Two screenshots show the MongoDB collection structure

Key Questions:

  1. Session Expiration: Sessions expire after 24 hours. Does Shopify automatically update them, or is custom logic required?

  2. Online Session Storage: How to save online sessions to the database? Attempts following the session-storage.md guide have failed.

  3. Production Readiness: If automatic session saving is the only mechanism, is it sufficient for production?

  4. Session Validation: Is res.locals.shopify.session adequate for backend API validation without explicitly storing/retrieving from the database?

The developer seeks clarification on session management best practices and whether additional custom implementation is needed beyond the default MongoDB adapter behavior.

Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

Hello Everyone, I’m new to Shopify App Development and Want to use a Node template for Development instead of Remix, with MongoDB database.

I want help from you guys on the following topics(because of not understand docs and not finding what I want to do):-

I want to use the MongoDB database and when I use the default @shopify/shopify-app-session-storage-sqlite” it saves stores sessions in the local file but when use @shopify/shopify-app-session-storage-mongodb” store offline session in the “Shopify_sessions” Named collection automatically at the time of installation of app on stores. Now I have following issues/doubt.

  • is “res.locals.shopify.session” is enough for session validation for APIs in the Backend without storing and using it from the Database.
  • If the first doubt answer is no then, is this automatically saved session enough for production as well?
  • If both doubts answers are No, then how can I save it, and when to save the online session in my database? Because I have tried to save it in the database as per the “https://github.com/Shopify/shopify-api-js/blob/main/packages/shopify-api/docs/guides/session-storage.md
    but failed.
  • The sessions will expire after 24 hours then Shopify automatically updates it or needs to build custom logic for it.