What is a Project? β
Projects are serverless applications deployed to Web URLs. Projects in Netzo are programmed using Deno, a simple, modern and secure runtime for JavaScript and TypeScript. In essence, a project consist of collections of static files that are automatically hosted by netzo. Each Project is deployed to its own unique URL and ran globally at the network edge when an HTTP Request is made to its URL. netzo/lib
can be used within projects to make coding projects even simpler.
The following illustrates what can be achieved in just a few lines of TSX code:
Project Deployment URLs β
A project can be executed by sending an HTTP request to any of:
- Production URL:
https://{uid}.netzo.io
- Preview URL:
https://{deploymentId}.netzo.io
Common Files β
Although the only requirement for a project is a main.tsx
file, some other common files include:
Entrypoint β
- this
entrypoint
file is the only file that is required to be present in your project - it is a common practice to name the entrypoint file
main.(ts|tsx|js|jsx)
- make sure to select this file as
entrypoint
in the project configuration
Import Map β
- this file is optional but recommended
- the filename must be
import_map.json
and be at the root of the project - the file must be a valid Deno import map
README β
- this file is optional but will be shown in the project overview page if present
- the filename must be
readme.md
orREADME.md
and be at the root of the project - the file must be written in Markdown syntax
Frameworks β
If you are building a more complex application, you might want to use a web framework. Netzo supports multiple Deno and Node.js web frameworks that make building applications even easier.
Node.js native frameworks are frameworks that are built for Node.js, but can also be used in Deno. These include popular web frameworks such as Express and Koa, which usually have a Deno equivalent (e.g. Oak instead of Koa).
We recommend using the following Deno native frameworks when building projects in Netzo.
Fresh β
Recommended for the frontend, e.g. to create a dashboard, web app or webpage
Fresh is the most popular web framework for Deno. It is a lightweight framework that is easy to use and has a very small learning curve. It is the framework we recommend for most projects in Netzo. Fresh is based on Preact, but you can also import and reuse compatible React components and libraries via services like esm.sh.
Fresh is an opinionated and lightweight framework purposely built for the serverless edge that is easy to use and has a very small learning curve. Netzo builds on top of Fresh to make building projects even easier by providing netzo/lib
, a set of tools and utilities that make building projects even easier.
Fresh provides the following features out of the box:
- layouts: use layouts via the
routes/_app.tsx
file - routing: file-based routing via the
routes/
directory - static files: serve static files via the
static/
directory - middleware: use middleware via
routes/**/_middleware.tsx
files - backend handlers: colocate backend handlers alongside frontend routes
Oak β
Recommended for the backend, e.g. to create (REST) APIs
Oak is a middleware framework for Deno's native HTTP server. It is a more complex framework that is built for building large-scale applications. It can be thought of as the Koa for Deno.
Oak provides the following features out of the box:
- middleware: use middleware via
app.use()
androuter.use()
- routing: use routing via
router.get()
,router.post()
, etc.