feat: use fastify as server #2
1 changed files with 14 additions and 33 deletions
47
README.md
47
README.md
|
|
@ -30,10 +30,10 @@ I thought:
|
|||
We are currently in a focused rewrite. All parts are subject to breaking changes in minor releases.
|
||||
|
||||
- [x] file-based API routing via fastify as server framework
|
||||
- [] file-based HTML pages routing & templating via Eta
|
||||
- [] auto-registry of custom elements
|
||||
- [] SSR custom elements
|
||||
- [] SSG
|
||||
- [ ] file-based HTML pages routing & templating via Eta
|
||||
- [ ] auto-registry of custom elements
|
||||
- [ ] SSR custom elements
|
||||
- [ ] SSG
|
||||
|
||||
## Try it today
|
||||
|
||||
|
|
@ -43,15 +43,7 @@ Run the following to generate a McFly starter project.
|
|||
npm create mcfly@latest
|
||||
```
|
||||
|
||||
## How it works (for the nerds)
|
||||
|
||||
It is primarily a runtime middleware for [Nitro](https://nitro.build). Every time a page is requested, the McFly middleware intercepts and assembles the view for the requestor. McFly does this with the assets it knows about which are mostly: pages, components, public assets. Additionally, Nitro is also capable of generating static assets on build time.
|
||||
|
||||
These patterns are commonly referred to as Server-Side Rendering and Static Site Generation (SSR & SSG).
|
||||
|
||||
The idea is to have a plugin system which allows for the core functionality to only "lean" on web platform features. Anything not yet a standard is implemented as a plugin which will be easily "swapped" away when the platform catches up.
|
||||
|
||||
## Features
|
||||
## Target Features
|
||||
|
||||
✅ Use vanilla custom elements (or sugar-coated web components)<br>
|
||||
✅ Write server-powered .html pages<br>
|
||||
|
|
@ -61,19 +53,7 @@ The idea is to have a plugin system which allows for the core functionality to o
|
|||
|
||||
## Special directories
|
||||
|
||||
**1. `./src/pages/`**
|
||||
|
||||
- file-based routing for `.html` files
|
||||
- directly use custom elements & static fragments (no imports or registry maintenance needed)
|
||||
- use `<script server:setup>` to define logic that runs on the server, which then gets stripped away
|
||||
|
||||
**2. `./src/components/`**
|
||||
|
||||
- custom element constructor files (only `.js` files for now)
|
||||
- all components are automatically registered using their file names; a `hello-world.js` component can be used as `<hello-world>`
|
||||
- static `.html` fragments; a `my-header.html` fragment can be directly used as `<my-header>`
|
||||
|
||||
**3. `./src/api/`**
|
||||
**1. `./src/api/`**
|
||||
|
||||
- file-based routing for REST API endpoints
|
||||
- e.g., `./src/api/users.js` can be accessed via `http://<domain>/api/users`
|
||||
|
|
@ -82,11 +62,12 @@ The idea is to have a plugin system which allows for the core functionality to o
|
|||
|
||||
The following are the project packages published on the NPM registry:
|
||||
|
||||
| Package | Description | Version |
|
||||
| :----------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| [`@mcflyjs/config`](https://ayco.io/n/@mcflyjs/config) | Nitro server config for McFly projects |  |
|
||||
| [`@mcflyjs/core`](https://ayco.io/n/@mcflyjs/core) | Route event and config handlers |  |
|
||||
| [`create-mcfly`](https://ayco.io/n/create-mcfly) | Script for scaffolding a new McFly workspace |  |
|
||||
| Package | Description | Version |
|
||||
| :----------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| [`@mcflyjs/config`](https://ayco.io/n/@mcflyjs/config) | Configuration handling for McFly projects |  |
|
||||
| [`@mcflyjs/core`](https://ayco.io/n/@mcflyjs/core) | Commands & runtime handling |  |
|
||||
| [`@mcflyjs/fastify`](https://ayco.io/n/@mcflyjs/core) | Adapter for using fastify as server framework |  |
|
||||
| [`create-mcfly`](https://ayco.io/n/create-mcfly) | Script for scaffolding a new McFly workspace |  |
|
||||
|
||||
## Project setup
|
||||
|
||||
|
|
@ -108,9 +89,9 @@ The following commands are available to you on this project. Add more, or modify
|
|||
|
||||
## More info
|
||||
|
||||
This framework is a result of [an exploration](https://social.ayco.io/@ayo/111195315785886977) for using [Nitro](https://nitro.build) and custom elements using a minimal [Web Component Base](https://WebComponent.io) class.
|
||||
This framework was initially a result of [an exploration](https://social.ayco.io/@ayo/111195315785886977) for using [Nitro](https://nitro.build) and custom elements using a minimal [Web Component Base](https://WebComponent.io) class.
|
||||
|
||||
**Nitro** is the same production-grade web server powering [Nuxt](https://nuxt.com/)
|
||||
In 2026, we pivoted to a new target architecture to become more like a "glue" that allows putting together existing options that achieve our goals. We avoid building custom mechanisms when we can. The resulting architecture theoretically allows using different server frameworks, templating libraries, custom element libraries, etc.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue