# Chathub Server (Worker Version)
The Chathub Server is the backend service for the [Chathub](https://cnb.cool/tryandrun/web_dev/chat_hub/chathub) project. It provides an API for managing chat sessions and messages and is designed to be deployed on **Cloudflare Workers**, enabling a serverless, edge-based architecture.
## Prerequisites
- [Bun](https://bun.sh/) installed
- [Wrangler](https://developers.cloudflare.com/workers/wrangler/install-AND-update/) CLI installed
- A Cloudflare account
## Installation
Install the project dependencies using Bun:
```sh
bun install
To deploy the worker to Cloudflare, follow these steps:
Prepare the environment:
Ensure the public directory exists (required for static assets).
mkdir public
Start local development (Optional):
./scripts/dev_start. sh
Generate Types:
bunx wrangler types
Deploy to Cloudflare:
bunx wrangler deploy
Important Note: This worker depends on external services. You must deploy chathub, cf-worker-token-server, and cf-worker-totp concurrently to ensure the token and TOTP servers are accessible for the Chathub server to function correctly.