This repository is a skill assessment project for a pre-interview evaluation with RGT Company in Korea.
- React Typscript
- Python FastApi
- Dokcer
- PostgreSQL
- RabbitMQ
- WebSocket
- RESTful API
-
- Supports bi-directional WebSocket communication for user and business updates.
- Efficient handling of multiple active connections with user and business segregation.
-
- Server performs passive heartbeat checks every 30 seconds.
- Clients proactively initiate heartbeat checks if no server heartbeat is received within 30 seconds.
- Automatically disconnects inactive WebSocket connections.
-
- Periodically monitors active connections
- Dynamically adjusts monitoring intervals based on the number of active connections.
- Detects and handles inactive connections by disconnecting them
-
- Stores failed messages in Redis for later retry.
- Implements a retry mechanism with a configurable maximum retry count.
- Supports dead-letter queue for messages that exceed retry limits
-
- Broadcasts order updates to specific users or businesses via WebSocket
- Handles user-specific and business-specific message routing
- Saves failed messages for retry in case of connection issues
- User Accounts: ID and password are the same for each account:
rgt1
andrgt2
- Business Accounts: ID and password are the same for each account:
biz1
andbiz2
user
: General account users.bizUser
: Business account users.
- Separate JWT session management for
user
andbizUser
. - After JWT expiration, any API request redirects to the login page.
- Click the
Change
button in the top-right corner to switch to the login selection screen.
- Located at
src/pages/EntryPage.tsx
.
-
Socket Message Format:
{ "type": string, "data": [object] }
-
Supported Message Types:
order_update
-
Socket Callbacks:
- Register type-specific callbacks directly on the page.
- Multiple callbacks can be registered.
- Use callbacks for state management.
-
Socket Buffering Layer:
- Introduced a producer-consumer business module for buffering to handle concurrent operations effectively.
- JWT expiration time is 15 minutes.
- JWT renewal logic is not included.
- Implemented a Socket Pool to reuse socket resources.
- Incorporated Rabbit Task for enhanced concurrency:
- Designed with extensible and parallelizable multi-consumer architecture.
- Chose PostgreSQL Driver for robust asynchronous operations.
- Due to time constraints, CI/CD was not extended to infrastructure.
- Automated resource management and deployment logic included via Terraform (AWS-based).
- Node 22+
- Install Docker and Node.js.
- Install Poetry:
pip install poetry
git clone https://github.com/bakboem/rgt-order-system.git
cd rgt-order-system
docker-compose -f ./docker-compose-dev.yml up --build -d
- open a shell
cd backend
poetry install --no-root
poetry shell
uvicorn main:app --reload --host 0.0.0.0 --port 8000
- open a shell
cd rgt-order-system/frontend/react-app
yarn install
yarn start