2024-05-21 15:30:56 +08:00
|
|
|
# Waku Frontend
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
The chat application to use The Waku Network.
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
## Why
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
- a PoC to battle test The Waku Network.
|
|
|
|
|
- create user experience with REST API / WebSocket
|
|
|
|
|
- facilitate the developer adoption of Waku protocols
|
|
|
|
|
- split concern to harden the protocol stabliity with C/S model
|
|
|
|
|
- incubate app based sync protocol
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*Notes:* This project is still in the early stage of development, and the data is not persistent, you may lose the message history any time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
### Public community chat
|
|
|
|
|
|
|
|
|
|
The public chat room is open to everyone who knows the community name. The content is not encrypted.
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
## Plans
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
- WebSocket to support real-time chat
|
|
|
|
|
- End-to-end encryption for 1to1 chat
|
2023-10-30 23:57:10 +01:00
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
2024-05-21 12:06:14 +02:00
|
|
|
### Locally
|
2024-05-21 15:30:56 +08:00
|
|
|
```shell
|
|
|
|
|
npm install
|
|
|
|
|
|
|
|
|
|
npm run dev
|
2023-11-01 02:39:46 +01:00
|
|
|
```
|
|
|
|
|
|
2024-06-12 14:06:27 +02:00
|
|
|
The default API endpoint used to contact a Waku Node is http://localhost:8645
|
|
|
|
|
|
|
|
|
|
In order to set a custom endpoint, please set the env variable `VITE_API_ENDPOINT`
|
|
|
|
|
|
|
|
|
|
For example
|
|
|
|
|
```
|
|
|
|
|
export VITE_API_ENDPOINT=<my-other-endpoint>
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-21 12:06:14 +02:00
|
|
|
### Docker
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docker build -t waku-frontend .
|
|
|
|
|
docker run -p 5173:5173 waku-frontend
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
And go to `http://localhost:5173`.
|
|
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
## Caddy configuration
|
2023-11-01 02:39:46 +01:00
|
|
|
|
|
|
|
|
```
|
2024-05-21 15:30:56 +08:00
|
|
|
your-domain.com {
|
|
|
|
|
@cors_preflight {
|
|
|
|
|
method OPTIONS
|
|
|
|
|
}
|
|
|
|
|
respond @cors_preflight 204
|
|
|
|
|
|
|
|
|
|
header {
|
|
|
|
|
Access-Control-Allow-Origin *
|
|
|
|
|
Access-Control-Allow-Methods GET,POST,OPTIONS,HEAD,PATCH,PUT,DELETE
|
|
|
|
|
Access-Control-Allow-Headers User-Agent,Content-Type,X-Api-Key
|
|
|
|
|
Access-Control-Max-Age 86400
|
|
|
|
|
}
|
|
|
|
|
reverse_proxy :8645
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Depend APIs
|
|
|
|
|
|
|
|
|
|
- /relay/v1/auto/messages
|
2024-06-12 13:30:32 +02:00
|
|
|
- /store/v3/messages
|
2024-05-21 15:30:56 +08:00
|
|
|
|
|
|
|
|
## Known Issues
|
2023-12-06 16:12:29 +05:30
|
|
|
|
2024-05-21 15:30:56 +08:00
|
|
|
- https://github.com/waku-org/nwaku/issues/2615, temporary fix is set pageSize to `300`.
|