The ultimate guide to Deno
This article is a categorized index to the exclusive medium magazine on Deno: Deno World. The magazine has 300 articles on Deno. This constantly updated article provides pointers to the best and most viewed articles in each category.
The official Deno documentation is here.
Getting started
Commands
- Eval command to quickly evaluate a small piece of code
- Fmt command for formatting code
- Formatting code with a config file
- REPL command
- Install an application as an executable script
- Use Deno’s linter
Sandboxing
- Deno’s sandboxing in pictures
- Verify sandbox access at application startup
- Disable permission prompting at runtime
Modules
Interfaces & Data structures
- Reader, writer, seeker, and closer interface
- Buffers
- Close resources of any type
- Stream data from a Reader to a Writer
- Deeply merge two objects
- Structured cloning to correctly clone any data type
- Parse JSON with comments
CLI
- Parse command-line arguments
- Write interactive command-line applications
- Build a progress indicator for CLI applications
Data formatting
- TextEncoder & TextDecoder
- Encode & decode any base 64 data
- Encode & decode textual base 64 data
- Encode & decode a hex string
- Convert string to bytes and vice versa
- Buffer to hex one-liner
- Print a size in readable form
HTTP server
- A comprehensive guide to writing HTTP servers
- A beginner’s guide to HTTP servers
- An HTTP server in callback style
- 2 ways of writing an HTTP server
- 3 common ways of building an HTTP server
- 2 ways of writing a file server
- Simple Hello World server
- Hello world HTTP and HTTPS servers on Windows
- Echo server
- HTTP/2 server
- Human readable HTTP status codes
- Handle file uploads & save on disk
- Handle query params from URL
- Response without a body
- Respond with a redirection
- Work with URL encoded data
- Work with multipart form data
- Work with JSON data
- Sign and verify JWT (JSON Web Token)
- Log an incoming request
- Stream a file through HTTP
- Get and send HTTP headers
- Get and send cookies
- Use headers and query params like a plain object
- A native router using URLSearchPattern
- Serving templatized HTMLs
- Unit test of an HTTP server
- Log HTTP transaction with colors on console
- Process HTTP body line-by-line with and without streams
- File upload server with encryption at rest
- A beginner’s step-by-step guide to static file server
- Respond with JSON (updated)
- Custom error handler with server API
- Log listening message
- Get user agent
- Get uploaded file name
- Calculate ETag of a file
- Abort HTTP connection
- New HTTP server (flash)
- HTTP request stream to upper case
HTTP client
- A comprehensive guide to making HTTP requests
- Make GET and POST requests
- Send query params
- Upload files using fetch
- Download files using fetch
- Associate a timeout with fetch (another one here)
- Custom HTTP client with fetch
- Make a fetch request via a proxy server
- 3 ways of accepting self-signed certificates
- Download a file
- Fetch with redirection (how to know, how to stop)
Streams
- A beginner’s guide to streams
- Create & handle Readable streams
- Convert bytes to Readable stream
- Zip and unzip files
Networking
WebSocket
Oak
- Middleware to measure response time
- Middleware to handle all errors
- Middleware to handle 404
- Middleware to log HTTP transaction
- Middleware to serve favicon.ico
- Redirect a user
- Subrouters
- Get notified for application events
- HTTPS Server
- Input validation with assert API
- Stop default logging of errors
- WebSocket server
- Request body processing
- Route all
- Print all routes
- Custom (your own) middleware
- Router with prefix
- Static file server
- Context state
- Get path and query params
- Use Oak as a request handler only
Fresh
File system
- A file system watcher for files, directories, etc.
- Work with paths in the local file system
- Process a directory recursively
- Create temporary files & directories
- Get information of a file like size, mtime, etc.
- Get list of files in a directory
- Create a directory path in the local file system
- Get path of the temporary directory used by OS
- Check if a file exists in the local file system
File I/O
- 2 ways of writing data into files
- Read last N bytes from a file
- Process big files (in GBs) efficiently
- Read & write JSON formatted files
- Read & write text, JSON & binary files
- Tail a file
- Get size of a file
Crypto
- Web crypto APIs
- Generate cryptographically strong random numbers
- Public key (RSA) encryption & decryption
- Private key (AES) encryption & decryption
- Create JWT one-liner
Child process / Workers
- Run a child process
- Run a shell command & collect it’s output
- Single line — Run a child process
- Communicate with workers
Storage
Broadcasting
- Broadcast channel to publish & consume data
- Publish and consume global events using dispatchEvent & addEventListener
Interfacing with other languages
- Call C functions from Deno (Primitive types)
- Call C functions from Deno (Buffer type)
- Call Rust functions from Deno (Primitive types)
- Call Rust functions from Deno (Buffer type)
- Call C functions from Deno on Windows (Primitive types)
- Call C functions from Deno on Windows (Buffer type)
Application management
- Manage application’s dependencies
- Install application’s dependencies in advance
- Load cached dependencies only
- Default cache path on platforms and how to change it
- Distribute an application
- Install an application as an executable script
- Run a TypeScript file as executable script
- Dotenv file handling
- Print dependency tree
Logging
- Generate colorful text on the console
- Console logging APIs
- Overwrite/update a console log line
- Write raw data on console
- Standard library’s Logger module
- Console text formatting with CSS
Performance
Testing an application
- Basics of the Deno’s tester
- Advanced features of Deno’s tester
- Process test results programmatically
- Asserts to validate the output of a unit test
- Integration testing of an application using tester
- Load testing of an application using tester
- Generate code coverage report
- Using chai BDD with deno test
Deno under the hood
- The internals of Deno
- The event loop
- Deno’s internal code structure
- Internal processing of synchronous APIs
- Source code of Deno’s event loop
- Internal processing of console.log
UUID & SHA
- Generate a UUID
- Calculate SHA (1, 256, 384, or 512) of a file
- Calculate SHA of a string
- Generate a truly random string
File processing
- Process data line-by-line from a variety of sources like string, buffer, file, network, etc.
- Process a file line-by-line
- Process a delimited file
Interfacing with other systems
Others
- Modify global Deno namespace with attributes & functionality
- Resolvable promises
- Auto-rejecting promises
- Attach a timeout with any async function
- Some use-cases of AbortController
- Auto-reload an application when source changes
- 10 quick one-liners
- 10 quick one-liners part -2
- Single line error handler
- Handle uncaught errors
- Create signature
- Compare version strings
- Handle unhandled rejections
- V8 flags supported by Deno
- Get & use process startup timestamp
Deployment
Applications
- File.io like service that removes file after it gets downloaded
- A URL shortener service
- A content server in Deno (6 parts: 1, 2, 3, 4, 5, 6)
- A latency tester that compares two HTTP services
- A proxy file server
- A video streaming service
- Signup, login, and logout web app using vanilla JS, Oak, ETA, and JSON file database
- Signup, login, and logout web app using vanilla JS, Oak, ETA, and MongoDB
- Signup, login, and logout web app using vanilla JS, Oak, ETA, and Postgres database
- A URL Shortener service using JSON file database
- A URL Shortener service using Mongo DB
- A URL Shortener service using MySQL DB
- A URL Shortener service using Postgres DB
- Generate QR code using Google API
Performance comparison with Node.js
- Hello world
- HTTP echo name
- Simple multipart form data (only KVs)
- Multipart form data with files
- File server
- API proxy
- Reading files
- Writing files
- Hello world with Deno’s new server
- HTTP/2 hello world
- File server with Deno’s new server
Performance comparison with Others
- Echo name comparison with spring boot
- Echo name comparison with Go
- Hello world comparison with Bun
- HTTPS echo name comparison with Bun
- File server comparison with Bun
- API proxy comparison with Bun
IDEs
- Configure Deno completions in VSCode
- Run and debug Deno applications in VSCode
- Run Deno unit tests in VSCode
Node.js to Deno
End of Index