- Docker installed on your machine
- Docker Compose installed on your machine
- CSV file containing transaction data
- Create a directory for your application:
mkdir saoke-app
cd saoke-app- Create data directory and add CSV file:
mkdir dataThen copy file chuyen_khoan.csv into the data directory
- Create docker-compose.yml:
version: '3.8'
services:
backend:
image: thanghub2210/saoke-backend:latest
ports:
- "3001:3001"
volumes:
- ./data:/app/data
container_name: saoke-backend
frontend:
image: thanghub2210/saoke-frontend:latest
ports:
- "3000:3000"
depends_on:
- backend
container_name: saoke-frontend- Pull and run the application:
docker-compose up- Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- Ensure your CSV file is named
chuyen_khoan.csvand placed in thedatadirectory - The data directory must be in the same directory as your docker-compose.yml
git clone https://github.com/ThangNeo2210/transaction-query-web.git- Navigate to backend folder:
cd backend- Install dependencies:
npm install- Start server:
npm startServer will run on http://localhost:3001
- Navigate to frontend folder:
cd frontend- Install dependencies:
npm install- Start server: If you want to run in development mode:
npm run devIf you want to run in production mode:
npm run build
npm run startFrontend will run on http://localhost:3000
- Ensure backend is running before starting frontend
- Place chuyen_khoan.csv file in the data directory
/backend/data/chuyen_khoan.csv
We use k6 to benchmark the API search.
-
Install k6:
-
Navigate to backend folder:
cd backend- Run benchmark:
- Server backend is running on localhost:3001 so host in benchmark is localhost:3001
k6 run benchmark/search-benchmark.js- CSV file should have columns: date_time, trans_id, credit, detail
- API endpoint is http://localhost:3001/query?q=searchTerm.
- Example: http://localhost:3001/query?q=tạm ứng&startDate=2024-01-01&endDate=2024-01-31&minCredit=1000000&maxCredit=5000000
- key q is search by detail
- Format response:
{
"success": true,
"total": 100,
"data": list of records
}Example:
{
"success": true,
"total": 1,
"data": [
{
"date_time": "2024-01-01",
"trans_id": "1234567890",
"credit": 1000000,
"detail": "Chuyen khoan 1000000"
}
]
}