From 81bec47a225a9effce2b44dc979cb4e97d3db035 Mon Sep 17 00:00:00 2001 From: pandeymangg Date: Mon, 26 Jan 2026 08:54:16 +0400 Subject: [PATCH 1/3] renames docker-compose to docker compose --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 892b20b..ce9cac1 100644 --- a/Makefile +++ b/Makefile @@ -77,20 +77,20 @@ migrate: # Start Docker containers docker-up: @echo "Starting Docker containers..." - docker-compose up -d + docker compose up -d @echo "Waiting for services to be ready..." @sleep 3 - @docker-compose ps + @docker compose ps # Stop Docker containers docker-down: @echo "Stopping Docker containers..." - docker-compose down + docker compose down # Stop and remove volumes docker-clean: @echo "Stopping Docker containers and removing volumes..." - docker-compose down -v + docker compose down -v # Clean build artifacts clean: From a461a39423e58162e1ec7872829223e80dd0d38d Mon Sep 17 00:00:00 2001 From: pandeymangg Date: Mon, 26 Jan 2026 08:54:56 +0400 Subject: [PATCH 2/3] renames docker-compose to docker compose --- README.md | 28 +++++++++++++++++++++++++++- tests/README.md | 3 +++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7343da5..c30e2f5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ An open-source Experience Management (XM) database service. Hub is a headless AP - **Headless/API-only design** - UI lives in XM Suite (Hub is the backend) **Key Design Principles**: + - **Performance First**: Optimized for high-throughput data ingestion and retrieval - **Data Processing**: Focus on query performance, indexing strategies, and analytics capabilities - **Simple Architecture**: Barebones implementation with raw `net/http` and `pgx` for maintainability @@ -76,17 +77,20 @@ An open-source Experience Management (XM) database service. Hub is a headless AP 1. Clone the repository and navigate to the project directory 2. Set up the development environment: + ```bash make dev-setup ``` This will: + - Start PostgreSQL container - Install Go dependencies - Install development tools (swag for OpenAPI docs) - Run database migrations 3. Start the API server: + ```bash make run ``` @@ -98,31 +102,37 @@ The server will start on `http://localhost:8080` If you prefer not to use Make: 1. Start Docker containers: + ```bash -docker-compose up -d +docker compose up -d ``` 2. Copy environment variables: + ```bash cp .env.example .env ``` 3. Run migrations: + ```bash make migrate ``` 4. Set your API key: + ```bash export API_KEY=your-secret-key-here ``` Or add it to your `.env` file: + ``` API_KEY=your-secret-key-here ``` 5. Start the server: + ```bash go run ./cmd/api/main.go ``` @@ -130,12 +140,14 @@ go run ./cmd/api/main.go ## API Endpoints ### Health Check + - `GET /health` - Health check endpoint - `GET /swagger/` - Swagger API documentation ### Feedback Records #### Create Feedback Record + ```bash POST /v1/feedback-records Authorization: Bearer @@ -156,18 +168,21 @@ Content-Type: application/json ``` #### Get Feedback Record by ID + ```bash GET /v1/feedback-records/{id} Authorization: Bearer ``` #### List Feedback Records + ```bash GET /v1/feedback-records?source_type=survey&limit=50&offset=0 Authorization: Bearer ``` Query parameters: + - `source_type` - Filter by source type - `source_id` - Filter by source ID - `field_id` - Filter by field ID @@ -176,12 +191,14 @@ Query parameters: - `offset` - Pagination offset #### Search Feedback Records + ```bash GET /v1/feedback-records/search?query=feedback&source_type=survey&limit=20 Authorization: Bearer ``` #### Update Feedback Record + ```bash PATCH /v1/feedback-records/{id} Authorization: Bearer @@ -194,6 +211,7 @@ Content-Type: application/json ``` #### Delete Feedback Record + ```bash DELETE /v1/feedback-records/{id} Authorization: Bearer @@ -226,6 +244,7 @@ make tests Migrations are stored in the `migrations/` directory. To run migrations: + ```bash make migrate ``` @@ -237,11 +256,13 @@ This will execute `migrations/001_initial_schema.sql` using `psql`. Make sure yo Authentication is done via a single API key set in the `API_KEY` environment variable. The API key is validated against this environment variable for all protected endpoints. Set your API key: + ```bash export API_KEY=your-secret-key-here ``` Or add it to your `.env` file: + ``` API_KEY=your-secret-key-here ``` @@ -263,6 +284,7 @@ See [.env.example](.env.example) for all available configuration options: ## Example Requests ### Create a text response + ```bash curl -X POST http://localhost:8080/v1/feedback-records \ -H "Authorization: Bearer " \ @@ -276,12 +298,14 @@ curl -X POST http://localhost:8080/v1/feedback-records \ ``` ### Get all feedback records + ```bash curl http://localhost:8080/v1/feedback-records \ -H "Authorization: Bearer " ``` ### Update a feedback record + ```bash curl -X PATCH http://localhost:8080/v1/feedback-records/{id} \ -H "Authorization: Bearer " \ @@ -292,6 +316,7 @@ curl -X PATCH http://localhost:8080/v1/feedback-records/{id} \ ``` ### Delete a feedback record + ```bash curl -X DELETE http://localhost:8080/v1/feedback-records/{id} \ -H "Authorization: Bearer " @@ -307,6 +332,7 @@ The application follows a clean architecture pattern: 4. **Models** - Define domain entities and DTOs This separation allows for: + - Easy testing and mocking - Clear separation of concerns - Simple maintenance and refactoring diff --git a/tests/README.md b/tests/README.md index 4cc46af..93bb9c4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -13,16 +13,19 @@ Before running the tests, ensure: ## Running Tests Run all integration tests: + ```bash go test ./tests/... -v ``` Run a specific test: + ```bash go test ./tests -run TestHealthEndpoint -v ``` Run tests with coverage: + ```bash go test ./tests/... -v -cover ``` From 72b732c1711f09396ffdccd8aac2fba0554b5aa6 Mon Sep 17 00:00:00 2001 From: pandeymangg Date: Mon, 26 Jan 2026 08:59:28 +0400 Subject: [PATCH 3/3] fix --- README.md | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/README.md b/README.md index 9fef594..bdc81aa 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ An open-source Experience Management (XM) database service. Hub is a headless AP - **Headless/API-only design** - UI lives in XM Suite (Hub is the backend) **Key Design Principles**: - - **Performance First**: Optimized for high-throughput data ingestion and retrieval - **Data Processing**: Focus on query performance, indexing strategies, and analytics capabilities - **Simple Architecture**: Barebones implementation with raw `net/http` and `pgx` for maintainability @@ -77,13 +76,11 @@ An open-source Experience Management (XM) database service. Hub is a headless AP 1. Clone the repository and navigate to the project directory 2. Set up the development environment: - ```bash make dev-setup ``` This will: - - Start PostgreSQL container - Install Go dependencies - Install development tools (gofumpt, golangci-lint) @@ -91,7 +88,6 @@ This will: - Install git hooks for code quality 3. Start the API server: - ```bash make run ``` @@ -103,37 +99,31 @@ The server will start on `http://localhost:8080` If you prefer not to use Make: 1. Start Docker containers: - ```bash docker compose up -d ``` 2. Copy environment variables: - ```bash cp .env.example .env ``` 3. Initialize database schema: - ```bash make init-db ``` 4. Set your API key: - ```bash export API_KEY=your-secret-key-here ``` Or add it to your `.env` file: - ``` API_KEY=your-secret-key-here ``` 5. Start the server: - ```bash go run ./cmd/api/main.go ``` @@ -141,14 +131,12 @@ go run ./cmd/api/main.go ## API Endpoints ### Health Check - - `GET /health` - Health check endpoint - `GET /swagger/` - Swagger API documentation ### Feedback Records #### Create Feedback Record - ```bash POST /v1/feedback-records Authorization: Bearer @@ -169,21 +157,18 @@ Content-Type: application/json ``` #### Get Feedback Record by ID - ```bash GET /v1/feedback-records/{id} Authorization: Bearer ``` #### List Feedback Records - ```bash GET /v1/feedback-records?source_type=survey&limit=50&offset=0 Authorization: Bearer ``` Query parameters: - - `source_type` - Filter by source type - `source_id` - Filter by source ID - `field_id` - Filter by field ID @@ -192,7 +177,6 @@ Query parameters: - `offset` - Pagination offset #### Update Feedback Record - ```bash PATCH /v1/feedback-records/{id} Authorization: Bearer @@ -205,7 +189,6 @@ Content-Type: application/json ``` #### Delete Feedback Record - ```bash DELETE /v1/feedback-records/{id} Authorization: Bearer @@ -244,7 +227,6 @@ make install-hooks ``` The pre-commit hook automatically: - 1. Checks for potential secrets in staged changes (warning only) 2. Formats staged Go files with `gofumpt` 3. Runs the linter (`golangci-lint`) @@ -254,7 +236,6 @@ If formatting or linting fails, the commit is blocked. **Note:** Git hooks are automatically installed when you run `make dev-setup`. To bypass hooks temporarily (use sparingly): - ```bash git commit --no-verify -m "WIP: work in progress" ``` @@ -264,7 +245,6 @@ git commit --no-verify -m "WIP: work in progress" The database schema is stored in the `sql/` directory. To initialize the database schema: - ```bash make init-db ``` @@ -276,13 +256,11 @@ This will execute `sql/001_initial_schema.sql` using `psql`. Make sure you have Authentication is done via a single API key set in the `API_KEY` environment variable. The API key is validated against this environment variable for all protected endpoints. Set your API key: - ```bash export API_KEY=your-secret-key-here ``` Or add it to your `.env` file: - ``` API_KEY=your-secret-key-here ``` @@ -304,7 +282,6 @@ See [.env.example](.env.example) for all available configuration options: ## Example Requests ### Create a text response - ```bash curl -X POST http://localhost:8080/v1/feedback-records \ -H "Authorization: Bearer " \ @@ -318,14 +295,12 @@ curl -X POST http://localhost:8080/v1/feedback-records \ ``` ### Get all feedback records - ```bash curl http://localhost:8080/v1/feedback-records \ -H "Authorization: Bearer " ``` ### Update a feedback record - ```bash curl -X PATCH http://localhost:8080/v1/feedback-records/{id} \ -H "Authorization: Bearer " \ @@ -336,7 +311,6 @@ curl -X PATCH http://localhost:8080/v1/feedback-records/{id} \ ``` ### Delete a feedback record - ```bash curl -X DELETE http://localhost:8080/v1/feedback-records/{id} \ -H "Authorization: Bearer " @@ -352,7 +326,6 @@ The application follows a clean architecture pattern: 4. **Models** - Define domain entities and DTOs This separation allows for: - - Easy testing and mocking - Clear separation of concerns - Simple maintenance and refactoring @@ -380,4 +353,4 @@ Apache 2.0 ## Related Documentation -- [API Documentation](http://localhost:8080/swagger/) - Interactive Swagger documentation (when server is running) +- [API Documentation](http://localhost:8080/swagger/) - Interactive Swagger documentation (when server is running) \ No newline at end of file