Skip to main content

Getting Started

Prerequisites

  • Java 17+
  • PostgreSQL 15+
  • Redis 7+
  • MinIO or S3-compatible storage
  • Firebase project or Keycloak server (for authentication)

Configuration

The service is configured via application.yml. Key configurations:

Database

spring:
datasource:
url: jdbc:postgresql://localhost:5432/wiki_db
username: your_username
password: your_password

Redis

spring:
data:
redis:
host: localhost
port: 6379

Authentication Provider

Toggle between Firebase and Keycloak:

auth:
provider: firebase # or 'keycloak'

Storage (MinIO/RustFS)

app:
storage:
rustfs:
endpoint: http://localhost:9000
access-key: your-access-key
secret-key: your-secret-key
bucket: wiki-attachments

CORS

app:
cors:
allowed-origins: http://localhost:3000,http://localhost:5173

Running the Service

# Build
mvn clean package -DskipTests

# Run
java -jar target/util4dev-wiki-service.jar

The service starts on port 8080 by default. All endpoints are available under /api/v1.

Making Your First Request

1. Authenticate

Obtain a JWT token from your authentication provider (Firebase or Keycloak).

2. Create a Workspace

curl -X POST /api/v1/workspaces \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Workspace",
"description": "A test workspace"
}'

3. Create a Document

curl -X POST /api/v1/documents \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Hello World",
"workspaceId": "WORKSPACE_ID_FROM_STEP_2"
}'

Response Format

All API responses follow a consistent wrapper format:

{
"success": true,
"data": { ... },
"message": "Optional message"
}

Error responses:

{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": { ... }
}
}