|
| 1 | +--- |
| 2 | +title: "GSoC '25 Week 02 Update by Nikhil Bhatt" |
| 3 | +excerpt: "Implemented edit functionality for project repositories and introduced a forking mechanism for collaborative workflows." |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-06-10" |
| 6 | +slug: "2025-06-10-gsoc-25-nikhilbhatt-week02" |
| 7 | +author: "@/constants/MarkdownFiles/authors/nikhilbhatt.md" |
| 8 | +tags: "gsoc25,sugarlabs,week02,nikhilbhatt" |
| 9 | +image: "assets/Images/GSOC.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 02 Progress Report by Nikhil Bhatt |
| 15 | + |
| 16 | +**Project:** [Git backend for Musicblocks](https://github.com/benikk/musicblocks-backend) |
| 17 | +**Mentors:** [Walter Bender](https://github.com/walterbender), [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Reporting Period:** 2025-06-7 – 2025-06-14 |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Goals for This Week |
| 23 | + |
| 24 | +- **Implement an edit route** to allow users to update project data securely using hashed keys. |
| 25 | +- **Design and implement a forking mechanism** where users can fork existing project repositories into new independent ones. |
| 26 | +- **Integrate project origin tracking** in forked repos through metadata. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## This Week's Achievements |
| 31 | + |
| 32 | +1. **Edit Project Functionality** |
| 33 | + - Created a secure API endpoint that allows users to update their project repository content using a key-authenticated system. |
| 34 | + - The backend checks the key hash stored in the `metaData.json` before applying any updates. |
| 35 | + - PR: [Edit Project API](https://github.com/BeNikk/musicblocks-backend/commit/1f61a089de7d8dbede2d46a101611133a1190bf6) |
| 36 | + |
| 37 | +2. **Fork Project Repository** |
| 38 | + - Developed a new feature that enables students to fork other students' public projects into their own repositories under the same organization. |
| 39 | + - Forked repositories retain original content (`projectData.json`, `metaData.json`) and include the original repository link in the metadata (`forkedFrom` field). |
| 40 | + - PR: [Fork Feature](https://github.com/BeNikk/musicblocks-backend/commit/d1b7220476dc1fd58c1b38dc59c8a4991871ac45) |
| 41 | + |
| 42 | +3. **Project Metadata Enhancements** |
| 43 | + - Updated the metadata structure to support fork tracking and improve key validation. |
| 44 | + - Ensured consistency between project ownership, fork source, and editing rights. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## Challenges & How I Overcame Them |
| 49 | + |
| 50 | +- **Challenge:** Understanding and handling GitHub’s `SHA` and `Base64` requirements when editing file content through the API. |
| 51 | + **Solution:** Read GitHub API docs and integrated `Buffer.from(...).toString('base64')` and used file `sha` to ensure proper file overwrites. |
| 52 | + |
| 53 | +- **Challenge:** Unsure if re-initializing Octokit and generating a new installation token per request was optimal. |
| 54 | + **Solution:** Kept this approach for now as each request is stateless and works correctly. Optimization will be explored after baseline features are stable. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Key Learnings |
| 59 | + |
| 60 | +- Learned how to **authenticate and authorize edits** to GitHub repos using hashed keys and GitHub’s content API. |
| 61 | +- Understood the internal structure of GitHub forks and metadata handling. |
| 62 | +- Improved knowledge of **Octokit**, GitHub APIs, and best practices for writing file content (`projectData.json`, `metaData.json`) to a repo. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## Next Week's Roadmap |
| 67 | + |
| 68 | +- Add **pull request functionality** between forked and original projects. |
| 69 | +- Improve project listing UI with fork indicators. |
| 70 | +- Begin planning for collaborator permissions and PR review workflow. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Resources & References |
| 75 | + |
| 76 | +- **GitHub API Docs:** [REST Reference](https://docs.github.com/en/rest) |
| 77 | +- **Octokit:** [octokit/rest.js](https://github.com/octokit/rest.js) |
| 78 | +- **MetaData Example:** `metaData.json` includes `hashedKey`, `theme`, and `forkedFrom`. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Acknowledgments |
| 83 | + |
| 84 | +Thank you to my mentors and the Sugar Labs community for guidance and feedback, and to the GitHub community for their detailed API documentation and tooling support. |
| 85 | + |
| 86 | +--- |
0 commit comments