11---
2- last_modified : 2025-03-10
2+ last_modified : 2026-05-28
33title : Making a Deno project
44description : " 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."
55oldUrl : /runtime/manual/getting_started/first_steps/
66---
77
8- Deno has many [ built in tools] ( /runtime/reference/cli/ ) to make your development
9- experience as smooth as possible. One of these tools is the
10- [ project initializer] ( /runtime/reference/cli/init ) , which creates a new Deno
11- project with a basic file structure and configuration.
12-
13- While you are welcome to use JavaScript, Deno has built-in support for
14- [ TypeScript] ( https://www.typescriptlang.org/ ) as well, so we'll be using
15- TypeScript in this guide. If you'd prefer to use JavaScript, you can rename the
16- files to ` .js ` and remove the type annotations.
8+ In this guide, you'll create your first Deno project, run it, and execute its
9+ tests. We'll use [ TypeScript] ( https://www.typescriptlang.org/ ) throughout. To
10+ follow along in JavaScript instead, rename the files to ` .js ` and remove the
11+ type annotations.
1712
1813## Initialize a new project
1914
@@ -33,31 +28,33 @@ my_project
3328└── main.ts
3429```
3530
36- A ` deno.json ` file is created to
37- [ configure your project] ( /runtime/fundamentals/configuration/ ) , and two
38- TypeScript files are created; ` main.ts ` and ` main_test.ts ` . As of Deno 2.8 the
39- ` main.ts ` file contains a small HTTP server built on
40- [ ` Deno.serve ` ] ( /api/deno/~/Deno.serve ) — it shows off Deno's built-in HTTP
41- server, ` Response.json() ` , and TypeScript working out of the box. The handler is
42- exported and guarded by ` import.meta.main ` , so ` main_test.ts ` can import and
43- call it directly without binding to a port.
31+ [ ` deno.json ` ] ( /runtime/fundamentals/configuration/ ) holds your project
32+ configuration. ` main.ts ` is a small HTTP server built on
33+ [ ` Deno.serve ` ] ( /api/deno/~/Deno.serve ) , and ` main_test.ts ` has the tests for it.
4434
4535## Run your project
4636
37+ Move into the new project directory:
38+
39+ ``` bash
40+ cd my_project
41+ ```
42+
4743You can run this program with the following command:
4844
4945``` bash
50- $ deno main.ts
46+ $ deno -N main.ts
5147Listening on http://localhost:8000/
5248```
5349
50+ The server needs network permission, granted here via ` -N ` (short for
51+ ` --allow-net ` ). See [ security] ( /runtime/fundamentals/security/ ) for more.
52+
5453Open the URL in your browser to see the response.
5554
5655## Run your tests
5756
58- Deno has a [ built in test runner] ( /runtime/fundamentals/testing/ ) . You can write
59- tests for your code and run them with the ` deno test ` command. Run the tests in
60- your new project with:
57+ Run the tests with [ ` deno test ` ] ( /runtime/fundamentals/testing/ ) :
6158
6259``` bash
6360$ deno test
@@ -68,9 +65,4 @@ handler returns 404 for unknown route ... ok (1ms)
6865ok | 2 passed | 0 failed (3ms)
6966```
7067
71- Now that you have a basic project set up you can start building your
72- application. Check out our [ examples and tutorials] ( /examples/ ) for more ideas
73- on what to build with Deno.
74-
75- You can
76- [ learn more about using TypeScript in Deno here] ( /runtime/fundamentals/typescript ) .
68+ Browse our [ examples and tutorials] ( /examples/ ) for ideas on what to build next.
0 commit comments