Skip to content

Commit

Permalink
Add tutorial section (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Corb3nik authored Oct 16, 2024
1 parent 32088af commit 871dc0a
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 92 deletions.
9 changes: 8 additions & 1 deletion .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { defineConfig } from "vitepress";

import { conceptsSidebar, guidesSidebar, referenceSidebar } from "./sidebars";
import {
conceptsSidebar,
guidesSidebar,
referenceSidebar,
tutorialsSidebar,
} from "./sidebars";

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand Down Expand Up @@ -40,6 +45,7 @@ export default defineConfig({

nav: [
{ text: "Guides", link: "/guides/" },
{ text: "Tutorials", link: "/tutorials/" },
{ text: "Reference", link: "/reference/" },
{ text: "Concepts", link: "/concepts/" },
{ text: "Policy", link: "/policy.md" },
Expand All @@ -49,6 +55,7 @@ export default defineConfig({
"/reference/": referenceSidebar,
"/guides/": guidesSidebar,
"/concepts/": conceptsSidebar,
"/tutorials/": tutorialsSidebar,
},

outline: {
Expand Down
8 changes: 6 additions & 2 deletions .vitepress/sidebars/concepts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ import type { DefaultTheme } from "vitepress";

export const conceptsSidebar: DefaultTheme.SidebarItem[] = [
{
text: "Introduction",
text: "Concepts",
items: [
{
text: "Directory",
text: "Introduction",
link: "/concepts/",
},
],
},
{
text: "Essentials",
items: [
{
text: "Plugin Architecture",
link: "/concepts/essentials/package",
},
{
text: "Tooling",
link: "/concepts/essentials/tooling",
Expand Down
11 changes: 1 addition & 10 deletions .vitepress/sidebars/guides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@ import type { DefaultTheme } from "vitepress";

export const guidesSidebar: DefaultTheme.SidebarItem[] = [
{
text: "Introduction",
text: "Guides",
items: [
{
text: "Getting Started",
link: "/guides/",
},
],
},
{
text: "Example Plugins",
items: [
{
text: "Notebook",
link: "/guides/plugins/notebook",
},
],
},
{
text: "Frontend",
items: [
Expand Down
1 change: 1 addition & 0 deletions .vitepress/sidebars/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./reference";
export * from "./guides";
export * from "./concepts";
export * from "./tutorials";
22 changes: 22 additions & 0 deletions .vitepress/sidebars/tutorials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { DefaultTheme } from "vitepress";

export const tutorialsSidebar: DefaultTheme.SidebarItem[] = [
{
text: "Tutorials",
items: [
{
text: "Introduction",
link: "/tutorials/",
},
],
},
{
text: "Example Plugins",
items: [
{
text: "Notebook",
link: "/tutorials/notebook/",
},
],
},
];
3 changes: 3 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ services:
- type: redirect
source: /concepts/essentials/plugins/backend.html
destination: /guides/
- type: redirect
source: /guides/plugins/notebook.html
destination: /tutorials/notebook.html
domains:
- developer.caido.io
envVars:
Expand Down
77 changes: 77 additions & 0 deletions src/concepts/essentials/package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Plugin Architecture

As Caido utilizes a **client/server architecture** - inherently, this means plugin development consists of many parts:

- A manifest.json file
- A frontend plugin
- A backend plugin

These parts are packaged together in a single entity known as a **plugin package**.

### Manifest.json

The `manifest.json` configuration file defines the plugin package structure and also contains metadata used by the Caido installer.

Here's an example of what the `manifest.json` file should look like:

```json
{
"id": "authmatrix",
"name": "AuthMatrix",
"version": "0.2.0",
"description": "Grid-based authorization testing across multiple users and roles.",
"author": {
"name": "Caido Labs Inc.",
"email": "[email protected]",
"url": "https://github.com/caido-community/authmatrix"
},
"plugins": [
{
"kind": "frontend",
"id": "authmatrix-frontend",
"name": "Authmatrix Frontend",
"entrypoint": "frontend/script.js",
"style": "frontend/style.css",
"backend": {
"id": "authmatrix-backend"
}
},
{
"kind": "backend",
"id": "authmatrix-backend",
"name": "Authmatrix Backend",
"runtime": "javascript",
"entrypoint": "backend/script.js"
}
]
}
```

::: info
For more information on the `manifest.json` file, refer to the [manifest.json reference](/reference/manifest.md).
:::

### Frontend Plugin

Frontend plugins allow you to customize the UI of the Caido application:

- Add new pages, components and elements.
- Modify the appearance, behavior and functionality of the user-interface.
- Handle user interactions, render data and communicate with the backend server via Caido's API.

::: info
You can find the full list of available frontend SDK functions in the [frontend SDK reference](/reference/sdks/frontend/index.md).
:::

### Backend Plugin

Backend plugins allow you to extend the server-side functionality of the Caido application:

- Interact with the application's data and databases.
- Perform HTTP requests to external APIs.
- Handle computationally intensive tasks.
- Respond to events that occur within Caido.

::: info
You can find the full list of available backend SDK functions in the [backend SDK reference](/reference/sdks/backend/index.md).
:::
9 changes: 6 additions & 3 deletions src/concepts/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Directory
# Concepts

Here you will find explanations of the core concepts that underpin Caido plugins.

## Essentials

- **[Runtime](./essentials/runtime.md)** - javascript runtime used by Plugins.
- **[Tooling](./essentials/tooling.md)** - tools for the ease of Plugin development.
- [Plugin Architecture](./essentials/package.md) - The structure of a plugin package.
- [Runtime](./essentials/runtime.md) - Javascript runtimes used by plugins.
- [Tooling](./essentials/tooling.md) - Tools for the ease of plugin development.

## Modules

Expand Down
80 changes: 4 additions & 76 deletions src/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,17 @@

Caido allows users to develop custom features in the form of plugins.

Conceptualize them as extensive [Workflows](https://docs.caido.io/concepts/essentials/workflows.html). While they both provide task automation - plugins offer a greater level of complexity and flexibility.
Plugin development is done in JavaScript and consists of many parts:

Plugins are written in JavaScript.

## Plugin Packages

As Caido utilizes a **client/server architecture** - inherently, this means plugin development consists of many parts:

- A manifest.json file
- A `manifest.json` file
- A frontend plugin
- A backend plugin

These parts are packaged together in a single entity known as a **plugin package**.

### Manifest.json

The `manifest.json` configuration file defines the plugin package structure and also contains metadata used by the Caido installer.

Here's an example of what the `manifest.json` file should look like:

```json
{
"id": "authmatrix",
"name": "AuthMatrix",
"version": "0.2.0",
"description": "Grid-based authorization testing across multiple users and roles.",
"author": {
"name": "Caido Labs Inc.",
"email": "[email protected]",
"url": "https://github.com/caido-community/authmatrix"
},
"plugins": [
{
"kind": "frontend",
"id": "authmatrix-frontend",
"name": "Authmatrix Frontend",
"entrypoint": "frontend/script.js",
"style": "frontend/style.css",
"backend": {
"id": "authmatrix-backend"
}
},
{
"kind": "backend",
"id": "authmatrix-backend",
"name": "Authmatrix Backend",
"runtime": "javascript",
"entrypoint": "backend/script.js"
}
]
}
```

::: info
For more information on the `manifest.json` file, refer to the [manifest.json reference](/reference/manifest.md).
:::

### Frontend Plugin

Frontend plugins allow you to customize the UI of the Caido application:

- Add new pages, components and elements.
- Modify the appearance, behavior and functionality of the user-interface.
- Handle user interactions, render data and communicate with the backend server via Caido's API.

::: info
You can find the full list of available frontend SDK functions in the [frontend SDK reference](/reference/sdks/frontend/index.md).
:::

### Backend Plugin

Backend plugins allow you to extend the server-side functionality of the Caido application:

- Interact with the application's data and databases.
- Perform HTTP requests to external APIs.
- Handle computationally intensive tasks.
- Respond to events that occur within Caido.

::: info
You can find the full list of available backend SDK functions in the [backend SDK reference](/reference/sdks/backend/index.md).
:::
For more information on the structure of a plugin package, see [Plugin Architecture](/concepts/essentials/package.md).

## Creating Your First Plugin Package
## Creating a Plugin Package

::: info Requirements
Plugins are developed in JavaScript and require the following to be installed on your device:
Expand Down
4 changes: 4 additions & 0 deletions src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ hero:
text: Guides
link: /guides/

- theme: alt
text: Tutorials
link: /tutorials/

- theme: alt
text: Reference
link: /reference/
Expand Down
9 changes: 9 additions & 0 deletions src/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tutorials

This section of the documentation is dedicated to providing step-by-step tutorials for developers to get started with Caido.

If you are new to plugin development, the tutorials here will give you a feel for what it's like to build plugins for Caido.

## Example Plugins

- [Notebook](/tutorials/notebook.md): A simple notebook plugin for in-app note taking.
File renamed without changes.

0 comments on commit 871dc0a

Please sign in to comment.