Skip to content

Commit

Permalink
docs: improve readme and getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 3, 2023
1 parent 23da516 commit 94d95fa
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 162 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.md
143 changes: 35 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,38 @@
# ⚗️ Nitro

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
<!-- [![GitHub Actions][github-actions-src]][github-actions-href] [![Codecov][codecov-src]][codecov-href] -->

Nitro provides a powerful toolchain and a runtime framework from the [UnJS](https://github.com/unjs) ecosystem to build and deploy **any JavaScript server, anywhere.**

- 📖 [Documentation](https://nitro.unjs.io)
- ✍️ [Changelog](https://github.com/unjs/nitro/blob/main/CHANGELOG.md)
- 🏀 Online playground: [StackBlitz](https://stackblitz.com/github/unjs/nitro/tree/main/examples/hello-world) / [CodeSandbox](https://codesandbox.io/p/sandbox/nitro-5jssbm)

## Features

- 🐇 **Rapid development** experience with hot module replacement <br>
- 😌 **Multi-provider** deployments with a single codebase and zero-configuration<br>
- 💼 **Portable and compact** deployments without `node_modules` dependency <br>
- 📁 **Directory structure** aware to register API routes and more with zero configuration <br>
- 🤏 **Minimal Design** to fit into any solution with minimum overhead <br>
- 🚀 **Code-splitting** and async chunk loading for fast server startup time <br>
- 👕 **TypeScript** fully supported <br>
- 💾 **Multi-driver storage** and caching layer <br>
- 💰 **Route caching** and static **pre-rendering** with built-in crawler <br>
- 🐱 **Hackable** to extend almost any part of nitro using options <br>
-**Auto imports** for lazy folks and a tidy minimal codebase <br>
- 🏛️ **Best-effort compatibility** for using legacy npm packages and mocking Node.js modules <br>

## Who is using Nitro?

[Nuxt](https://nuxt.com) is using Nitro as its [server engine](https://nuxt.com/docs/guide/concepts/server-engine).

## 😺 Quick Start

Create an empty directory `nitro-app`

```bash
mkdir nitro-app
cd nitro-app
```

Create a `routes/index.ts`:

```ts
export default defineEventHandler(() => "Hello from Nitro");
```

Start the development server:

```bash
npx nitropack dev
```

🪄 Your API is ready at `http://localhost:3000/`

Check `.nitro/dev/index.mjs` if want to know what is happening.

Build your production-ready server:

```bash
npx nitropack build
```

The output is in the `.output` directory and ready to be deployed on almost any VPS with no dependencies. You can locally try it too:

```bash
node .output/server/index.mjs
```

That simple! Read the [documentation](https://nitro.unjs.io) to learn more.

### Contributing

Clone the repository and install the dependencies using [pnpm](https://pnpm.io/) and stub nitropack:

```sh
pnpm i
npm run stub
```

Run the local [playground/](./playground):

```sh
npm run dev
```

Run the [tests](./test) with [Vitest](https://vitest.dev):

```sh
npm run test
```

Checkout the 🐛 [open issues](https://github.com/unjs/nitro/issues) for the known issues and roadmap or tell us 💡 [your ideas](https://github.com/unjs/nitro/discussions/new).
<p align="center">
<a href="https://nitro.unjs.io" target="_blank" rel="noopener noreferrer">
<img width="180" src="./docs/public/nitro.svg" alt="Nitro logo">
</a>
</p>
<p align="center">
<a href="https://npmjs.com/package/nitropack"><img src="https://img.shields.io/npm/v/nitropack?style=flat&colorA=18181B&colorB=d8c449" alt="npm version"></a>
<a href="https://npmjs.com/package/nitropack"><img src="https://img.shields.io/npm/dm/nitropack?style=flat&colorA=18181B&colorB=d8c449" alt="npm downloads"></a>
<a href="https://github.com/unjs/nitro/blob/main/LICENSE"><img src="https://img.shields.io/github/license/unjs/nitro.svg?style=flat&colorA=18181B&colorB=d8c449" alt="License"></a>
</p>
<br/>

# Nitro

> Build and deploy universal web servers
> The open engine powering [Nuxt](https://nuxt.com) and [open to everyone](https://github.com/unjs/nitro/discussions/1015).
- 🐇 Rapid development with HMR
- 😌 Provider agnostic deployments with 15+ built-in presets
- 💼 Portable and compact output
- 📁 Directory structure conventions
- 🤏 Minimal design
- 🚀 Code-splitting
- 👕 TypeScript support
- 💾 Universal storage
- 💰 Route caching
- 🐱 Hackable
- ✨ Auto Imports

📖 Read [the documentation](https://nitro.unjs.io) to learn more or directly jump to the [getting started](https://nitro.unjs.io/guide/introduction/getting-started).

## Contribution

See [contribution guide](https://nitro.unjs.io/guide/community/contribution).

## License

Made with 💛 Published under [MIT](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/nitropack?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/nitropack
[npm-downloads-src]: https://img.shields.io/npm/dm/nitropack?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/nitropack
[github-actions-src]: https://flat.badgen.net/github/status/unjs/nitro?style=flat-square
[github-actions-href]: https://github.com/unjs/nitro/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/nitro/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/nitro
[license-src]: https://img.shields.io/github/license/unjs/nitro.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/nitro/blob/main/LICENSE
Made with 💛 Published under the [MIT](./LICENSE) license.
48 changes: 24 additions & 24 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
export default defineAppConfig({
docus: {
title: '⚗️ Nitro',
title: "Nitro",
header: {
title: false,
logo: true
logo: true,
},
description: 'Build and Deploy Universal JavaScript Servers.',
url: 'https://nitro.unjs.io',
image: '/cover.png',
description: "Build and Deploy Universal JavaScript Servers.",
url: "https://nitro.unjs.io",
image: "/cover.png",
socials: {
twitter: 'unjsio',
github: 'unjs/nitro'
twitter: "unjsio",
github: "unjs/nitro",
},
github: {
owner: 'unjs',
repo: 'nitro',
branch: 'main',
dir: 'docs/content',
edit: true
owner: "unjs",
repo: "nitro",
branch: "main",
dir: "docs/content",
edit: true,
},
aside: {
level: 1
level: 1,
},
footer: {
credits: {
icon: '',
text: 'Made with 💛',
href: 'https://github.com/unjs/nitro'
icon: "",
text: "Made with 💛",
href: "https://github.com/unjs/nitro",
},
iconLinks: [
{
href: 'https://unjs.io',
icon: 'vscode-icons:file-type-js-official',
label: 'UnJS'
}
]
}
}
})
href: "https://unjs.io",
icon: "vscode-icons:file-type-js-official",
label: "UnJS",
},
],
},
},
});
5 changes: 3 additions & 2 deletions docs/components/global/Logo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<span style="overflow: hidden;">
⚗️ Nitro
<span style="overflow: hidden">
<img width="30" src="/nitro.svg" alt="Nitro Logo" style="display: inline" />
Nitro
</span>
</template>
66 changes: 43 additions & 23 deletions docs/content/1.guide/1.introduction/0.getting-started.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,58 @@
# Getting Started
# Getting Started

Let's create a new Nitro app in few steps.

## Play online
## Play Online

:button-link[Open on Stackblitz]{href="https://stackblitz.com/github/unjs/nitro/tree/main/examples/hello-world" icon="simple-icons:stackblitz" blank style="margin-right: 10px;"}
:button-link[Open on CodeSandox]{href="https://codesandbox.io/p/sandbox/nitro-template-5jssbm" icon="simple-icons:codesandbox" blank}

## Using Starter Template

## Create locally
Before getting started, please make sure you have installed the recommended setup:

Create an empty directory `nitro-app`
* **Node.js**<sup>*</sup> (latest LTS version) 👉 [[Download](https://nodejs.org/en/download/)]
* **Visual Studio Code** [[Download](https://code.visualstudio.com/)]
* [corepack](https://nodejs.org/api/corepack.html) for using pnpm and yarn. 👉 Run `corepack enable`

```bash
mkdir nitro-app
Create a new project using starter template:


::code-group

```bash [npx]
npx giget@latest nitro nitro-app
```

```bash [pnpm]
pnpm dlx giget@latest nitro nitro-app
```

::

```sh
cd nitro-app
```

Create `routes/index.ts`:
Install the dependencies:

```ts [routes/index.ts]
export default defineEventHandler(() => 'nitro is amazing!')
::code-group

```bash [npm]
npm install
```

```bash [yarn]
yarn install
```

```bash [pnpm]
pnpm install
```

::


Start development server:

```bash
Expand All @@ -31,29 +61,19 @@ npx nitropack dev

🪄 Your API is ready at `http://localhost:3000/`

**Tip:** Check `.nitro/dev/index.mjs` if want to know what is happening
::alert
Check `.nitro/dev/index.mjs` if want to know what is happening
::

You can now build your production-ready server:

```bash
npx nitropack build
````

Output is in the `.output` directory and ready to be deployed on almost any VPS with no dependencies. You can locally try it too:
Output is in the `.output` directory and ready to be deployed on almost any provider with no dependencies. You can locally try it too:

```bash
node .output/server/index.mjs
```

You can add `nitropack` using your package manager now:

```bash
# npm
npm i -D nitropack
# yarn
yarn add -D nitropack
# pnpm
pnpm i -D nitropack
```
14 changes: 9 additions & 5 deletions docs/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ cta:
- Get Started
- /guide/introduction/getting-started
secondary:
- Star on GitHub
- View on GitHub
- https://github.com/unjs/nitro
snippet:
- npx tiged unjs/nitro#starter
- npx nitropack dev
- npx giget@latest nitro
- cd nitro-app
- npm install
- npm run dev
---

#extra
:ellipsis

#title
⚗️ Nitro
Nitro

#description
Build and Deploy Universal JavaScript Servers, everywhere. :br The engine powering [Nuxt 3](https://nuxt.com) and open to anyone.
Build and deploy universal web servers. :br

The open engine powering [Nuxt](https://nuxt.com) and [open to everyone](https://github.com/unjs/nitro/discussions/1015).
::

::card-grid
Expand Down
Binary file added docs/public/nitro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/public/nitro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 94d95fa

Please sign in to comment.