- Build the Docker images:
# Build all services
docker-compose build
# Start the entire stack
docker-compose up -d
# Check running services
docker-compose ps- Individual container management:
# Start specific services
docker-compose up -d mysql mongodb postgres
# View logs
docker-compose logs -f federiq
# Stop services
docker-compose down- Connect to MySQL:
docker exec -it federiq-mysql mysql -uroot -p- Create the database structure:
CREATE DATABASE federiq;
USE federiq;
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100),
email VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE transactions (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT,
amount DECIMAL(10,2),
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);- Connect to MongoDB:
docker exec -it federiq-mongodb mongosh- Create collections:
use federiq
db.createCollection('user_profiles')
db.createCollection('analytics')
// Create indexes
db.user_profiles.createIndex({ "user_id": 1 })
db.analytics.createIndex({ "timestamp": 1 })Base URL: http://localhost:3000
-
Health Check
- Endpoint:
/health - Method: GET
- Description: Checks if the service is running
- Example:
curl http://localhost:3000/health
- Endpoint:
-
Federated Query
- Endpoint:
/federated_query - Method: GET
- Description: Query data across multiple data sources
Parameters:
page: Page number (default: 1)size: Items per page (default: 10)filter: Filter criteriasource: Comma-separated list of data sources
Examples:
# Basic query curl http://localhost:3000/federated_query # With pagination curl http://localhost:3000/federated_query?page=1&size=2 # With filtering curl http://localhost:3000/federated_query?filter=name=Alice # Query specific sources curl http://localhost:3000/federated_query?source=postgres,mysql
- Endpoint:
Import the following collection:
{
"info": {
"name": "FederIQ API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Health Check",
"request": {
"method": "GET",
"url": "http://localhost:3000/health"
}
},
{
"name": "Federated Query",
"request": {
"method": "GET",
"url": "http://localhost:3000/federated_query"
}
},
{
"name": "Paginated Query",
"request": {
"method": "GET",
"url": {
"raw": "http://localhost:3000/federated_query?page=1&size=2",
"query": [
{"key": "page", "value": "1"},
{"key": "size", "value": "2"}
]
}
}
},
{
"name": "Filtered Query",
"request": {
"method": "GET",
"url": {
"raw": "http://localhost:3000/federated_query?filter=name=Alice",
"query": [
{"key": "filter", "value": "name=Alice"}
]
}
}
}
]
}Test all endpoints:
# Health check
curl http://localhost:3000/health
# Basic query
curl http://localhost:3000/federated_query
# Paginated query
curl "http://localhost:3000/federated_query?page=1&size=2"
# Filtered query
curl "http://localhost:3000/federated_query?filter=name=Alice"
# Source-specific query
curl "http://localhost:3000/federated_query?source=postgres,mysql"The API returns standard HTTP status codes:
- 200: Success
- 400: Bad Request
- 404: Not Found
- 500: Internal Server Error
Example error response:
{
"error": {
"code": "BAD_REQUEST",
"message": "Invalid filter format"
}
}- View service logs:
# All services
docker-compose logs
# Specific service
docker-compose logs federiq
docker-compose logs mysql- Monitor container status:
docker-compose ps
docker statsFor more detailed documentation, please refer to the individual documentation files in the /docs directory of the project.