Important
This project has been discontinued and is no longer being actively worked on. Since the project has been abandoned, I've decided to make my contribution open source.
It's also worth noting that this project was never truly completed. There is still a significant amount of work required for it to be considered finished, and many planned features and improvements were never implemented.
The front-end source code is available here: PixelMessager Frontend.
I also no longer actively work with TypeScript/JavaScript.
This document describes all backend endpoints, authentication, and data structures for PixelMessenger.
-
Install dependencies:
npm install
-
Configure environment variables:
Copy.env.exampleto.envand fill in the required values. -
Run in development:
npm run dev:watch
-
Build for production:
npm run build npm start
- All protected endpoints require a JWT token in the
Authorizationheader:Authorization: Bearer <token> - Socket connections require a JWT token in the
authpayload.
Returns a list of all users.
Response Example:
[
{
"id": "fd7ecb69-c413-4d82-b5c6-a66cabf50c48",
"username": "testuser",
"email": "test@example.com",
"password": "hashed_password",
"createdAt": "2025-06-21T22:02:38.925Z"
}
]Register a new user.
Request Body:
{
"username": "string",
"email": "string",
"password": "string"
}Response:
- If email or username exists:
{ "text": "Email or Username already exists!" } - On success:
{ "text": "Account Created!", "token": "jwt_token" }
Get a list of direct chats for the authenticated user.
Headers:
Authorization: Bearer <token>
Response Example:
[
{
"id": "chat_id",
"type": "DIRECT",
"participants": [
{
"id": "participant_id",
"user": {
"uuid": "user_uuid",
"username": "username",
"email": "email"
},
"publicKey": "public_key",
"encryptedPrivateKey": "encrypted_private_key",
"joinedAt": "timestamp"
}
],
"name": "OtherUserName",
"createdAt": "timestamp"
}
]Returns all global chat messages.
Response Example:
[
{
"id": "803c0c2b-926c-40bb-80a1-4b46041da246",
"sendedById": 1,
"sendedByUsername": "Arad",
"message": "hello",
"receiverId": null,
"inGlobalChat": true,
"timestamp": "123123123123"
}
]Get messages for a specific direct message (DM) chat.
Request Body:
{ "userId": number }Params:
dmId: number
Response:
Same as /messages endpoint.
Send or receive a chat message.
Payload:
{
chat: Chat;
content: string;
}Create a new direct chat.
Payload:
{
publicKey: string;
receiver: User;
encryptedPrivateKey: string;
}{
uuid: string;
username: string;
email: string;
password: string;
createdAt: string;
}{
id: string;
type: "DIRECT" | "GROUP" | "GLOBAL";
participants: ChatParticipant[];
name?: string;
message?: Message[];
createdAt: string;
}{
id: string;
chat: Chat;
user: User;
publicKey: string;
encryptedPrivateKey?: string;
joinedAt: string;
}{
id: string;
chat: Chat;
sender: User;
content: string;
createdAt: string;
}See .env.example for required variables:
JWT_SECRET– JWT signing keyDB_TYPE– Database type (e.g., postgres)DB_URL– Database connection URL