Skip to content
Discussion options

You must be logged in to vote

For larger MV3 projects, I usually separate the extension into feature-based folders instead of page-based folders.

For example:

src/
  background/
  content/
  popup/
  options/
  shared/
    utils/
    storage/
    messaging/
    types/

A few practices that have helped:

  • Keep shared business logic in a shared folder so it can be reused by all extension contexts.
  • Create a small messaging wrapper instead of calling chrome.runtime.sendMessage() everywhere.
  • Centralize storage access in one module to avoid duplicated keys and logic.
  • Keep the service worker as lightweight as possible and move reusable code into shared modules.
  • Use TypeScript path aliases to simplify imports in larger projects.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RanaKafilAnwar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitHub Education All things GitHub Education including website, documentation and events. Question Ask and answer questions about GitHub features and usage Verification Help & Guidance Guiding users through their Education verification rejection reasons. Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
2 participants