This is a Customer Ordering App for a two-person project demonstrating inter-application communication using RabbitMQ.
Built with SvelteKit + TypeScript for the frontend and Node.js + TypeScript + Express for the backend, this system allows users to place simple food and drink orders which are sent to another system (Person B) via RabbitMQ.
π³ Fully Dockerized - The entire application stack runs in Docker containers for easy deployment and development.
For the most updated code, visit order-kitchen, which is a unified setup of Part 1 (ordering-app) and Part 2 (kitchen-dashboard).
This app is part of a two-part system:
- π€ Person A (this repo) β Customer-facing web app for placing orders.
- π€ Person B β Kitchen Dashboard that receives and manages the orders with PostgreSQL storage.
The two apps communicate via RabbitMQ using shared message queues (order_created and order_status_updated) for real-time order processing.
- π Modern SvelteKit frontend with static generation
- π§ TypeScript backend with Express.js
- π¨ RabbitMQ message queue for order processing
- π³ Complete Docker containerization
- π Nginx reverse proxy for production-ready frontend
- π RabbitMQ Management UI for monitoring
- Frontend: SvelteKit + TypeScript + Vite
- Backend: Node.js + TypeScript + Express
- Messaging: RabbitMQ (
amqplib) - Containerization: Docker + Docker Compose
- Web Server: Nginx (for frontend)
- Development: Hot reload enabled
- Docker Desktop installed and running
- Git
-
Clone the repository:
git clone <your-repo-url> cd ordering-app
-
Start the entire application stack:
docker compose up -d
-
Access the application:
- π Frontend: http://localhost:8002
- π§ Backend API: http://localhost:8001
- π RabbitMQ Management: http://localhost:9002 (admin/admin)
That's it! The entire application is now running in Docker containers.
| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:8002 | Customer ordering interface |
| Backend API | http://localhost:8001 | REST API endpoints |
| RabbitMQ Management | http://localhost:9002 | Queue monitoring (admin/admin) |
Place a new order.
Request:
{
"name": "pizza",
"quantity": 2
}Response:
{
"message": "Order received"
}Example:
curl -X POST http://localhost:8001/api/order \
-H "Content-Type: application/json" \
-d '{"name":"pizza","quantity":2}'# Start the application
docker compose up -d
# Stop the application
docker compose down
# View logs
docker logs ordering-frontend
docker logs ordering-backend
docker logs ordering-rabbitmq
# Rebuild and restart (after code changes)
docker compose up --build -d
# Follow logs in real-time
docker compose logs -fordering-app/
βββ docker-compose.yml # Orchestrates all services
βββ DOCKER.md # Docker documentation
βββ README.md # This file
βββ backend/
β βββ Dockerfile # Backend container config
β βββ server.ts # TypeScript backend server
β βββ package.json # Node.js dependencies
β βββ tsconfig.json # TypeScript config
β βββ .dockerignore # Docker build exclusions
βββ frontend/
βββ Dockerfile # Multi-stage frontend build
βββ nginx.conf # Nginx configuration
βββ svelte.config.js # SvelteKit static adapter
βββ package.json # Frontend dependencies
βββ src/
β βββ routes/
β β βββ +layout.ts # Prerender configuration
β β βββ +page.svelte # Main ordering page
β βββ ...
βββ .dockerignore # Docker build exclusions
graph TB
A[Customer Browser] --> B[Nginx Frontend<br/>:8002]
B --> C[SvelteKit App]
C --> D[Backend API<br/>:8001]
D --> E[RabbitMQ<br/>:9001]
E --> F[Kitchen Dashboard<br/>Person B - :3001]
F --> G[PostgreSQL<br/>:5432]
H[RabbitMQ Management<br/>:9002] --> E
E -.-> |order_created| F
F -.-> |order_status_updated| E
Orders are sent to RabbitMQ in the following JSON format:
To Kitchen Dashboard (order_created queue):
{
"name": "item_name",
"quantity": number
}From Kitchen Dashboard (order_status_updated queue):
{
"orderId": number,
"status": "pending" | "received" | "completed",
"updatedAt": "ISO_timestamp"
}If you get "not_authorized" when logging into RabbitMQ Management UI:
- Use correct credentials: Username:
admin, Password:admin - Clear browser cache or try in incognito/private mode
- Wait for RabbitMQ to fully start:
Look for "Server startup complete" message
docker logs ordering-rabbitmq --tail 10
- Verify user exists:
docker exec ordering-rabbitmq rabbitmqctl list_users - Reset RabbitMQ if needed:
docker compose down docker volume rm ordering-app_rabbitmq_data docker compose up -d
If you get port conflicts, make sure no other services are running on ports 8001, 8002, 9001, or 9002.
Check the backend logs:
docker logs ordering-backendLook for "β Connected to RabbitMQ" messages.
Check if the frontend container is running:
docker psAnd check nginx logs:
docker logs ordering-frontendTo consume messages from the RabbitMQ queue in your separate Kitchen Dashboard application:
- Connect to RabbitMQ at
localhost:9001 - Use credentials:
admin/admin - Listen to the
orderQueuequeue - Send status updates back via
orderStatusqueue - Process incoming JSON messages in this format:
Order Message Format:
{
"name": "pizza",
"quantity": 2
}Status Update Format (from Kitchen Dashboard):
{
"orderId": 1,
"status": "completed",
"updatedAt": "2025-07-01T10:30:00Z"
}This project uses default credentials (admin/admin) for local development. For production deployment:
-
Change default credentials:
# Create a .env file (not tracked in git) cp .env.example .env # Edit .env with secure credentials
-
Use environment variables:
export RABBITMQ_DEFAULT_USER=your_secure_username export RABBITMQ_DEFAULT_PASS=your_secure_password
-
Never commit real credentials to version control.
β
Development credentials (admin/admin)
β
Localhost references
β
Docker configuration
β
Source code
β Production credentials
β Real API keys
β .env files with secrets
- Make your changes
- Rebuild the containers:
docker compose up --build -d - Test the functionality
- Submit your changes
This project is for educational purposes.