Merge master into main: Home server identity model
This commit is contained in:
commit
6565ad81b5
227 files changed
+56297
-145
No files matched your search
@@ -1,49 +1,46 @@
|
||||
A server app built using [Shelf](https://pub.dev/packages/shelf),
|
||||
configured to enable running with [Docker](https://www.docker.com/).
|
||||
# Chat Server
|
||||
|
||||
This sample code handles HTTP GET requests to `/` and `/echo/<message>`
|
||||
A self-hosted Discord alternative with decentralized identity using the Home Server model.
|
||||
|
||||
# Running the sample
|
||||
## Architecture
|
||||
|
||||
## Running with the Dart SDK
|
||||
Each user has a **home server** where their identity lives (keypair), and can seamlessly join other **guest servers** using cryptographic signatures.
|
||||
|
||||
You can run the example with the [Dart SDK](https://dart.dev/get-dart)
|
||||
like this:
|
||||
- **NO identity server** - just use one regular server as "home"
|
||||
- **NO federation protocol** - servers don't talk to each other
|
||||
- **Client does everything** - syncs, cross-server requests, profile updates
|
||||
|
||||
```
|
||||
$ dart run bin/server.dart
|
||||
Server listening on port 8080
|
||||
See [ARCHITECTURE.md](./ARCHITECTURE.md) for full details.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
dart pub get
|
||||
|
||||
# Generate ObjectBox code
|
||||
dart run build_runner build
|
||||
|
||||
# Run server
|
||||
dart run lib/server.dart
|
||||
```
|
||||
|
||||
And then from a second terminal:
|
||||
```
|
||||
$ curl http://0.0.0.0:8080
|
||||
Hello, World!
|
||||
$ curl http://0.0.0.0:8080/echo/I_love_Dart
|
||||
I_love_Dart
|
||||
```
|
||||
|
||||
## Running with Docker
|
||||
|
||||
If you have [Docker Desktop](https://www.docker.com/get-started) installed, you
|
||||
can build and run with the `docker` command:
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
$ docker build . -t myserver
|
||||
$ docker run -it -p 8080:8080 myserver
|
||||
Server listening on port 8080
|
||||
lib/
|
||||
├── server.dart # Entry point, routes
|
||||
├── models.dart # User, Channel, Message entities
|
||||
├── objectbox.g.dart # Generated
|
||||
├── config/config.dart # Server config
|
||||
└── src/
|
||||
├── auth/ # Keypair, JWT, middleware
|
||||
├── handlers/ # API endpoints
|
||||
└── utils/ # Helpers
|
||||
```
|
||||
|
||||
And then from a second terminal:
|
||||
```
|
||||
$ curl http://0.0.0.0:8080
|
||||
Hello, World!
|
||||
$ curl http://0.0.0.0:8080/echo/I_love_Dart
|
||||
I_love_Dart
|
||||
```
|
||||
## Tech Stack
|
||||
|
||||
You should see the logging printed in the first terminal:
|
||||
```
|
||||
2021-05-06T15:47:04.620417 0:00:00.000158 GET [200] /
|
||||
2021-05-06T15:47:08.392928 0:00:00.001216 GET [200] /echo/I_love_Dart
|
||||
```
|
||||
- **Framework**: Relic 1.0
|
||||
- **Database**: ObjectBox
|
||||
- **Auth**: JWT + Ed25519 signatures
|
||||
Reference in new issue
Block a user