Uploaded November 2026 | Updated November 2026, 21 hours ago
In this episode of AI Coding with Dr. Chuck, I finish refactoring Tsugi's legacy PHP APIs into controllers, deploy the changes to production, and then spend some time thinking through the architecture for the next generation of APIs.
The existing Tsugi APIs have accumulated over more than a decade. Many began as standalone PHP scripts written to solve specific problems. I'm gradually moving this code into a more consistent controller-based architecture while preserving existing behavior.
Before refactoring, I used Cursor AI to build automated tests for the existing APIs. After moving the code into controllers, I ran the expanded test suite and submitted the changes for CodeRabbit review. CodeRabbit identified several longstanding security issues that we were able to correct.
With the changes tested and reviewed, I create a Git release as a rollback point, merge the pull request, and deploy the refactoring to my production servers. We then verify that Python for Everybody and its autograders continue working.
The second half of the video is an architectural conversation with Cursor about where Tsugi's APIs should go next.
Topics include:
- Moving legacy PHP API scripts into controllers
- Building PHPUnit and Panther functionality tests
- Using Docker for automated browser testing
- Reviewing AI-generated refactoring with CodeRabbit
- Finding and fixing longstanding security issues
- Deploying changes to production with rollback points
- My "plateau" approach to production releases
- Monitoring production logs and uptime
- Planning standards-based IMS/LTI 1.3 APIs
- Assignment and Grade Services (AGS) and Names and Role Provisioning Services (NRPS)
- Dynamic registration, OAuth tokens, and deep linking
- Designing proprietary APIs that reuse LTI authorization
- Exploring Model Context Protocol (MCP) for future learning management systems
- Organizing controllers and authentication responsibilities
One interesting aspect of this episode is the transition from implementation to architecture. Once the existing API refactoring is complete, I use Cursor's agent interface to think through three categories of future APIs: standards-based IMS services, Tsugi-specific APIs built around LTI authorization, and MCP services that could eventually allow AI agents to interact with course content.
We also discuss why I want to leave the legacy /api endpoints intact while developing these new services separately.
The goal is to modernize Tsugi incrementally, keep the production system stable, and prepare the codebase for new LTI 1.3 functionality and eventually MCP integration.
Tsugi: tsugi.org
Python for Everybody: py4e.com
I'll be teaching Python for Everybody with AI beginning in January 2027. Visit py4e.com for course information and announcements.
#Tsugi #CursorAI #LTI #MCP #PHP #AICoding
In this episode of AI Coding with Dr. Chuck, I finish refactoring Tsugi's legacy PHP APIs into controllers, deploy the changes to production, and then spend some time thinking through the architecture for the next generation of APIs.
The existing Tsugi APIs have accumulated over more than a decade. Many began as standalone PHP scripts written to solve specific problems. I'm gradually moving this code into a more consistent controller-based architecture while preserving existing behavior.
Before refactoring, I used Cursor AI to build automated tests for the existing APIs. After moving the code into controllers, I ran the expanded test suite and submitted the changes for CodeRabbit review. CodeRabbit identified several longstanding security issues that we were able to correct.
With the changes tested and reviewed, I create a Git release as a rollback point, merge the pull request, and deploy the refactoring to my production servers. We then verify that Python for Everybody and its autograders continue working.
The second half of the video is an architectural conversation with Cursor about where Tsugi's APIs should go next.
Topics include:
- Moving legacy PHP API scripts into controllers
- Building PHPUnit and Panther functionality tests
- Using Docker for automated browser testing
- Reviewing AI-generated refactoring with CodeRabbit
- Finding and fixing longstanding security issues
- Deploying changes to production with rollback points
- My "plateau" approach to production releases
- Monitoring production logs and uptime
- Planning standards-based IMS/LTI 1.3 APIs
- Assignment and Grade Services (AGS) and Names and Role Provisioning Services (NRPS)
- Dynamic registration, OAuth tokens, and deep linking
- Designing proprietary APIs that reuse LTI authorization
- Exploring Model Context Protocol (MCP) for future learning management systems
- Organizing controllers and authentication responsibilities
One interesting aspect of this episode is the transition from implementation to architecture. Once the existing API refactoring is complete, I use Cursor's agent interface to think through three categories of future APIs: standards-based IMS services, Tsugi-specific APIs built around LTI authorization, and MCP services that could eventually allow AI agents to interact with course content.
We also discuss why I want to leave the legacy /api endpoints intact while developing these new services separately.
The goal is to modernize Tsugi incrementally, keep the production system stable, and prepare the codebase for new LTI 1.3 functionality and eventually MCP integration.
Tsugi: tsugi.org
Python for Everybody: py4e.com
I'll be teaching Python for Everybody with AI beginning in January 2027. Visit py4e.com for course information and announcements.
#Tsugi #CursorAI #LTI #MCP #PHP #AICoding










