By recording HTML, CSS, and JS on the Nostr relay, it becomes possible to create a decentralized web hosting solution that eliminates the need for centralized servers. Web servers or Nostr clients retrieve these recorded data, transform them into appropriate forms, and deliver them.
## Reasons for Hosting on Nostr
- Tamper-resistant through public key-based integrity
- Fault tolerance through deployment on multiple relays
- Resistance to blocking due to the distribution of web servers or clients
- Faster retrieval speed compared to IPFS's DHT
## Proposed Approach
Each HTML, CSS, and JS file is assigned a `kind` for identification.
- HTML: `kind: 5392`
- CSS: `kind: 5393`
- JS: `kind: 5394`
The "content" field contains the content of the file. However, internal links (`href`, `src`, etc.) referenced within should be replaced with event IDs.
Access events using `/e/{nevent}`. Since event `nevent` are specified for each internal link, opening an HTML file enables automatic retrieval of data from this endpoint.
By using `nevent`, you can expedite the retrieval of relay information by including it internally, which offers the advantage of speed. However, it is also acceptable to implement the retrieval in the usual hex format as an option.
Additionally, this proposal can be extended to incorporate the NIP-33 based decentralized web hosting specification. This allows tracking of website data with a single identifier, keeping URL paths immutable.
Following the NIP-33 specification, the `kind` would be as follows.
- HTML: `kind: 35392`
- CSS: `kind: 35393`
- JS: `kind: 35394`
Identifiers must be included within the `d` tag.
**Example**
```json
{
...,
"kind": 35392,
"tags": [["d", "hostr-lp"]]
}
```
Moreover, internal links within the `content` should be assigned NIP-33 identifiers instead of event IDs.
The current web server implementation allows access to websites within a single domain. While this reduces the implementation complexity on the server side and provides resilience against blocking, it is not suitable for use with domain-based authorization systems (such as NIP-07). For instance, if signing is permitted for Nostr clients on the web hosting relay, it would grant permission for all web pages hosted on that relay, making it vulnerable to spam postings.