Routing and processing server for anne wear and anne companion.
Make sure you have PostgreSQL 14 installed and running.
brew install postgres@14
brew services start postgresql@14
Get the CLI tool for migrations (with brew on Linux or macOS, otherwise you can get it from the releases of the official repository):
brew install golang-migrate
Replace <username>
with your PostgreSQL username.
psql -U <username> -tc "SELECT 1 FROM pg_database WHERE datname = 'anne_hub';" | grep -q 1 || psql -U <username> -c "CREATE DATABASE anne_hub;"
migrate create -ext sql -dir db/migrations -seq migration_name
Set the ANNE_HUB_DB
environment variable with your database connection string and run:
migrate -database $ANNE_HUB_DB -path db/migrations up
Create a .env
file in the root directory with the following content:
GROQ_API_KEY=your_groq_api_key
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=your_db_username
DB_NAME=anne_hub
DB_PASSWORD=your_db_password
DB_SSLMODE=disable
Ensure you replace the placeholders with your actual configuration.
For building:
sudo docker build -t anne-hub .
To run:
sudo docker run --env-file .env -p 1323:1323 anne-hub
go mod tidy
go build -o bin/anne-hub
./bin/anne-hub
- Description: Health check endpoint.
- Response:
-
Status:
200 OK
-
Body:
{ "message": "OK" }
-
- Description: Endpoint for testing GitHub Actions.
- Response:
-
Status:
200 OK
-
Body:
{ "message": "GH Actions Test" }
-
- Description: Generates a new UUID.
- Response:
-
Status:
200 OK
-
Body:
{ "uuid": "generated-uuid-string" }
-
users
- Description: Retrieve all users along with their interests and tasks.
- Response:
- Status:
200 OK
- Body: Array of user data with interests and tasks.
- Status:
- Description: Retrieve a user by ID.
id
(path): UUID of the user.
- Response:
- Status:
200 OK
- Body: User details.
- Status:
users
-
Description: Create a new user.
-
Request Body:
{ "username": "string", "first_name": "string", "last_name": "string", "email": "string", "password": "string", "age": integer, "country": "string", "city": "string" }
-
Response:
- Status:
201 Created
- Body: Created user details.
- Status:
- Description: Update an existing user.
id
(path): UUID of the user.
-
Request Body:
{ "username": "string", "first_name": "string", "last_name": "string", "email": "string", "password": "string", "age": integer, "country": "string", "city": "string" }
-
Response:
- Status:
200 OK
- Body: Updated user details.
- Status:
- Description: Delete a user by ID.
id
(path): UUID of the user.
- Response:
-
Status:
200 OK
-
Body:
{ "message": "User deleted successfully." }
-
- Description: Retrieve all tasks.
- Response:
- Status:
200 OK
- Body: Array of tasks.
- Status:
- Description: Retrieve all tasks for a specific user.
id
(path): UUID of the user.
- Response:
- Status:
200 OK
- Body: Array of tasks for the user.
- Status:
-
Description: Create a new task.
-
Request Body:
{ "user_id": "uuid", "title": "string", "description": "string", "due_date": "YYYY-MM-DDTHH:MM:SSZ", // ISO8601 format "completed": boolean }
-
Response:
- Status:
201 Created
- Body: Created task details.
- Status:
- Description: Update an existing task.
id
(path): ID of the task.
-
Request Body:
{ "title": "string", "description": "string", "due_date": "YYYY-MM-DDTHH:MM:SSZ", // ISO8601 format "completed": boolean }
-
Response:
- Status:
200 OK
- Body: Updated task details.
- Status:
- Description: Delete a task by ID.
id
(path): ID of the task.
- Response:
-
Status:
200 OK
-
Body:
{ "message": "Task deleted successfully." }
-
- Description: Retrieve all interests.
- Response:
- Status:
200 OK
- Body: Array of interests.
- Status:
- Description: Retrieve an interest by ID.
id
(path): ID of the interest.
- Response:
- Status:
200 OK
- Body: Interest details.
- Status:
-
Description: Create a new interest.
-
Request Body:
{ "user_id": "uuid", "name": "string", "description": "string", "level": integer, "level_accuracy": "string" }
-
Response:
- Status:
201 Created
- Body: Created interest details.
- Status:
- Description: Update an existing interest.
id
(path): ID of the interest.
-
Request Body:
{ "name": "string", "description": "string", "level": integer, "level_accuracy": "string" }
-
Response:
- Status:
200 OK
- Body: Updated interest details.
- Status:
- Description: Delete an interest by ID.
id
(path): ID of the interest.
- Response:
-
Status:
200 OK
-
Body:
{ "message": "Interest deleted successfully." }
-
-
Description: WebSocket endpoint for handling real-time conversations.
-
Headers:
X-User-ID
: UUID of the user.X-Device-ID
: Device ID.X-Language
: Language code (e.g.,en
,de
).
-
Protocol:
-
Connection: Establish a WebSocket connection to
/ws/conversation
. -
Send Headers: Clients must first send a JSON message containing the required headers.
{ "X-User-ID": "uuid", "X-Device-ID": "device_id", "X-Language": "language_code" }
-
Send Audio Data: After headers are accepted, clients can send binary messages with audio data.
-
End of Stream: To indicate the end of the audio stream, send the text message
"EOS"
.
-
-
Response:
- The server will process the audio data and send back responses as text messages, including any assistant responses and actions.
- Current setup doesn't contain any authentication nor any middleware, due to its
development
status.
This project is licensed under the MIT License. See the
LICENSE
file for details.