# Your first Deno project

Initialize a project:

```bash
deno init hello-deno
cd hello-deno
```

```text
hello-deno/
├── deno.json
├── main.ts
└── main_test.ts
```

Make `main.ts` expose a testable handler:

```ts
export function handler(request: Request): Response {
  const url = new URL(request.url);
  return Response.json({ message: "Hello Deno", path: url.pathname });
}

if (import.meta.main) {
  Deno.serve({ port: 8000 }, handler);
}
```

Record team commands in `deno.json`:

```json
{
  "tasks": {
    "dev": "deno run --watch --allow-net=0.0.0.0:8000 main.ts",
    "check": "deno fmt --check && deno lint && deno check main.ts main_test.ts",
    "test": "deno test"
  }
}
```

```bash
deno task check
deno task test
deno task dev
```

Listening with `Deno.serve` needs network permission. Unit tests that call `handler()` directly do not open a port, so they do not need `-A`.

Next: [permissions](/en/docs/core/permissions), [web stack selection](/en/docs/web), and [project blueprints](/en/docs/projects).
