Chat App

-

real-time chat app built with Nuxt, WebSockets, PostgreSQL, and RustFS.

Tech Stack

The frontend is built with Nuxt, Vue, TypeScript, Tailwind CSS, and shadcn-vue. The backend uses Nuxt server routes and a separate Node.js WebSocket server (ws) for live messaging.

PostgreSQL stores chat data and is queried with Kysely. Better Auth handles authentication, and RustFS provides S3-compatible file storage. Docker Compose runs the local PostgreSQL service.

Screenshots

Database

PostgreSQL stores channels and messages. Message attachments are stored as JSONB metadata, while their files are stored in RustFS. Better Auth manages the user and session tables.

Table Fields
channels id, name, description, members, created_at
messages id, channel_id, user_id, content, attachment, created_at, edited_at

The message history endpoint returns messages with the author’s username and avatar:

{
  "id": "<message-uuid>",
  "channelId": "<channel-uuid>",
  "userId": "<user-id>",
  "content": "Hello!",
  "attachment": [],
  "timestamp": "<created-at>",
  "username": "<username>",
  "avatarUrl": "<image-url-or-null>"
}

API

Nuxt server routes provide endpoints for chat, channels, profiles, authentication, and file storage:

GET    /api/messages?channelId=<uuid>
POST   /api/messages
DELETE /api/messages/<id>
GET    /api/channels/<id>
POST   /api/channels/<id>
GET    /api/user/profile?userId=<id>
POST   /api/files/upload
GET    /api/files/<key>

POST /api/files/upload returns a file key, and GET /api/files/<key> serves the stored file. The WebSocket server runs at ws://localhost:8080/ws and broadcasts live messages to connected clients.