---
# You can also start simply with 'default'
theme: seriph
# random image from a curated Unsplash collection by Anthony
# like them? see https://unsplash.com/collections/94734566/slidev
background: https://cover.sli.dev
# some information about your slides (markdown enabled)
title: Deno
info: |
  ## Deno
  Deno is the open-source JavaScript runtime for the modern web.

  Built on web standards with zero-config TypeScript, unmatched security, and a complete built-in toolchain.

  Learn more at [Deno](https://deno.com)
# apply unocss classes to the current slide
class: text-center
# https://sli.dev/features/drawing
drawings:
  persist: false
# slide transition: https://sli.dev/guide/animations.html#slide-transitions
transition: slide-left
# enable MDC Syntax: https://sli.dev/features/mdc
mdc: true
# open graph
seoMeta:
  # By default, Slidev will use ./og-image.png if it exists,
  # or generate one from the first slide if not found.
  # ogImage: auto
  ogImage: https://cover.sli.dev
---

# Deno

Uncomplicate JavaScript

<div class="abs-br m-6 text-xl">
  <button @click="$slidev.nav.openInEditor()" title="Open in Editor" class="slidev-icon-btn">
    <carbon:edit />
  </button>
  <a href="https://github.com/zyf722/exploring-social-engineering-slides" target="_blank" class="slidev-icon-btn">
    <carbon:logo-github />
  </a>
</div>

<!--
The last comment block of each slide will be treated as slide notes. It will be visible and editable in Presenter Mode along with the slide. [Read more in the docs](https://sli.dev/guide/syntax.html#notes)
-->

---
layout: center
class: "text-center"
---
# What is Deno?

<v-click>
Deno is the open-source JavaScript runtime for the modern web.
Built on web standards with zero-config TypeScript, unmatched security, and a complete built-in toolchain.
</v-click>

---
# layout: 2x2-grid-header
---

# Features

<!-- ::topleft:: -->
- **TypeScript** - native support for ts, tsx, jsx
- **web standards** - Deno prioritizes web standard APIs, maximizing code reuse between browser and server

<!-- ::topright:: -->
- **Code linter** - build in code linter
- **Code formatter** - based on dprint. Beautifies JS, TS, JSON, and Markdown

<!-- ::bottomleft:: -->
- **Test runner** - test runner and assertion libraries as a part of the runtime and standard library
- **Standalone executables** - create standalone executables. It even supports cross-compiling

<!-- ::bottomright:: -->
- **Secure by default** - Deno has no file, network, or environment access unless explicitly enabled
- **Jupyter Kernel** - build in Jupyter Kernel for data science and machine learning
- **OpenTelemetry** - Logs, Traces and Metrics included

<!-- Read more about [Deno](https://docs.deno.com/runtime/) -->

---

# Install Deno

## macOS / Linux

```bash
curl -fsSL https://deno.land/install.sh | sh
```

## Windows

```bash
irm https://deno.land/install.ps1 | iex
```
---

# Docker

| Base         | Docker Tag                     |
|--------------|--------------------------------|
| Alpine Linux | denoland/deno:alpine           |
| Debian       | denoland/deno:debian (default) |
| Distroless   | denoland/deno:distroless       |
| Ubuntu       | denoland/deno:ubuntu           |
| Binary only  | denoland/deno:bin              |

---
layout: center
class: "text-center"
---

# Deno Toolchain

---

Creating an empty project similiar to `npm init`

```bash
deno init my-deno-project
```

Creates three default files

```md {0|1|2|3}
main.ts
main_test.ts
deno.json
```

<!--
deno.json is central to customizing your deno development environment

- Import maps
- Scripts
- Formatter settings
- Linter rules
- TypeScript compiler options
-->

---

## Running a project

`deno run main.ts`

## Using npm modules

```ts
import express from "npm:express";

const app = express();

app.get("/", function (req, res) {
  res.send("Hello World");
});

app.listen(3000);
```

---

# Standard Library

Deno provides a set of audited standard modules that are reviewed by the Deno core team and guaranteed to work with Deno.

```ts
import { copy } from "https://deno.land/std@0.208.0/fs/copy.ts";

await copy("./log.txt", "./log-old.txt");
```

- **fs** - File system module
- **http** - HTTP server and client
- **path** - Path manipulation
- **testing** - Testing assertions and utilities

---
layout: center
class: "text-center"
---

# Security & Permissions

---

# Permissions

Deno is secure by default. No file, network, or environment access unless explicitly enabled.

```bash
# Allow network access
deno run --allow-net server.ts

# Allow reading specific files
deno run --allow-read=/etc/hosts main.ts

# Allow all permissions (use with caution)
deno run -A main.ts
```

---

# Deno KV

A zero-config, ACID-compliant, JavaScript-native key-value database built right into the runtime.

```ts
const kv = await Deno.openKv();

// Set a value
await kv.set(["users", "alice"], { name: "Alice", age: 30 });

// Get a value
const result = await kv.get(["users", "alice"]);
console.log(result.value);
```

Works locally and on Deno Deploy without configuration.

---
layout: center
class: "text-center"
---

# Deno Deploy

---

# Deno Deploy

Globally distributed serverless edge worker platform.

- **Git Integration** - Push to GitHub, deploy automatically
- **Edge Latency** - Code runs close to users
- **No Config** - Just write code

```bash
deployctl deploy --project=my-project main.ts
```

---

# Jupyter Notebooks

Deno provides a built-in kernel for Jupyter notebooks.

```bash
deno jupyter --unstable --install
```

Use TypeScript, npm modules, and Deno APIs directly in your notebooks.

---

# OpenTelemetry

Deno provides native support for OpenTelemetry.

```bash
export OTEL_SERVICE_NAME=my-deno-service
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
deno run --unstable-otel app.ts
```

- **Zero Config** - Auto-instrumentation for HTTP, Deno KV, etc.
- **Standards Based** - Export to any OTLP compatible backend

