A modern TypeScript monorepo demonstrating real-time communication using Server-Sent Events (SSE) with Bun runtime.
- Real-time server-to-client communication using SSE
- TypeScript implementation for both client and server
- Modern Bun runtime for optimal performance
- Clean and responsive UI
- Automatic reconnection handling
- Cross-Origin Resource Sharing (CORS) enabled
packages/
├── client/ # SSE client application
│ ├── src/ # Source code
│ └── package.json # Client dependencies
└── server/ # SSE server implementation
├── src/ # Source code
└── package.json # Server dependencies
- Bun (v1.0.0 or higher)
- Node.js (v18.0.0 or higher)
- A modern web browser
-
Clone the repository
git clone <repository-url> cd server-sent-events
-
Install dependencies
bun install
-
Start the server
cd packages/server bun run dev -
Start the client
cd packages/client bun run dev -
Access the application
- Server: http://localhost:3000
- Client: http://localhost:8000
- Runs on port 3000
- SSE endpoint:
/events - Sends messages every 2 seconds
- Handles client disconnections gracefully
- Runs on port 8000
- Connects to SSE server
- Displays real-time messages
- Provides connection status
- Allows manual connection/disconnection