Skip to content

Architecture - Universal Shared Resources

In a universal app with shared components across platforms (web, mobile, etc.), a clean and organized codebase is crucial. The packages directory acts as a repository for reusable components and utilities. Here’s the philosophy and benefits of this approach:

Centralized Components

  • Primitives: Basic components from gluestack-ui-v2, serving as foundational building blocks.
  • Custom Components: Tailored components shared across platforms, avoiding duplication and ensuring universal updates.

Ease of Maintenance

  • Single Source of Truth: Having all shared components in one place simplifies maintenance and updates.
  • Consistent Styling and Behavior: Centralizing components ensures uniform styling and behavior, leading to a consistent user experience.
  • Simplified Dependencies: Centralized components make managing dependencies straightforward, reducing version conflicts and other issues.

Scalability

  • Modular Structure: A modular structure allows for efficient scaling by adding components to the packages directory without disrupting the overall structure.

  • Enhanced Collaboration: A well-defined structure facilitates team collaboration, allowing developers to work on specific packages without conflicts.

Improved Development Workflow

  • Simplified Testing: Centralized components make testing straightforward, allowing for isolated unit tests before integration.

  • Faster Development: Reusing existing components speeds up development, eliminating the need to recreate common elements.