Skip to content

Quickstart

In five minutes you’ll have a Federation Core running locally, registered as a peer, with one trust event in the database and one trust score returned by the API. Pick curl or Go below — both walk through the same three calls.

  • Docker + Docker Compose for PostgreSQL and Redis.
  • Go 1.22+ if you want to build the backend from source (you can also docker compose --profile app up and skip the Go install).
  • A terminal. That’s it.
  1. Clone the repo and start Postgres + Redis:

    Terminal window
    git clone https://github.com/JamilEssifiDEV/federation-core
    cd federation-core
    cp .env.example .env
    make docker-up
  2. Build and start the Federation Core:

    Terminal window
    make build
    ./bin/federation-core

    You should see FedShield Federation Core starting addr=:8080 and a few INFO lines for the database connection. Leave it running in this terminal.

  3. Verify it’s up:

    Terminal window
    curl http://localhost:8080/api/v1/health
    # {"status":"ok","service":"federation-core"}

Every game server is a peer. Peers get an API key on first registration and must include it (header X-Peer-API-Key) on every subsequent request.

Terminal window
curl -X POST http://localhost:8080/api/v1/peers/register \
-H "Content-Type: application/json" \
-d '{
"peer_name": "My Game Server",
"game_ids": ["my-game"],
"contact_email": "ops@mystudio.example"
}'

Save peer_id and api_key from the response. You’ll need both:

{
"peer_id": "ad2e1e0f-7279-4013-9a0c-3a8a4ecde248",
"api_key": "sk_...",
"status": "active"
}

Events are descriptive (something happened) rather than directive (ban this player). The Federation Core decides what the aggregated score means; your server keeps full control of enforcement.

Terminal window
curl -X POST http://localhost:8080/api/v1/events \
-H "Content-Type: application/json" \
-H "X-Peer-API-Key: sk_..." \
-d '{
"schema_version": "1.0.0",
"event_id": "evt-001",
"event_type": "report_cheating",
"peer_id": "ad2e1e0f-7279-4013-9a0c-3a8a4ecde248",
"player_id": "player-alice-123",
"game_id": "my-game",
"severity": 0.85,
"timestamp": "2026-06-07T18:00:00Z"
}'

A single event won’t move a clean player’s score much — the Bayesian prior keeps newcomers near neutral until enough evidence accumulates. Try submitting a few more events to see the score shift.

Terminal window
curl http://localhost:8080/api/v1/players/player-alice-123/trust-score
{
"player_id": "player-alice-123",
"score": 47.8,
"confidence": 0.05,
"verdict": "neutral",
"event_count": 1
}

That’s it. You have a working federation peer. Your game server can now query trust scores for any player ID it sees and apply whatever policy makes sense (allow, monitor, kick, ban).