Migration
This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs.
Contact me
README.md
d658fcc4ea9f3bb562fd00dce8f863934560c56c
· 4.1 KB · 52 lines
raw
| 1 | # My git viewer |
| 2 | |
| 3 | ### Why I did this |
| 4 | |
| 5 | So, the premise behind this project was a few different things: |
| 6 | |
| 7 | - I wanted a git viewer stack that, while modular, remained light. |
| 8 | - I liked the idea of having reusable "templates" rather than generating the HTML dynamically in the code. This is much closer to how things like Hugo operate. |
| 9 | - It needs to be easy to extend (modularity!). A core is responsible for loading a git repo's context and other request state, but all "real" functionality is implemented via modules. I could add/remove things without needing to worry (too much...) about breaking unrelated things. |
| 10 | - I wanted something that was modern, but didn't require javascript to operate. All features on this site work without javascript, though your experience is improved with it. |
| 11 | - I wanted to have a way to view private git repositories using systems I already have. |
| 12 | - I don't want to/have the capability to SSH clone my repos to show something off. |
| 13 | - Could I have done this in cgit? Perhaps, but it wasn't built for it. |
| 14 | - And, probably most visibly, this was a trial in "vibe coding". While the idea around the design of this software was mine, I wrote very little of the code. Especially the UI, and this is for the better. I am not a graphics designer and whatever slop the LLM pumps out (with my input here and there) will be leagues better than whatever I do; for better or worse. |
| 15 | |
| 16 | The name "gsg" doesn't mean much (I don't name things). It're pretty much "git static generator". It was the placeholder when I was thinking of a system that was "kind of a combination of cgit's lightness and hugo's composability and templating". |
| 17 | |
| 18 | ### The design |
| 19 | |
| 20 | First and foremost, the AI writeup is in ./llm_readme.md. Read that if you want all of the verbose details. |
| 21 | |
| 22 | Also, as alluded to above, no javascript is strictly required. The few places it is used it is just used to make the experience nicer, and a fallback always exists. For example, the JSON/YAML codepath has a JS module that allows you to search for values/keys, perform folding, etc. This is a core design tenant: JS always hydrates what exists already. |
| 23 | |
| 24 | (Not) Broadly speaking, as stated above, this project is split up into: |
| 25 | |
| 26 | - The core |
| 27 | - gitx - the module that actually interfaces with git. This transforms a context into a re-usable struct (should I ever want to use a real implementation) |
| 28 | - access - Consolidated checks for whether someone can see/not see a repo |
| 29 | - session - Owns all privileged access logic. It generates/verifies tokens that are used across the site. Everything is stateless once authenticated. |
| 30 | - authn - Route owner that defines login/logout flows. Uses session internally |
| 31 | - httpx - Shared helpers used when generating responses/evaling a req |
| 32 | - notices - Logic for me to post notices to the site or repos |
| 33 | - share - Logic for authenticated users to mint links to private repos they are allowed to. Uses same auth logic as users under the hood. |
| 34 | - api - Exposes repo details as a JSON endpoint, will be used by my main site later on |
| 35 | - core/site - All the main things needed to make this tick. Build req context, define routes and where they live, define module registration structs. |
| 36 | - The modules |
| 37 | - blob - Responsible for returning files (raw or templated) |
| 38 | - commit - Render a commit |
| 39 | - compare - Render a diff between two commits/refs |
| 40 | - graph - Render commit log graph |
| 41 | - image - Image preview, defines compatible file types and max size |
| 42 | - markdown - Render markdown |
| 43 | - readme - Inherits markdown to render a readme (what you see here!) |
| 44 | - notices - Handles cache invalidation for repos that need one rendered |
| 45 | - log - View the git log |
| 46 | - repos - Aggregates the repos you may view based on session |
| 47 | - structured - Whether a file is a YAML or JSON. If so, it prepares data for JS in the frontend to perform folding and suchA |
| 48 | - tree - the directory-structure viewer |
| 49 | |
| 50 | As time goes on, I am sure I will find more things to add to this. This is really meant to be a project for me, not necessarily building "the next git viewer for everyone". |
| 51 | |
| 52 | I figured I would upload this here in case my tokens are useful for others. Enjoy! |