neon_arch commited on
Commit
493696f
Β·
1 Parent(s): 2b41fb9

πŸ“ docs: update the project structure and the associated explaination (#439)

Browse files
Files changed (1) hide show
  1. docs/developing.md +57 -45
docs/developing.md CHANGED
@@ -12,7 +12,7 @@ This page of the docs outlines how to get **Websurfx** up and running in a devel
12
  - [NixOS Dev Shell using Nix Flake](#nixos-dev-shell-using-nix-flake-)
13
  - [Local Development with Docker Compose](#local-development-with-docker-compose-)
14
  - [Project Commands](#project-commands)
15
- + - [Environment Variables](#environment-variables)
16
  - [Git Strategy](#git-strategy)
17
  - [Flow](#git-flow)
18
  - [Branches](#git-branch-naming)
@@ -57,7 +57,7 @@ $ npm i -g stylelint
57
  $ npm i -g stylelint stylelint-config-standard postcss-lit
58
  ```
59
 
60
- > **Note**
61
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
62
 
63
  - `Cargo-watch` installed on your system which will allow you to auto-build the project when any checks occur in the source code files in the codebase (`websurfx` directory). Before you install `cargo-watch` on your system, make sure you have `cargo` installed on your system. To install `cargo-watch` run the following command:
@@ -69,7 +69,7 @@ cargo install cargo-watch
69
  - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
70
  - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/).
71
 
72
- > **Note**
73
  > For **rolling release Linux distributions (distros)**, the above-mentioned required packages except for `stylelint` and `cargo-watch` can also be installed via the distro-specific package manager.
74
  >
75
  > **For Example:**
@@ -149,7 +149,7 @@ Once you have finished running the above command, Websurfx should now be served
149
 
150
  This section covers how to use and set up the Gitpod development environment for working on the project.
151
 
152
- > **Note**
153
  > By default the project only supports the Vscode **IDE/Editor** for Gitpod.
154
 
155
  #### Launching Gitpod
@@ -310,13 +310,13 @@ Before you start working on the project. You will need the following packages in
310
  $ npm i -g stylelint
311
  ```
312
 
313
- > **Note**
314
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
315
 
316
  - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
317
  - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/).
318
 
319
- > **Note**
320
  > For **rolling release Linux distributions (distros)**, the above-mentioned all required packages can also be installed via the distro-specific package manager.
321
  >
322
  > **For Example:**
@@ -355,7 +355,7 @@ If you have followed the above section then you should have a cloned repository
355
  $ docker compose -f dev.docker-compose.yml up
356
  ```
357
 
358
- > **Note**
359
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
360
 
361
  Once you have finished running the above command, Websurfx should now be served on the address http://127.0.0.1:8080. Hot reload is enabled, so making changes to any of the files will trigger the project to be rebuilt.
@@ -366,13 +366,12 @@ Once you have finished running the above command, Websurfx should now be served
366
 
367
  - `cargo build`: Builds the project.
368
 
369
- > **Note**
370
  > When you build the project first time with the above command it will require the app to compile every dependency in the project which will then be cached on your system. So when you compile the app next time it will only compile for the new changes.
371
 
372
- + `cargo run`: Starts the app and serves the project on http://127.0.0.1:8080.
373
 
374
-
375
- > **Important**
376
  > You must run the build command first.
377
 
378
  #### Development
@@ -458,10 +457,10 @@ When you submit your pull request, include the required info, by filling out the
458
  - If any dependencies were added, explain why it was needed, and state the cost. associated, and confirm it does not introduce any security, privacy, or speed issues
459
  - Optionally, provide a checklist of all the changes that were included in the pull request.
460
 
461
- > **Important**
462
  > Make sure to fill all the required/mandatory sections of the pull request as filling them helps us distinguish between spam pull requests and legitimate pull requests.
463
 
464
- > **Note**
465
  > The pull request template contains comments in the following form `<!-- -->` which are used to provide a guide on what should be provided under each heading of the template. These comments are never rendered when the pull request is either created or updated and hence anything provided in such comments is never displayed.
466
 
467
  ## Resources for Beginners
@@ -498,7 +497,7 @@ For Rust, CSS, JS, HTML, Git, and Docker- you'll need an IDE (e.g. [VSCode](http
498
 
499
  Linting is done using [Cargo Clippy](https://doc.rust-lang.org/clippy/) and [StyleLint](https://stylelint.io/) or [ESLint](https://eslint.org/). Also, linting is run as a git pre-commit hook.
500
 
501
- > **Important**
502
  > All lint checks must pass before any PR can be merged.
503
 
504
  Styleguides to follow:
@@ -509,7 +508,7 @@ Styleguides to follow:
509
 
510
  ## Application Structure
511
 
512
- > **Important**
513
  > We follow the Unix style naming conventions for all the files and folders in the project (except for all files under the `themes` and `colorschemes` folder in the frontend's source code which requires that the names of the files and folders should be in lowercase and the words be separated with a hyphen.) which includes the name of the files and folders should be in lowercase and every word should be separated with an underscore.
514
 
515
  **Files in the root of the codebase:** `./`
@@ -541,30 +540,42 @@ Styleguides to follow:
541
  ./public/
542
  β”œβ”€β”€ robots.txt # Robots file for the Website.
543
  β”œβ”€β”€ images # Images for the Website.
544
- β”œβ”€β”€ static # The directory containing all the UI handlers.
545
- β”‚ β”œβ”€β”€ cookies.js # Handles the loading of saved cookies.
546
- β”‚ β”œβ”€β”€ error_box.js # Handles the toggling functionality of the error box on the search page.
547
- β”‚ β”œβ”€β”€ index.js # Functions to handle the search functionality of the search bar.
548
- β”‚ β”œβ”€β”€ pagination.js # Functions to handle the navigation between the previous and next page in the search page.
549
- β”‚ β”œβ”€β”€ search_area_options.js # Changes the search options under the search bar in the search page according to the safe search level set using the URL safesearch parameter.
550
- β”‚ β”œβ”€β”€ settings.js # Handles the settings and saving of all the settings page options as a cookie.
551
- β”‚ β”œβ”€β”€ colorschemes # A folder containing all the popular colorscheme files as CSS files.
552
- β”‚ └── themes # A folder containing all the popular theme files as CSS files.
553
- └── templates # Folder containing all the template files for the different pages on the website.
554
- β”œβ”€β”€ 404.html # A 404-page template.
555
- β”œβ”€β”€ about.html # An about page template.
556
- β”œβ”€β”€ bar.html # A template for the search bar.
557
- β”œβ”€β”€ cookies_tab.html # A template for the cookies tab for the settings page.
558
- β”œβ”€β”€ engines_tab.html # A template for the engines tab for the settings page.
559
- β”œβ”€β”€ footer.html # A footer template for all pages.
560
- β”œβ”€β”€ general_tab.html # A template for the general tab for the settings page.
561
- β”œβ”€β”€ header.html # A header template for all pages.
562
- β”œβ”€β”€ index.html # A home page template.
563
- β”œβ”€β”€ navbar.html # A navbar template for the header template.
564
- β”œβ”€β”€ search.html # A search page template.
565
- β”œβ”€β”€ search_bar.html # A search bar template specifically for the search page.
566
- β”œβ”€β”€ settings.html # A settings page template.
567
- └── user_interface_tab.html # A template for the user interface tab for the settings page.
 
 
 
 
 
 
 
 
 
 
 
 
568
  ```
569
 
570
  **Backend Source:** `./src/`
@@ -601,12 +612,13 @@ Styleguides to follow:
601
  β”‚ β”œβ”€β”€ aggregator.rs # Provides code aggregate and fetches results from the upstream engines.
602
  β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
603
  β”‚ └── user_agent.rs # Provides a helper function to allow random user agents to pass in the server request code to improve user privacy and avoiding detected as a bot.
604
- └── server # A folder that holds code to handle the routes for the search engine website.
605
- β”œβ”€β”€ mod.rs # A module file for the rust project.
606
- β”œβ”€β”€ router.rs # Provides functions to handle the different routes on the website.
607
- └── routes # A folder that contains code to handle the bigger route for the website.
608
- β”œβ”€β”€ mod.rs # A module file for the rust project.
609
- └── search.rs # Provides the function to handle the search route.
 
610
  ```
611
 
612
  ## Development Tools
 
12
  - [NixOS Dev Shell using Nix Flake](#nixos-dev-shell-using-nix-flake-)
13
  - [Local Development with Docker Compose](#local-development-with-docker-compose-)
14
  - [Project Commands](#project-commands)
15
+ - [Environment Variables](#environment-variables)
16
  - [Git Strategy](#git-strategy)
17
  - [Flow](#git-flow)
18
  - [Branches](#git-branch-naming)
 
57
  $ npm i -g stylelint stylelint-config-standard postcss-lit
58
  ```
59
 
60
+ > [!Note]
61
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
62
 
63
  - `Cargo-watch` installed on your system which will allow you to auto-build the project when any checks occur in the source code files in the codebase (`websurfx` directory). Before you install `cargo-watch` on your system, make sure you have `cargo` installed on your system. To install `cargo-watch` run the following command:
 
69
  - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
70
  - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/).
71
 
72
+ > [!Note]
73
  > For **rolling release Linux distributions (distros)**, the above-mentioned required packages except for `stylelint` and `cargo-watch` can also be installed via the distro-specific package manager.
74
  >
75
  > **For Example:**
 
149
 
150
  This section covers how to use and set up the Gitpod development environment for working on the project.
151
 
152
+ > [!Note]
153
  > By default the project only supports the Vscode **IDE/Editor** for Gitpod.
154
 
155
  #### Launching Gitpod
 
310
  $ npm i -g stylelint
311
  ```
312
 
313
+ > [!Note]
314
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
315
 
316
  - `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
317
  - Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/).
318
 
319
+ > [!Note]
320
  > For **rolling release Linux distributions (distros)**, the above-mentioned all required packages can also be installed via the distro-specific package manager.
321
  >
322
  > **For Example:**
 
355
  $ docker compose -f dev.docker-compose.yml up
356
  ```
357
 
358
+ > [!Note]
359
  > In the above command the dollar sign(**$**) refers to running the command in privileged mode by using utilities `sudo`, `doas`, `pkgexec`, or any other privileged access methods.
360
 
361
  Once you have finished running the above command, Websurfx should now be served on the address http://127.0.0.1:8080. Hot reload is enabled, so making changes to any of the files will trigger the project to be rebuilt.
 
366
 
367
  - `cargo build`: Builds the project.
368
 
369
+ > [!Note]
370
  > When you build the project first time with the above command it will require the app to compile every dependency in the project which will then be cached on your system. So when you compile the app next time it will only compile for the new changes.
371
 
372
+ - `cargo run`: Starts the app and serves the project on http://127.0.0.1:8080.
373
 
374
+ > [!Important]
 
375
  > You must run the build command first.
376
 
377
  #### Development
 
457
  - If any dependencies were added, explain why it was needed, and state the cost. associated, and confirm it does not introduce any security, privacy, or speed issues
458
  - Optionally, provide a checklist of all the changes that were included in the pull request.
459
 
460
+ > [!Important]
461
  > Make sure to fill all the required/mandatory sections of the pull request as filling them helps us distinguish between spam pull requests and legitimate pull requests.
462
 
463
+ > [!Note]
464
  > The pull request template contains comments in the following form `<!-- -->` which are used to provide a guide on what should be provided under each heading of the template. These comments are never rendered when the pull request is either created or updated and hence anything provided in such comments is never displayed.
465
 
466
  ## Resources for Beginners
 
497
 
498
  Linting is done using [Cargo Clippy](https://doc.rust-lang.org/clippy/) and [StyleLint](https://stylelint.io/) or [ESLint](https://eslint.org/). Also, linting is run as a git pre-commit hook.
499
 
500
+ > [!Important]
501
  > All lint checks must pass before any PR can be merged.
502
 
503
  Styleguides to follow:
 
508
 
509
  ## Application Structure
510
 
511
+ > [!Important]
512
  > We follow the Unix style naming conventions for all the files and folders in the project (except for all files under the `themes` and `colorschemes` folder in the frontend's source code which requires that the names of the files and folders should be in lowercase and the words be separated with a hyphen.) which includes the name of the files and folders should be in lowercase and every word should be separated with an underscore.
513
 
514
  **Files in the root of the codebase:** `./`
 
540
  ./public/
541
  β”œβ”€β”€ robots.txt # Robots file for the Website.
542
  β”œβ”€β”€ images # Images for the Website.
543
+ └── static # The directory containing all the UI handlers.
544
+ β”œβ”€β”€ cookies.js # Handles the loading of saved cookies.
545
+ β”œβ”€β”€ error_box.js # Handles the toggling functionality of the error box on the search page.
546
+ β”œβ”€β”€ index.js # Functions to handle the search functionality of the search bar.
547
+ β”œβ”€β”€ pagination.js # Functions to handle the navigation between the previous and next page in the search page.
548
+ β”œβ”€β”€ search_area_options.js # Changes the search options under the search bar in the search page according to the safe search level set using the URL safesearch parameter.
549
+ β”œβ”€β”€ settings.js # Handles the settings and saving of all the settings page options as a cookie.
550
+ β”œβ”€β”€ colorschemes # A folder containing all the popular colorscheme files as CSS files.
551
+ └── themes # A folder containing all the popular theme files as CSS files.
552
+ ```
553
+
554
+ **Fronted Maud HTML Framework Source:** `./src/templates/`
555
+
556
+ ```
557
+ ./src/templates/
558
+ β”œβ”€β”€ mod.rs # A module file for the rust project.
559
+ β”œβ”€β”€ partials # A folder containing the code for partials for the views.
560
+ β”‚ β”œβ”€β”€ bar.rs # Provides partial code for the search bar.
561
+ β”‚ β”œβ”€β”€ footer.rs # Provides partial code for the footer section.
562
+ β”‚ β”œβ”€β”€ header.rs # Provides partial code for the header section.
563
+ β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
564
+ β”‚ β”œβ”€β”€ navbar.rs # Provides partial code for the navbar inside the header section.
565
+ β”‚ β”œβ”€β”€ search_bar.rs # Provides partial code for the search bar present in the search page.
566
+ β”‚ └── settings_tabs # A folder containing all the partials for the settings page tabs.
567
+ β”‚ β”œβ”€β”€ cookies.rs # Provides partial code for the cookies tab.
568
+ β”‚ β”œβ”€β”€ engines.rs # Provides partial code for the engines tab.
569
+ β”‚ β”œβ”€β”€ general.rs # Provides partial code for the general tab.
570
+ β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
571
+ β”‚ └── user_interface.rs # Provides partial code for the user interface tab.
572
+ └── views # A folder containing the code for the views.
573
+ β”œβ”€β”€ about.rs # Provides code for the about page view.
574
+ β”œβ”€β”€ index.rs # Provides code for the homepage view.
575
+ β”œβ”€β”€ mod.rs # A module file for the rust project.
576
+ β”œβ”€β”€ not_found.rs # Provides code for the 404 page view.
577
+ β”œβ”€β”€ search.rs # Provides code for the search page view.
578
+ └── settings.rs # Provides code for the settings page view.
579
  ```
580
 
581
  **Backend Source:** `./src/`
 
612
  β”‚ β”œβ”€β”€ aggregator.rs # Provides code aggregate and fetches results from the upstream engines.
613
  β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
614
  β”‚ └── user_agent.rs # Provides a helper function to allow random user agents to pass in the server request code to improve user privacy and avoiding detected as a bot.
615
+ β”œβ”€β”€ server # A folder that holds code to handle the routes for the search engine website.
616
+ β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
617
+ β”‚ β”œβ”€β”€ router.rs # Provides functions to handle the different routes on the website.
618
+ β”‚ └── routes # A folder that contains code to handle the bigger route for the website.
619
+ β”‚ β”œβ”€β”€ mod.rs # A module file for the rust project.
620
+ β”‚ └── search.rs # Provides the function to handle the search route.
621
+ └── templates # A module that provides and handles Maud HTML framework source code for the search engine website (subfolders and files are explained in the above frontend section.)
622
  ```
623
 
624
  ## Development Tools