-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,111 @@ | ||
# ⚗️ Nitro | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![npm-edge version][npm-edge-version-src]][npm-edge-version-href] | ||
[![npm-edge downloads][npm-edge-downloads-src]][npm-edge-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] --> | ||
|
||
<h1 align="center">⚗️ Nitro</h1> | ||
<p align="center">Build and Deploy Universal JavaScript Servers</p> | ||
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.** | ||
|
||
## Why use Nitro? | ||
- 📖 [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) | ||
|
||
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!** | ||
## 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> | ||
- 🐇 **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 3](https://v3.nuxtjs.org/guide/concepts/server-engine) is using Nitro as its server engine. | ||
|
||
<br> | ||
<hr> | ||
<h3><a href="https://nitro.unjs.io">📖 Documentation</a></h3> | ||
<h3><a href="https://github.com/unjs/nitro/blob/main/CHANGELOG.md">✍️ Changelog</a></h3> | ||
<h3><a href="https://stackblitz.com/github/unjs/nitro/tree/main/examples/hello-world">🏀 Online playground</a></h3> | ||
<hr> | ||
<br> | ||
[Nuxt](https://nuxt.com) is using Nitro as its [server engine](https://nuxt.com/docs/guide/concepts/server-engine). | ||
|
||
<h2 align="center">😺 Quick Start</h2> | ||
## 😺 Quick Start | ||
|
||
0️⃣ Create an empty directory `nitro-app` | ||
Create an empty directory `nitro-app` | ||
|
||
```bash | ||
mkdir nitro-app | ||
cd nitro-app | ||
``` | ||
|
||
1️⃣ Create `routes/index.ts`: | ||
Create a `routes/index.ts`: | ||
|
||
```ts [routes/index.ts] | ||
export default defineEventHandler(() => "nitro is amazing!"); | ||
```ts | ||
export default defineEventHandler(() => "Hello from Nitro"); | ||
``` | ||
|
||
2️⃣ Start development server: | ||
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 | ||
Check `.nitro/dev/index.mjs` if want to know what is happening. | ||
|
||
3️⃣ You can now build your production-ready server: | ||
Build your production-ready server: | ||
|
||
```bash | ||
npx nitropack build | ||
``` | ||
|
||
4️⃣ Output is in the `.output` directory and ready to be deployed on almost any VPS with no dependencies. You can locally try it too: | ||
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's it you got it! Read the [documentation](https://nitro.unjs.io) to learn more. | ||
That simple! Read the [documentation](https://nitro.unjs.io) to learn more. | ||
|
||
<hr> | ||
<h3 align="center">🌱 nitro is young and under development</h3> | ||
### Contributing | ||
|
||
Clone the repository and install the dependencies using [pnpm](https://pnpm.io/) and stub nitropack: | ||
|
||
```sh | ||
pnpm i | ||
npm run stub | ||
``` | ||
|
||
Check [🐛 open issues](https://github.com/unjs/nitro/issues) for the known issues and roadmap and tell us [💡your ideas](https://github.com/unjs/nitro/discussions/new)! | ||
Run the local [playground/](./playground): | ||
|
||
```sh | ||
npm run dev | ||
``` | ||
|
||
Run the [tests](./test) with [Vitest](https://vitest.dev): | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
<hr> | ||
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). | ||
|
||
## License | ||
|
||
Made with 💛 Published under [MIT](./LICENSE). | ||
|
||
<!-- Badges --> | ||
|
||
[npm-version-src]: https://flat.badgen.net/npm/v/nitropack?style=flat-square&label=stable | ||
[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://flat.badgen.net/npm/dm/nitropack?style=flat-square&label=stable | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/nitropack?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-downloads-href]: https://npmjs.com/package/nitropack | ||
[npm-edge-version-src]: https://flat.badgen.net/npm/v/nitropack-edge?style=flat-square&label=edge | ||
[npm-edge-version-href]: https://npmjs.com/package/nitropack-edge | ||
[npm-edge-downloads-src]: https://flat.badgen.net/npm/dm/nitropack-edge?style=flat-square&label=edge | ||
[npm-edge-downloads-href]: https://npmjs.com/package/nitropack-edge | ||
[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://flat.badgen.net/codecov/c/gh/unjs/nitro/main?style=flat-square | ||
[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 |