How contentstack/marketplace-app-boilerplate works
Main components
• Entry Point & Client-Side Bootstrapping:
• Public folder (which contains index.html and manifest files) as the static assets.
• Src/index.tsx as the application’s entry point that loads the root React application.
• Core Application Container:
• Main App container (src/containers/App/App.tsx) which coordinates the application’s routing and lazy loading of different route components.
• MarketplaceAppProvider:
• <MarketplaceAppProvider> that wraps the application. This provider is responsible for initializing the Contentstack SDK, setting up global properties (like analytics and error tracking), and exposing the SDK via hooks.
• Context Providers & Hooks:
• Various context providers (found in src/common/contexts and src/common/providers) for different extension types such as AppConfigurationExtensionProvider, CustomFieldExtensionProvider, and EntrySidebarExtensionProvider. Their role is to supply extension-specific configurations throughout the component tree.
• Additionally, emphasize the usage of custom hooks (e.g., useAppConfig, useAppSdk, useCustomField, etc.) which are part of the application’s bridging logic between the SDK and UI.
• Route Components and Lazy Loading:
• UI Components & Containers:
• “components” and “containers” directories which hold individual UI components (like ErrorBoundary, ConfigModal, Sidebars, and Tooltips). They are arranged to form the various visual and interactive parts of the application.
• Testing and Development Tools:
• Testing suite components:
o The “e2e” folder which contains end-to-end tests (illustrate pages, tests, and utility functions used by Playwright).
o The “src/__tests__” folder (unit and integration tests).
• Build and configuration files (e.g., package.json, tsconfig.json, playwright.config.ts) as external dependencies that ensure proper building and testing.
Relationships and interactions
• That the App container routes different paths to lazily loaded components, which in turn depend on context providers and hooks to receive data and configuration.
• Interactions between UI components and backend services (if applicable), indicating that the Contentstack SDK is used as the middleware between the UI and Contentstack’s service endpoints.
Important architectural patterns and design principles
• The Provider Pattern: Used extensively for dependency injection (Contentstack SDK and extension contexts).
• Lazy Loading of Routes: As described in the README, to optimize performance.
• Separation of Concerns: The project structure clearly separates static assets, configuration, hooks, providers, UI components, and test suites.
• Component Reusability: Through custom hooks and context providers which reduce props drilling by exposing SDK data directly to components.
Relevant technologies and frameworks
• React for building the UI.
• Playwright for end-to-end testing.
• TypeScript for type safety.
• ESLint, Prettier, and other configuration tools to maintain code quality.
• Basic CSS for styling alongside modular CSS files.