Skip to content
48 changes: 20 additions & 28 deletions runtime/getting_started/first_project.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
---
last_modified: 2025-03-10
last_modified: 2026-05-28
title: Making a Deno project
description: "Step-by-step guide to creating your first Deno project. Learn how to initialize a project, understand the basic file structure, run TypeScript code, and execute tests using Deno's built-in test runner."
oldUrl: /runtime/manual/getting_started/first_steps/
---

Deno has many [built in tools](/runtime/reference/cli/) to make your development
experience as smooth as possible. One of these tools is the
[project initializer](/runtime/reference/cli/init), which creates a new Deno
project with a basic file structure and configuration.

While you are welcome to use JavaScript, Deno has built-in support for
[TypeScript](https://www.typescriptlang.org/) as well, so we'll be using
TypeScript in this guide. If you'd prefer to use JavaScript, you can rename the
files to `.js` and remove the type annotations.
In this guide, you'll create your first Deno project, run it, and execute its
tests. We'll use [TypeScript](https://www.typescriptlang.org/) throughout. To
follow along in JavaScript instead, rename the files to `.js` and remove the
type annotations.

## Initialize a new project

Expand All @@ -33,31 +28,33 @@ my_project
└── main.ts
```

A `deno.json` file is created to
[configure your project](/runtime/fundamentals/configuration/), and two
TypeScript files are created; `main.ts` and `main_test.ts`. As of Deno 2.8 the
`main.ts` file contains a small HTTP server built on
[`Deno.serve`](/api/deno/~/Deno.serve) — it shows off Deno's built-in HTTP
server, `Response.json()`, and TypeScript working out of the box. The handler is
exported and guarded by `import.meta.main`, so `main_test.ts` can import and
call it directly without binding to a port.
[`deno.json`](/runtime/fundamentals/configuration/) holds your project
configuration. `main.ts` is a small HTTP server built on
[`Deno.serve`](/api/deno/~/Deno.serve), and `main_test.ts` has the tests for it.

## Run your project

Move into the new project directory:

```bash
cd my_project
```

You can run this program with the following command:

```bash
$ deno main.ts
$ deno -N main.ts
Listening on http://localhost:8000/
```

The server needs network permission, granted here via `-N` (short for
`--allow-net`). See [security](/runtime/fundamentals/security/) for more.

Open the URL in your browser to see the response.

## Run your tests

Deno has a [built in test runner](/runtime/fundamentals/testing/). You can write
tests for your code and run them with the `deno test` command. Run the tests in
your new project with:
Run the tests with [`deno test`](/runtime/fundamentals/testing/):

```bash
$ deno test
Expand All @@ -68,9 +65,4 @@ handler returns 404 for unknown route ... ok (1ms)
ok | 2 passed | 0 failed (3ms)
```

Now that you have a basic project set up you can start building your
application. Check out our [examples and tutorials](/examples/) for more ideas
on what to build with Deno.

You can
[learn more about using TypeScript in Deno here](/runtime/fundamentals/typescript).
Browse our [examples and tutorials](/examples/) for ideas on what to build next.
Loading