How codinsonn/green-stack-demo works
Project Context and Purpose
• The project is a full-stack, cross-platform application starter template built using React/React Native with a monorepo structure.
• It leverages the GREEN stack by combining GraphQL, React (and React-Native), Evergreen components, Expo (for mobile) and Next.js (for web). Its emphasis is “write once, run anywhere” across mobile, web, and PWA.
• The README reinforces its primary value: a universal development approach through shared code, automated Storybook documentation and optimized deployment for web and mobile.
Main Components Identification
• Apps Layer:
• /apps/next: Contains Next.js configuration and file-based routing for web, SSR support, API routes (GraphQL, health, docs etc) and static assets.
• /apps/expo: Contains Expo configuration and bundler settings (Metro, Babel, Expo Router) to support mobile app (iOS/Android/PWA) development.
• Features Layer:
• Packages or Libraries:
• /packages: Contains the core libraries of Aetherspace (primitives, forms, context, navigation, schemas, utils, etc.) which provide reusable components and business logic that are consumed both by the apps and features.
• Configuration and Build Tools:
• Turborepo configuration (turbo.json, turbo folder) and yarn workspaces support establishing clear dependency boundaries, caching, and build pipelines.
• Documentation & Storybook:
• .storybook directory where Storybook is configured to auto-generate documentation for components and libraries.
Relationships and Interactions
• The Apps entries (Expo and Next) are the entry points for building the respective mobile and web builds.
• Both apps rely on the shared code from the “features” (notably app-core) to render consistent UI and routing across platforms.
• The “packages” provide utility functions, components, hooks, navigation, schema, and core Aetherspace libraries that support both app code and feature code.
• The monorepo structure (with yarn workspaces and Turborepo) orchestrates building and dependency linkage between /apps, /features, and /packages.
• External services: GraphQL endpoints and possibly REST API routes which are implemented within the apps and shared by features.
• Storybook integration is used to document and visually test core reusable components.
Architectural Patterns and Design Principles
• Monorepo Architecture: Separate workspaces (apps, features, packages) are used for clear separation of concerns.
• Shared Code and “Write Once” Principles: The common libraries (in packages) and core features (in app-core) demonstrate the DRY (Don’t Repeat Yourself) pattern.
• File-based Routing: Both Expo (mobile) and Next (web) use file-based routing systems with generated routes, making the structure modular and extensible.
• Configurability: Usage of YAML and JSON config files across directories (babel.config.js, tsconfig.json, next.config.js, app.json) ensures that each platform’s build settings are isolated yet coordinated.