OCI — Rappi Simulator

Architecture

[Diagram]

The Rappi Simulator runs as a Bun HTTP server on an Oracle Cloud Infrastructure VM. It simulates two external interactions:

  1. Order ingestion (POST /send-order) — acts as the Rappi app, generating mock food orders and forwarding them to the AWS API Gateway
  2. Status webhook (POST /status-update) — receives order progress updates from AWS EventBridge (via notifyRappi Lambda) when a Rappi-sourced order changes state

API Endpoints

GET /health

Returns server uptime.

curl http://150.136.150.51:3000/health
{ "status": "ok", "uptime": 123.45 }

POST /send-order

Generates a mock Rappi order and forwards it to AWS. Accepts optional body overrides.

curl -X POST http://150.136.150.51:3000/send-order \
  -H "Content-Type: application/json" \
  -d '{}'
curl -X POST http://150.136.150.51:3000/send-order \
  -H "Content-Type: application/json" \
  -d '{"tenant_id": "sucursal_lima_centro"}'

Request body (all fields optional — random defaults are used):

Field Type Description
tenant_id sucursal_{string} Branch identifier
customer.name String Customer name
customer.phone? String Customer phone
items [{name, quantity, price}] Order items

Response:

{
  "sent": {
    "tenant_id": "sucursal_lima_centro",
    "source": "RAPPI",
    "customer": { "name": "Pedro Sanchez", "phone": "987654323" },
    "items": [{ "name": "Whopper", "quantity": 1, "price": 18.9 }]
  },
  "response": { "status": 201, "body": { "order_id": "uuid" } }
}

POST /status-update

Receives status updates from AWS when a Rappi order progresses through the kitchen workflow.

curl -X POST http://150.136.150.51:3000/status-update \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": "test-001",
    "tenant_id": "sucursal_lima_centro",
    "status": "PENDIENTE_COCINA",
    "step": "COCINA",
    "timestamp": "2026-06-26T18:00:00Z"
  }'

Response: { "received": true }

GET /log

Lists all received status updates (in-memory, resets on restart).

curl http://150.136.150.51:3000/log
{
  "count": 3,
  "updates": [
    { "order_id": "test-001", "status": "PENDIENTE_COCINA", ... }
  ]
}

Infrastructure

Compute Instance

Property Value
Name vm-desa
OCID ocid1.instance.oc1.iad.anuwcljs...
Shape VM.Standard.A2.Flex
OS Oracle Linux 9.7 (ARM64)
Public IP 150.136.150.51
Private IP 10.0.0.16
SSH Key ssh-key-2026-05-08.key
SSH User opc
Region us-ashburn-1
AD fYyR:US-ASHBURN-AD-1

Network

Property Value
VCN vcn-lab
Subnet public subnet-vcn-lab (10.0.0.0/24)
Security List Default Security List for vcn-lab

OS Firewall (firewalld):

Port Protocol Purpose
3000 TCP Rappi Simulator HTTP
8000 TCP Other services

Runtime

Component Version
Bun 1.1.43 (ARM64)
Runtime systemd service

Deployment

SSH Access

ssh -i ssh-key-2026-05-08.key opc@150.136.150.51

File Structure on VM

/home/opc/rappi-simulator/
├── src/
│   ├── server.ts          # Bun HTTP server with 4 routes
│   ├── types.ts           # Shared TypeScript types
│   └── lib/
│       └── simulator.ts   # Order generator + status logger
├── package.json
└── tsconfig.json

Systemd Service

/etc/systemd/system/rappi-simulator.service
[Unit]
Description=Rappi Simulator
After=network.target

[Service]
Type=simple
User=opc
WorkingDirectory=/home/opc/rappi-simulator
Environment=PORT=3000
Environment=AWS_API_URL=http://placeholder-aws-api
ExecStart=/usr/local/bin/bun run src/server.ts
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Service Management

systemctl status rappi-simulator
sudo systemctl restart rappi-simulator
sudo journalctl -u rappi-simulator -f

Environment Variables

Variable Current Value Description
PORT 3000 HTTP server port
AWS_API_URL http://placeholder-aws-api AWS API Gateway base URL (update when deployed)

Integration Flow

[Diagram]

Multi-Cloud Wiring

When AWS is deployed, two URLs need to be connected:

Direction Config Location Variable Value
OCI → AWS /etc/systemd/system/rappi-simulator.service AWS_API_URL AWS API Gateway base URL
AWS → OCI serverless.yml in backend-serverless-aws RAPPI_WEBHOOK_URL http://150.136.150.51:3000/status-update

Source Code

Repository: Proyecto-BurgerKing/integracion-rappi-gcp