Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neuodev/receptor

Real-time messaging app. Available as a website and as MacOS, Linux, and Windows application.
https://github.com/neuodev/receptor

chatapp javascript postgresql react rust socket-io tauri typescript websockets

Last synced: 21 days ago
JSON representation

Real-time messaging app. Available as a website and as MacOS, Linux, and Windows application.

Awesome Lists containing this project

README

        

# Receptor

Real-time messaging app. Available as a web, MacOS, Linux, and Windows application.


Logo

![group_chat](./preview/group_chat.png)
![friends](./preview/friends.png)

See more?

![receptor-chat](./preview/chat.png)
![receptor-chat](./preview/closed_group.png)
![receptor-chat](./preview/empty.png)
![receptor-chat](./preview/sign_in.png)

## [Database Schema](https://drawsql.app/teams/no-sim/diagrams/rustchat)

![Schema](./schema.png)

## Events

```ts
// Websocket events
enum Event {
Connect = "connect",
Disconnect = "disconnect",
AddFriend = "addFriend",
AcceptFriend = "acceptFriend",
RemoveFriend = "removeFriend",
Notification = "notification",
Login = "login",
Logout = "logout",
GetUser = "getUser",
JoinRoom = "joinRoom",
LeaveRoom = "leaveRoom",
RoomMessage = "sendRoomMsg",
UpdateUser = "updateUser",
}
```

## API

For full API documentation try import this [postman collection](./receptor-api.postman_collection.json)


Register - POST /api/v1/user/register

### Reqeust

```ts
type Body = {
username: string;
email: string;
password: string;
};
```

### Response

```ts
type Response = {
userId: number;
};
```


Login - POST /api/v1/user/login

### Reqeust

```ts
type Body = {
email: string;
password: string;
};
```

### Response

```ts
type Response = {
user: User;
token: string;
};
```


Get users - GET /api/v1/user

### Reqeust

| Query Param. | Description | Type | Default |
| ------------ | -------------------------------- | ------ | ------------ |
| q | Search by `email` and `username` | string | Empty string |
| page | Number of the current page | number | 1 |
| limit | Number of items per response | number | 10 |

### Response

```ts
type Reponse = {
users: Array;
count: number;
};
```


Get friends - GET /api/v1/user/friends

### Reqeust

Access only by authorized users

```ts
type Headers = {
authorization: string; // Bearer auth token
};
```

### Response

```ts
type Reponse = Array;
```


Get room messages - GET /api/v1/room/:roomId

### Reqeust

Access only by authorized users

```ts
type Headers = {
authorization: string; // Bearer auth token
};
```

### Response

```ts
type Reponse = Array;
```


Get user groups - GET /api/v1/group

### Reqeust

Access only by authorized users

```ts
type Headers = {
authorization: string; // Bearer auth token
};
```

### Response

```ts
type Reponse = Array<{
id: number;
name: string;
type: string;
createdAt: Date;
updatedAt: Data;
participants: Array;
}>;
```


Create new group- POST /api/v1/group

### Reqeust

```ts
type Body = {
groupName: string;
userIds: number[];
};
```

### Response

```ts
type Reponse = {
roomId: number;
};
```


Delete group - DELETE /api/v1/group/:groupId - Owner only

### Reqeust

Access only by authorized users

```ts
type Headers = {
authorization: string; // Bearer auth token
};
```

### Response

```ts
type Reponse = {
roomId: number;
};
```


Leave group - DELETE /api/v1/group/:groupId/leave

### Reqeust

Access only by authorized users

```ts
type Headers = {
authorization: string; // Bearer auth token
};
```

### Response

```ts
type Reponse = {
roomId: number;
};
```