Skip to content
المشاريع

حول

Gami.Fied is a gamification engine that is built to be self-hosted. Turn any app into a game while having a complete control of your data!

الألعاب والمحاكاة

كيف تُقاس هذه الأرقام

46 نجمة4 التفرعات +1 خلال 24 ساعة

النمو المقاس للنجوم

خلال 24 ساعة
+١
خلال 7 أيام
+٥
خلال 15 يومًا
+٦
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

Gami.Fied

The self-hosted, open-source gamification engine.

Add XP, levels, streaks, badges, leaderboards and rewards to any app,
and keep your players' data on your own server.

CI Release License npm

Website · Docs · Playground · Product tour · Discussions


The Gami.Fied dashboard: a weekly leaderboard for a demo language app

Why Gami.Fied

  • 🏠 Your data stays yours. It runs on your servers, next to your app. No player data goes to anyone else.
  • 💸 No per-user pricing. However many players you have, the only cost is your own hosting.
  • 🔓 Open source. The server is AGPL-3.0. The SDK, React components and web components are MIT, so they fit in closed-source apps.
  • 🐳 One command to run. Prebuilt images for amd64 and arm64, and docker compose up.

How it works

flowchart LR
    A["Your app"] -- "events<br>(lesson_completed)" --> B["Gami.Fied"]
    B -- "rules, streaks,<br>challenges" --> C["XP, levels, badges,<br>gems, leagues"]
    C -- "SDK, React,<br>web components" --> D["Your players"]
    B -- "signed webhooks,<br>Slack, email, push" --> E["Your other systems"]

Your app sends what happened. Rules you set up in the dashboard decide what it's worth, and the worker pays it out in the background. Your players see their progress through the ready-made components, or your own UI on the API.


Quick start

Prebuilt images are published for linux/amd64 and linux/arm64, so there is nothing to build.

curl -LO https://github.com/gami-fied/gami.fied/releases/latest/download/docker-compose.yml
curl -LO https://github.com/gami-fied/gami.fied/releases/latest/download/env.example
cp env.example .env

Fill in the five secrets in .env (the install guide lists them, and openssl rand -hex 32 makes each one), then run docker compose up -d. The dashboard is at http://localhost:3000, where you create an account and follow the quick start to your first XP.

The ports are published on 127.0.0.1 only. To reach the dashboard from another machine, put it behind a reverse proxy with TLS, or set BIND_ADDRESS=0.0.0.0 in .env for a private network. See Install with Docker Compose, the production checklist and Upgrading.


Use it from your app

[!TIP] Want to see a whole app first? The habit tracker example is about 250 lines: an Express server and one page, with XP, coins, a streak, badges, a challenge, a mystery box, titles and a leaderboard. It starts with Gami.Fied in one docker compose up.

From your server, send events and read progress:

npm install @gami.fied/sdk
import { Gami } from '@gami.fied/sdk';

const gami = new Gami({ baseUrl: 'http://localhost:3001', apiKey: 'gami_live_your_project_api_key' });

// Send what happened. Rules, streaks and challenges run in the background.
await gami.events.track({ userId: 'user_123', type: 'lesson_completed', properties: { score: 100 } });

// Read the player's progress. This needs a key with the levels:read scope.
const progress = await gami.levels.getUserProgress({ userId: 'user_123' });
console.log(`Level ${progress.level.number}, ${progress.totalXp} XP`);

In the player's browser, never use an API key. Your server makes a short-lived token for one player, and the page uses that:

// On your server
const { token } = await gami.endUserTokens.create({ userId: 'user_123' });

Making a token needs a key with the users:write scope. The key the dashboard's quick start makes only sends events, so create one under API Keys. A token only reads unless you ask for access: 'write', which a player needs to buy a reward, open a box or add a friend.

With React Without React
import { GamiProvider, LevelProgress, Leaderboard, ToastHost } from '@gami.fied/react';
import '@gami.fied/react/styles.css';

<GamiProvider endUserToken={token} baseUrl="https://gami.example.com">
  <LevelProgress />
  <Leaderboard period="weekly" />
  <ToastHost />
</GamiProvider>;
<script src="https://unpkg.com/@gami.fied/elements/dist/gami-elements.js"></script>
<script>
  GamiElements.configure({ baseUrl: 'https://gami.example.com', token });
