# 5-minute quickstart

## 1. Install and verify

<Tabs items={['macOS / Linux', 'Windows', 'Docker']}>
  <Tab value="macOS / Linux">

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

  </Tab>
  <Tab value="Windows">

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

  </Tab>
  <Tab value="Docker">

```bash
docker run --rm denoland/deno:latest deno --version
```

  </Tab>
</Tabs>

## 2. Initialize and run

```bash
deno init --serve hello-deno
cd hello-deno
deno task dev
```

`deno init --serve` creates `deno.json`, a server entry point, and tests. For a hand-written entry point, make the network permission explicit:

```ts title="main.ts"
Deno.serve((_request) => Response.json({ ok: true }));
```

```bash
deno run --allow-net main.ts
curl http://localhost:8000
# {"ok":true}
```

## 3. Add a test

```ts title="math_test.ts"
import { assertEquals } from "jsr:@std/assert";

Deno.test("adds two numbers", () => {
  assertEquals(2 + 3, 5);
});
```

```bash
deno test
```

## 4. Pre-commit gate

```bash
deno fmt --check
deno lint
deno check **/*.ts
deno test
```

<Callout type="warn" title="Do not solve permission errors with -A first">
`-A` means `--allow-all` and disables the sandbox. A server that only listens needs `--allow-net`; a process reading one secret should use `--allow-env=KEY_NAME`.
</Callout>

Official sources: [Get started](https://docs.deno.com/runtime/), [Installation](https://docs.deno.com/runtime/getting_started/installation/), and [Testing](https://docs.deno.com/runtime/test/).
