Netzo Logo

Quick Start

Create and deploy your first Netzo app in minutes.

The Netzo Framework augments Deno Fresh to provide essential app functionality like plug-and-play authentication, pre-defined styles and themes, customizable UI components, blocks and layouts, simple API integrations, intuitive APIs for the built-in database, real-time notifications among others. All projects in Netzo are Deno projects and can be ran locally using the Deno CLI.

1. Installation

Install the Deno CLI and Netzo CLI to get started.

The netzo/cli module is a command line tool to streamline local development of Netzo projects.

After you followed the instructions to install the Deno CLI you can install the Netzo CLI by running:

deno install -Arf https://deno.land/x/netzo/cli/netzo.ts

2. Initialize Project

Use the Git CLI to clone a project from a template.

The git clone command from the Git CLI clones and initializes a new project from a repository. Run the following command:

git clone https://github.com/netzo/template-minimal
cd template-minimal

The following is a simplified overview of the project structure for a Netzo app, though it may vary for each template.

└── <directory>/
    ├── .vscode/
    ├── components/
    ├── database/
    ├── islands/
    ├── routes/
    ├── static/
    ├── deno.json
    ├── dev.ts
    ├── fresh.gen.ts
    ├── main.ts
    ├── netzo.config.ts

This is practically the same minimal project structure of Deno Fresh projects with a few additions and best practices. More information about the project structure can be found later in the documentation.

We recommend you start-off by cloning an existing Netzo template with all the necessary setup. However, any Deno and Deno Fresh project is also a valid Netzo project. As such, you can always use the Deno CLI or Deno Fresh CLI to initialize a project instead.

3. Run Project

Use the Deno CLI to run a Netzo project in development.

All Netzo projects can be run using deno run command from the Deno CLI. Netzo projects come with pre-configured tasks in the deno.json(c) file of the project. These tasks can be used to run the project in development mode, run tests, and build the project for production, without having to remember the command line arguments. You can always take a look at the project's deno.json(c) file to see what tasks are available.

Run in Development

The recommended way to run a Netzo project is to use the deno task start command:

deno task start

which runs deno run -A --unstable --env --watch=static/,routes <entrypoint> dev under the hood.

The deno task start command will start the project in development mode. This will start a development server that will automatically restart when changes are detected in the project files (via the --watch flag). The development server will also automatically reload the browser when changes are detected in the frontend files.

If your project has no data, check if there are pre-defined db:<task> tasks in the deno.json(c) file. If there are, run the necessary ones (e.g. deno task db:mock and then deno task db:load) to populate the database with some mock data.

Preview in Production

Optional: preview the project in production environment locally before deployment

Netzo projects come with a pre-configured build task that can be used to build the project for production. This task will perform an Ahead-of-Time (AoT) build step to pre-optimize frontend assets and output them to the _fresh/ directory, which is used in production to serve these as static assets, instead of having to run the build step just-in-time (JIT) on each request.

deno task build  # optional but recommended

which runs deno run -A --unstable --env <entrypoint> dev build under the hood.

To run a project in production environment locally, use the deno task preview command:

deno task preview

which runs deno run -A --unstable --env <entrypoint> under the hood.

Note that the default project <entrypoint> is main.ts but you can use any other name for the project entrypoint file as well.

4. Deploy Project

Use the Netzo CLI to deploy a Netzo project to production.

Deploying projects requires an account on the Netzo Platform. If you haven't already, head over to the Netzo Platform to create an account and create a new or join an existing workspace.

1. Create Project in Netzo

If you haven't already, create a project at the Projects page and copy the project ID, as well as an API Key from the Workspace > API Keys page into an .env file in the root of your project.

.env
NETZO_PROJECT_ID="..."
NETZO_API_KEY="..."

2. Deploy to Netzo

Run any of the following commands to deploy your project to Netzo. These will automatically pick-up the required project ID and API key from the local .env file and deploy your project to Netzo.

It is recommended to always use the --build flag when deploying a project to production, since it greatly improves the performance of the deployed project.
# To deploy a local project (default main.ts entrypoint):
netzo deploy
# To deploy a local project (other entrypoint):
netzo deploy main.ts
# To deploy a local project after running a build task:
netzo deploy --build
# To deploy a local project and mark it as production:
netzo deploy --production

If the deployment succeeds, it will return a URL with the following format where you can view your project.

Instead of using an .env file, you can always pass these values via flags to the CLI:
netzo deploy --project=NETZO_PROJECT_ID --api-key=NETZO_API_KEY