</script>

<gami-level-progress></gami-level-progress>
<gami-leaderboard period="weekly"></gami-leaderboard>

See the SDK guide, React components and web components, or every component live in the component gallery.


What it does

Area What you get
⚡ Rules Turn events into XP, badges and currency, with conditions, totals over time, drafts, a test against past events, and a trace of why a rule fired.
📈 Progression Levels, achievements with tiers, daily and weekly streaks with freezes, challenges with steps, journeys that chain them, and a season pass.
🪙 Economy Currencies and wallets with expiry, a reward store with stock and codes, mystery boxes with published odds, cosmetics, and boosts and limits against farming.
🏆 Competition Leaderboards by day, week and month with prizes for the top places, boards for segments, and leagues with promotion and relegation.
🤝 Community Teams and shared goals, friends, kudos, an activity feed, share cards and invite codes.
🔔 Reaching players An in-app inbox, email, push for iPhone, Android and browsers, live updates, and translations into each player's language.
🧩 Integrations A stable /v1 API, a TypeScript SDK, React and web components, signed webhooks, Slack, Teams and Discord, and connectors for Segment, RudderStack, Stripe and GitHub.
🛡️ Administration Roles, audit logs, staging that promotes to production, feature controls per organization, scoped API keys, backups, export and import, and erasure for privacy requests.

Where it is weaker than the alternatives is on the comparison page.

📸 See the dashboard
Progression Economy
Achievements page Reward store page
Competition Community
Leaderboard page A player's community tab
Integrations Administration
A player seen through the React components Platform admin features page

Documentation

Everything is at gami.fied.cc/docs, with search, and in the docs/ folder.

🚀 Start 🛠️ Build 🐳 Run
Getting started Gamification mechanics Deployment and production
Install with Docker Economy and store Platform administration
Quick starts: REST, Node.js, Python, Next.js, React, and an example app Boxes, passes, teams and journeys Backups and upgrading
API reference Notifications and webhooks Architecture
TypeScript SDK Translations Security

What's new is in the changelog.


Contributing

Bug reports, ideas and pull requests are welcome. CONTRIBUTING.md covers setting up, the checks to run and how contributions are licensed. Please follow the code of conduct.

To work on it locally, you need Node.js 22, pnpm 11 and Docker:

pnpm install && cp .env.example .env
pnpm infra:up && pnpm db:migrate:dev
pnpm dev
Project layout
gami-fied/
├── apps/
│   ├── api/           # Fastify API on port 3001
│   ├── worker/        # Background worker for rules and delivery
│   ├── dashboard/     # Next.js dashboard on port 3000
│   └── website/       # gami.fied.cc: marketing pages, docs and playground
├── packages/
│   ├── sdk/           # TypeScript client, on npm as @gami.fied/sdk (MIT)
│   ├── react/         # React components, on npm as @gami.fied/react (MIT)
│   ├── elements/      # The same components as HTML elements, @gami.fied/elements (MIT)
│   ├── database/      # PostgreSQL schema, Drizzle ORM, migrations and auth
│   ├── rules/         # Rule evaluation
│   ├── rewards/       # XP, badges, wallets and prizes
│   ├── progression/   # Levels and streaks
│   ├── challenges/    # Challenge progress
│   ├── leaderboards/  # Rankings, segments and leagues
│   ├── notifications/ # In-app and email notifications
│   ├── webhooks/      # Webhook delivery and signing
│   ├── integrations/  # Slack, Teams, Discord, HTTP and push
│   ├── queue/         # Shared queue definitions
│   ├── ui/            # Interface pieces shared by the dashboard and the website
│   ├── types/         # Shared TypeScript types
│   └── config/        # Shared configuration
├── deploy/            # One-click deploy files and the status page
└── docs/              # Documentation, also served at gami.fied.cc/docs

License

The server, worker and dashboard are licensed under the GNU AGPL v3.0. The SDK, the React components and the web components (packages/sdk, packages/react and packages/elements) are licensed under the MIT License, so you can use them in closed-source apps.


If Gami.Fied is useful to you, a ⭐ on GitHub helps other people find it.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…