Skip to content

Commit cbcfa88

Browse files
committed
docs: improve README, add visuals
Signed-off-by: Aryan Goyal <[email protected]>
1 parent 08aa777 commit cbcfa88

File tree

8 files changed

+138
-0
lines changed

8 files changed

+138
-0
lines changed

README.md

+92
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,95 @@
11
# Socratic Leetcode
22

33
This chrome extension helps you to solve leetcode questions on your own by providing insightful questions according to the socratic teaching philosophy
4+
5+
> project made for devfolio's "GenAI Exchange Hackathon by Google"
6+
7+
- [Installation](#installation)
8+
- [Description](#description)
9+
- [In Scope](#in-scope)
10+
- [Out of Scope](#out-of-scope)
11+
- [Future Opportunities](#future-opportunities)
12+
- [Challenges](#challenges)
13+
- [Site Data Pipeline](#site-data-pipeline)
14+
- [CI](#ci)
15+
- [Working](#working)
16+
- [Architecture](#architecture)
17+
18+
## Installation
19+
20+
1. Download the package `socratic-code.zip` from Releases
21+
22+
2. Extract it
23+
24+
```bash
25+
# USE unzip
26+
unzip socratic-code.zip
27+
# OR USING 7z
28+
7z x socratic-code.zip
29+
```
30+
31+
3. Open chrome, go to `chrome://extensions/` and enable developer mode
32+
33+
4. Click on Load unpacked and navigate to the `build` folder you just extracted
34+
35+
## Description
36+
37+
This project aims to create a reliable teaching assistant for Data Structures and Algorithms questions. The project is further narrowed down to create an assistant for Leetcode, which is the most popular website for interview and DSA prep. It is deployed as a Chrome Browser Extension.
38+
39+
This teaching assistant will never tell the user the answer completely, as it is based on the Socratic teaching method, in which the teacher asks insightful questions to guide the pupil towards the answer instead of telling them the answer.
40+
41+
### In Scope
42+
43+
- Creating a teaching assistant that guides the user towards figuring out a leetcode problem by themselves
44+
- Accurate and reliable information
45+
46+
### Out of Scope
47+
48+
- Solving the question or running the code that the user inputs is out of scope for this project
49+
50+
### Future Opportunities
51+
52+
- Creating a problem database for easy identifification of the problem. This can be a simple KV with `problem name`->`problem description`
53+
- Creating a solution vector database for these problems, which can be used to give more context to the LLM and perform RAG(Retreival Augmented Generation)
54+
- After implementing RAG, a point based system for monetizing the extension can be developed. Eg. User tops up 5000 coins. 10 coins can generate, say, 2 insightful questions for the given problem
55+
56+
## Challenges
57+
58+
### Site Data Pipeline
59+
60+
It was quite hard to get the input data of the leetcode website. This is because chrome runs the content scripts of the extension in a secluded environment which doesnot have the the properties of the `window` element in the webpage.
61+
62+
The code editor input that leetcode uses is called `monaco`, and we can easily get the input data in correct formatting by entering `window.monaco.editor.getModels()[0].getValue()` in the leetcode website. But this was not the case for the extension, as it doesnot have the properties of `window` element.
63+
64+
Although we can get the properties of this `window` element by using the `"MAIN"` `WORLD` in the content script, it is then not possible to send this data to the outside environment due to security reasons.
65+
66+
This was solved by identifying the correct elements and selecting them with `document.querySelector()`
67+
68+
### CI
69+
70+
Due to my inexperience with Continuous Integration, it took me quite a lot to set it up.
71+
72+
This includes:
73+
74+
1. The chrome extension CI, which is a github workflow to build the extension using `pnpm` and releasing it with github Releases
75+
2. The backend CI, which is a github workflow for publishing the backend service as a docker image on the `ghcr` registry, or Github's docker registry
76+
77+
## Working
78+
79+
The following images represesnt the working of the extension
80+
81+
<p align="center">
82+
<img src="./docs/images/sc.png">
83+
<img src="./docs/images/insights.png">
84+
</p>
85+
86+
<p align="center">
87+
<img src="./docs/images/browser-sc.png">
88+
<img src="./docs/images/browser-insights.png">
89+
</p>
90+
91+
## Architecture
92+
93+
<p align="center">
94+
<img src="./docs/images/arch.png">
95+
</p>

docs/demo.mkv

5.29 MB
Binary file not shown.

docs/graphviz/architecture.gv

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
digraph output_string {
2+
bgcolor=transparent;
3+
graph [fontsize=26 fontname="HackNerdFont" style=filled color=lightblue];
4+
node [fontsize=26 fontname="HackNerdFont" style=filled color=white shape=box];
5+
compound=true;
6+
rankdir=LR;
7+
label = "Architecture";
8+
9+
subgraph cluster_output {
10+
11+
subgraph cluster_byte2 {
12+
label = "backend";
13+
color = lightblue4;
14+
subgraph cluster_char3 {
15+
label = "Golang";
16+
color = lightblue3;
17+
API[label="gofiber API"]
18+
}
19+
}
20+
subgraph cluster_byte3 {
21+
label = "Google";
22+
color = lightblue4;
23+
subgraph cluster_char1 {
24+
label = "LLM";
25+
color = lightblue3;
26+
"Google Gemini API"
27+
}
28+
}
29+
subgraph cluster_byte1 {
30+
label = "frontend";
31+
color = lightblue4;
32+
dummy[color=lightblue4 fontcolor=lightblue4]
33+
subgraph cluster_char2 {
34+
label = "chrome extension";
35+
color = lightblue3;
36+
"webpage(leetcode)"->"content script"[label="DOM Selector"]
37+
"content script"->"bg script"[label="Chrome message API"]
38+
"bg script"->"popup"[label="Chrome message API"]
39+
}
40+
}
41+
API->"Google Gemini API"[label="TCP"]
42+
"Google Gemini API"->API[label="TCP"]
43+
"popup"->API[label="TCP"]
44+
API->"popup"[label="TCP"]
45+
}
46+
}

docs/images/arch.png

83.1 KB
Loading

docs/images/browser-insights.png

179 KB
Loading

docs/images/browser-sc.png

166 KB
Loading

docs/images/insights.png

40.7 KB
Loading

docs/images/sc.png

33.8 KB
Loading

0 commit comments

Comments
 (0)