Day 33: CodeHost
Today I fixed a logical bug in the project. When the project is finished creating, all the files are moved to the R2 bucket under their projectId. Let’s say there were a few icons in version 1 of a project, and after the build, all these files are stored in the R2 folder. If a user later removes a copy of this icon, pushes code, and deploys another commit, the new file is moved to the R2 bucket. However, old files that are no longer used will remain in the folder. This leads to unnecessary use of storage space.
To fix this, I updated the container system to push files to the taskId projectId folder for each project. This way, I can subsequently remove all files associated with invalid deployments, preventing the storage of useless data.
Get Alwin Sunil’s stories in your inbox
Join Medium for free to get updates from this writer.
Additionally, I had to update the request handler service to make this change work. I added a new column called productionTaskId to the Project table. Then, all requests are proxied to the projectId/taskId folder in R2.
Another functionality I missed earlier is to delete all deployment files for the project when the user deletes them. Now, when a project is deleted, all associated deployment files are also removed from R2.
That’s all for today. thank you.





