From c754c4f8e8e83975be7be2fa717d90cbb4ec3f91 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Tue, 15 Feb 2022 11:34:37 -0500 Subject: [PATCH] include link to repo --- .../Posts/Building-a-remote-cache-server-for-Turborepo.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TerribleDev.Blog.Web/Posts/Building-a-remote-cache-server-for-Turborepo.md b/src/TerribleDev.Blog.Web/Posts/Building-a-remote-cache-server-for-Turborepo.md index 93c4be0..8dd6078 100644 --- a/src/TerribleDev.Blog.Web/Posts/Building-a-remote-cache-server-for-Turborepo.md +++ b/src/TerribleDev.Blog.Web/Posts/Building-a-remote-cache-server-for-Turborepo.md @@ -9,6 +9,7 @@ tags: - Build --- + [Turborepo](https://turborepo.org/) is a tool that came across my virtual desk recently. Monorepo develoment has been around for a long time. This is a strategy where all of your code remains in one repository regardless of services. A lot of people use monorepo's even for microservices. The huge upside is to keep everything in one place, which allows for development efficiency, such as grepping an entire codebase for specific keywords. A quick example would be a top level directory which has child directories that each contain an npm package, unlike publishing these packages, you access them locally as though they were published. @@ -129,4 +130,8 @@ The team api is supposed to look something like the following. > What about the --team flag? -So when requests are made with `--team` a query string `?slug=team` is added to the request. You can use this to ensure a particular user is in the given team, and you can fragment your caches by team. I ommitted that code from the above example, but the easiest way would be to have `./cache/${team}/${hash}` directory structure for the caches on disk. Note, on the GET requests you should auth the token against the team ID, and return a 404 if the user is not in the team. I wouldn't opt to return a Unauthorized header, as that can be used by bad actors to cycle through tokens to know which one will work to cause harm. \ No newline at end of file +So when requests are made with `--team` a query string `?slug=team` is added to the request. You can use this to ensure a particular user is in the given team, and you can fragment your caches by team. I ommitted that code from the above example, but the easiest way would be to have `./cache/${team}/${hash}` directory structure for the caches on disk. Note, on the GET requests you should auth the token against the team ID, and return a 404 if the user is not in the team. I wouldn't opt to return a Unauthorized header, as that can be used by bad actors to cycle through tokens to know which one will work to cause harm. + +## The Result + +An extremely minimal server [is in this github repo](https://github.com/TerribleDev/turbogo) (although you shouldn't probably use it without building it out more). \ No newline at end of file