forked from CenterForDigitalHumanities/rerum-playground
-
Notifications
You must be signed in to change notification settings - Fork 8
Added the Documentation for all HTML, js files and README #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Devayani1612
wants to merge
49
commits into
main
Choose a base branch
from
dev_devayani
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
6df3c68
Merge pull request #70 from oss-slu/dev_devayani
LuisPalmejar21 e667f69
Documented all .html files located in the /web/ folder to explain the…
LuisPalmejar21 9fcf656
Added docs
joeljoby02 016aafe
Update about.md
Devayani1612 74fb6c7
Update about.md
Devayani1612 508a35c
Merge pull request #71 from oss-slu/dev_luis
Devayani1612 0ce97a8
Docusaurus integration
joeljoby02 23ad4b4
Added node version
joeljoby02 74f5916
Updated my repository content based on Devayani's feedback for Sprint 3.
LuisPalmejar21 557dc78
Merge branch 'dev_luis' of https://github.com/oss-slu/rerum-playgroun…
LuisPalmejar21 a06fbd1
Merge pull request #73 from oss-slu/dev_luis
Devayani1612 4017a6c
Added docs for json-utils.js and json-utils.test.js
joeljoby02 9934ede
Merge pull request #72 from oss-slu/dev_joel
Devayani1612 86e4794
Updated readme.md
joeljoby02 c7c027b
Renamed sandbox and tools documentation files to sandbox-html.md and …
LuisPalmejar21 a64df0e
Merge pull request #77 from oss-slu/dev_joel
Devayani1612 cbab18f
Copied sandbox-html.md and tools-html.md from dev_luis branch
Devayani1612 583df85
Moved fetch functions to objectService.js
joeljoby02 021e699
Reverted HTTP error messages
joeljoby02 c76a5d0
Refactored JavaScript files in rerum-playground/web by moving DOM rel…
LuisPalmejar21 ecb9abe
Worked on issue #90
joeljoby02 b9e0d9d
Move new file to utils folder
joeljoby02 03175d3
Worked on issue #92
joeljoby02 1ffcc12
Merge pull request #94 from oss-slu/dev_joel
Devayani1612 6f3c476
Made some refactoring. Based on Devayani's feedback on my recent pull…
LuisPalmejar21 e014891
Updated CONTRIBUTING.md based on new architecture rules.
LuisPalmejar21 b46db4f
Updated CONTRIBUTING.md to include a short guide on how to add a new …
LuisPalmejar21 57a7f18
Resolved merge conflicts for PR #103 (Issues #89, #91, #93)
Devayani1612 c3fb656
Add technical architecture refactor blog post
Devayani1612 5eeb929
WIP: local changes before pull
Devayani1612 5330611
Added refactor blog post
Devayani1612 ed7b010
Added refactor blog post
Devayani1612 a703bfd
Updated
Devayani1612 c95bb3e
Fix menu and footer loading using layout service
Devayani1612 f159982
ISSUE 114 API DOCUMENTATION
akearney6 86b81a1
Fix broken script references in index.html and about.html
teamomiamigo 2db2fcd
Define requirements for annotation text search functionality
teamomiamigo e221c15
Cleanup API documentation by removing redundant sections
Devayani1612 951af3f
Merge pull request #119 from oss-slu/akearney6_issue114
Devayani1612 8fa16ad
Revise search requirements and API endpoint details
Devayani1612 017d792
Merge branch 'dev_devayani' into 113-define-requirements-for-annotati…
Devayani1612 969e37b
Merge pull request #117 from oss-slu/113-define-requirements-for-anno…
Devayani1612 5f9f5bc
Implement RERUM annotation search service with paging and normalization
teamomiamigo 9024f45
update on issue 115 and working on search implementation
teamomiamigo f3721bb
fixes the search mechanics and error handling
teamomiamigo 6a446f2
Merge pull request #122 from oss-slu/115-implement-annotation-search-…
Devayani1612 619387a
Integrate annotation search into Sandbox UI and fix module loading
teamomiamigo 370d461
fixing issues from comments
teamomiamigo 3b7d8c6
Merge pull request #126 from oss-slu/124-integrate-annotation-search-…
Devayani1612 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| nbproject/ | ||
| build.xml | ||
| *.properties | ||
| *.properties | ||
| CLAUDE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,311 @@ | ||
| # Modernizing the RERUM Playground Architecture | ||
| ### A Technical Refactor for Sustainable Open Source Development | ||
|
|
||
| **Author:** Devayani Chakravarthi Konakalla | ||
| **Project:** RERUM Playground | ||
| **Published On:** December 2024 | ||
|
|
||
| ## Introduction | ||
|
|
||
| The RERUM Playground is a web-based environment built to demonstrate the capabilities of the RERUM API and its ecosystem tools. As the project has grown, new interfaces, metadata tools, and annotation utilities have been added. With this growth, the codebase became harder to navigate and maintain for both SLU student developers and external contributors. | ||
|
|
||
| During Sprint 5, I led a core architectural refactor to reorganize the Playground into a clean, layered, and contributor-friendly structure. This blog documents the refactor design, the engineering principles behind it, and how the updated architecture now supports long-term sustainability and onboarding. | ||
|
|
||
| # Refactor Objectives | ||
|
|
||
| | Goal | Implementation | | ||
| |------|---------------| | ||
| | Improve maintainability | Folder restructuring & component isolation | | ||
| | Separate responsibilities clearly | Services ≠ Features ≠ UI | | ||
| | Reduce repeated fetch logic | Centralized service layer | | ||
| | Enable future testing | Smaller modules and isolated logic | | ||
| | Improve contributor onboarding | Cleaner directory structure & documentation | | ||
| | Simplify adding new tools | Standardized architecture pattern | | ||
|
|
||
|
|
||
| # Problems Before Refactor | ||
|
|
||
| ### Architecture Issues Found | ||
|
|
||
| - `sandbox.js`, `tools.js`, and `playground.js` contained multiple responsibilities: | ||
| - DOM handling | ||
| - API calls | ||
| - Interface orchestration | ||
| - Fetch logic duplicated across files | ||
| - Hard to understand how tools were rendered or registered | ||
| - No consistent pattern for contributors to add new tools | ||
| - Difficult to test or mock RERUM API calls | ||
|
|
||
| **Core Issue: Lack of Separation of Concerns** | ||
| Logic, UI, utilities, and API operations were not isolated. | ||
|
|
||
| # Core Refactor Principles | ||
|
|
||
| ### Single Responsibility | ||
| Each module should do only ONE thing. | ||
|
|
||
| ### Separation of Concerns | ||
| Clear boundary between: | ||
| - Fetch/API services | ||
| - UI rendering components | ||
| - Tool orchestration features | ||
| - Utility helpers | ||
|
|
||
| ### Developer-friendly Architecture | ||
| Future contributors should know immediately: | ||
| “Where do I write my UI? Where do I call RERUM? How do I register a tool?” | ||
|
|
||
| ### Sustainability | ||
| Architecture must support long-term growth without rewriting core files. | ||
|
|
||
|
|
||
| # Before vs. After Structure | ||
| ## Before | ||
|
|
||
| /web/js/ | ||
| │ playground.js | ||
| │ tools.js | ||
| │ sandbox.js | ||
| │ utilities.js | ||
| │ json-utils.js | ||
| │ toolsCatalog.js | ||
| - API calls scattered everywhere | ||
| - UI and network logic mixed together | ||
| - No reusable service layer | ||
| - Difficult to onboard contributors | ||
|
|
||
| ## After (Layered Design) | ||
|
|
||
| ```bash | ||
| /web/js/ | ||
| │ | ||
| ├── services/ # Network & API logic only | ||
| │ └── objectService.js # Centralized CRUD + fetch methods | ||
| │ | ||
| ├── utils/ # Shared helper utilities | ||
| │ └── generalUtils.js # logger, broadcast, thumbnailGenerator | ||
| │ | ||
| ├── components/ # UI-only, DOM event handlers & rendering | ||
| │ ├── sandboxUI.js # Sandbox page UI logic | ||
| │ └── toolsUI.js # Tools page UI logic | ||
| │ | ||
| ├── features/ # Feature orchestration (no UI, no API) | ||
| │ ├── playground-feature.js # Root playground bootstrapping | ||
| │ ├── sandbox-feature.js # Sandbox initialization & wiring | ||
| │ └── tools-feature.js # Tools page initialization & wiring | ||
| │ | ||
| ├── catalog/ # Domain data for tools/interfaces | ||
| │ └── toolsCatalog.js # Catalog entries for UI rendering | ||
| │ | ||
| ├── manifest/ # Domain logic for IIIF manifest tool | ||
| │ └── manifestStorage.js # Persist and retrieve manifest data | ||
| │ | ||
| └── config.js # Global config: URLs, constants, events | ||
| ``` | ||
|
|
||
| ✔ Centralized service logic | ||
| ✔ UI code separate | ||
| ✔ Feature modules orchestrate functionality | ||
| ✔ Modular and scalable | ||
|
|
||
|
|
||
| # Key Technical Changes | ||
|
|
||
| ## 1. Centralized API Layer | ||
| `services/objectService.js` now contains *all* fetch-based RERUM API calls: | ||
|
|
||
| - `create` | ||
| - `update` | ||
| - `overwrite` | ||
| - `deleteObject` | ||
| - `query` | ||
| - `resolveJSON` | ||
| - `resolveString` | ||
|
|
||
| **Reason:** | ||
| No duplicated fetch logic anywhere in the codebase. | ||
|
|
||
| ## 2. Shared Utility Library | ||
| `utils/generalUtils.js` stores reusable helpers: | ||
| - Logging | ||
| - Thumbnail generation | ||
| - Event broadcasting | ||
|
|
||
| **Benefit:** Eliminates redundant helper functions. | ||
|
|
||
|
|
||
| ## 3. UI Extracted into Components | ||
| For example: | ||
| - `components/sandboxUI.js` | ||
| - `components/toolsUI.js` | ||
|
|
||
| UI files now: | ||
| - render tool cards | ||
| - handle manifest dropdowns | ||
| - manage DOM events | ||
|
|
||
| ## 4. Tool Logic Moved to Feature Modules | ||
|
|
||
| `features/tools-feature.js` is the orchestrator responsible for: | ||
| - loading tool catalog | ||
| - managing recently used tools | ||
| - initializing UI rendering | ||
| - handling tool click events | ||
|
|
||
| This follows: | ||
| **Load Feature → Render UI → Call Services** | ||
|
|
||
|
|
||
| # Architecture Diagram | ||
| ```bash | ||
|
|
||
| +------------------------+ | ||
| | HTML Pages | | ||
| | index.html, tools.html | | ||
| +-----------+------------+ | ||
| | | ||
| v | ||
| +------------------------+ | ||
| | Feature Layer | | ||
| | sandbox-feature.js | | ||
| | tools-feature.js | | ||
| +-----------+------------+ | ||
| | | ||
| v | ||
| +------------------------+ | ||
| | UI Components | | ||
| | sandboxUI.js | | ||
| | toolsUI.js | | ||
| +-----------+------------+ | ||
| | | ||
| v | ||
| +------------------------+ | ||
| | Services Layer | | ||
| | objectService.js | | ||
| | manifestStorage.js | | ||
| +-----------+------------+ | ||
| | | ||
| v | ||
| +------------------------+ | ||
| | Utilities & Helpers | | ||
| | generalUtils.js | | ||
| +------------------------+ | ||
| ``` | ||
|
|
||
| # Outcomes of the Refactor | ||
|
|
||
| ### Clean system boundaries | ||
| UI, feature logic, and services no longer overlap. | ||
|
|
||
| ### Clarity for contributors | ||
| Anyone can locate: | ||
| - tool UI | ||
| - feature scripts | ||
| - API fetch logic | ||
|
|
||
| ### Testability | ||
| Services can be mocked independently. | ||
|
|
||
| ### Faster onboarding | ||
| New developer can learn architecture in one glance. | ||
|
|
||
| ### Extensibility | ||
| Adding tools no longer requires rewriting core files. | ||
|
|
||
|
|
||
| # TUTORIAL | ||
|
|
||
| ## How to Add a New Tool in the Refactored Playground | ||
|
|
||
| Below is the official standard onboarding workflow for future contributors. | ||
| ```bash | ||
| #### Step 1: Add tool in tool catalog | ||
| { | ||
| label: "IIIF Manifest Generator", | ||
| icon: "./img/manifest.png", | ||
| view: "./iiif-manifest.html", | ||
| description: "Generate simple IIIF Manifest Objects" | ||
| } | ||
|
|
||
| #### Step 2: Create Your UI File | ||
| /components/myToolUI.js | ||
| export function initMyToolUI() { | ||
| document.getElementById("run") | ||
| .addEventListener("click", () => { | ||
| alert("Tool Triggered"); | ||
| }); | ||
| } | ||
|
|
||
| #### Step 3: Add Feature File | ||
| /features/myTool-feature.js | ||
| import { initMyToolUI } from "../components/myToolUI.js"; | ||
|
|
||
| window.onload = () => { | ||
| initMyToolUI(); | ||
| }; | ||
|
|
||
| #### Step 4: Reference Feature in HTML | ||
| <script type="module" src="./js/features/myTool-feature.js"></script> | ||
|
|
||
| #### Step 5: Use RERUM API via Services | ||
| import { create } from "../services/objectService.js"; | ||
|
|
||
| async function storeManifest(obj) { | ||
| const result = await create(obj); | ||
| console.log("Manifest stored:", result); | ||
| } | ||
| ``` | ||
| ### Evidence of Architectural Work | ||
| - Tools for: | ||
| - manifest generation | ||
| - manifest storage | ||
| - recently used tools | ||
| - Refactor PRs merged into dev_devayani | ||
| - All fetch logic removed from UI | ||
| - UI components rewritten into modular files | ||
| - New IIIF manifest generator added as an independent tool page | ||
|
|
||
| ### Contributor Impact | ||
| ##### Maintainers benefit because: | ||
| - code is uniformly structured | ||
| - UI bugs isolated to components | ||
| - API bugs isolated to service layer | ||
| ##### Incoming developers benefit because: | ||
| - path for new tools is standardized | ||
| - architecture is self-explanatory | ||
| ##### External contributors benefit because: | ||
| - catalog entries are transparent | ||
| - no need to edit core scripts | ||
|
|
||
| ### Leadership Reflection | ||
| As Tech Lead, I authored the refactor plan, structured implementation via issues, and reviewed PRs using architecture acceptance criteria: | ||
| - UI components must not call fetch() | ||
| - Services must be reusable | ||
| - Tools must register in the catalog | ||
| - Feature modules must initialize UI | ||
| - Utilities cannot contain business logic | ||
|
|
||
| This refactor was also guided by governance principles from Birdaro Training, focusing on: | ||
| - clarity | ||
| - documentation | ||
| - contributor health | ||
| - long-term sustainability | ||
|
|
||
| The final result is a cleaner codebase that future SLU teams and external developers can confidently build upon. | ||
|
|
||
| ### Conclusion | ||
| This refactor marks a milestone for the RERUM Playground: | ||
| - maintainable architecture | ||
| - predictable structure | ||
| - modular extensibility | ||
| - future-proof onboarding | ||
|
|
||
| As the Playground grows with IIIF, annotation tools, and data transformation utilities, this architecture ensures that innovation does not require rewriting foundations. | ||
|
|
||
| Instead, it empowers: | ||
| - reuse | ||
| - modularity | ||
| - contributor self-sufficiency | ||
|
|
||
| This is the foundation upon which the next generation of RERUM ecosystem tools will be built. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LTS is node 24 now!