How googlecodelabs/codelab-components works
Project type and purpose
• This is a front-end UI component library built with Polymer (“Google Codelab Components”), intended to provide reusable web components for the Google Codelabs platform.
• It is not a full-stack app or microservice ecosystem—it’s purely client-side, with build and test tools.
Main components
A. Developer Environment
– Inside:
• Bower (bower.json) – dependency manager
• npm scripts (polyserve, web-component-tester)
• Source folder (root .html component files)
B. Local Dev Server
– Polyserve
– Serves components, demos, tests under URLs like http://localhost:8080/components/codelab-components/
C. Component Library
– google-codelab-elements.html
– google-codelab-step.html
– google-codelab-survey.html
– Shared styles (layout-style.html, shared-style.html, etc.)
– font assets (google-sans.html, font-source-code-pro.html)
D. Demo Pages
– demo/codelab.html, demo/embed.html, demo/step.html, demo/survey.html
E. Test Suite
– web-component-tester
– test/*.html (test cases for each component)
F. External Dependencies
– Polymer library (in bower_components)
– Web Components polyfills
– Google Analytics behavior (analytics-behavior.html)
Relationships and data flow
• The Developer Workstation uses Bower to fetch Polymer and other dependencies into bower_components.
• npm invokes polyserve to host:
– Serves Component Library files and Demo Pages.
– Serves Test Pages to web-component-tester.
• Demo Pages import Component Library modules + style/html imports + external dependencies.
• Test Suite loads test pages that import components and validate behavior.
Architectural patterns and design principles
• Modular Web Components: each UI piece is its own HTML import.
• Separation of concerns:
– “Elements” (functional units) vs. “Styles” vs. “Behavior” vs. “Tests” vs. “Demos.”
• Dependency injection via HTML imports and Bower.