Packages

gamend_web

1.1.1439
1.1.1439 1.1.1438 1.1.1437 1.1.1436 1.1.1435 1.1.1431 1.1.1430 1.1.1429 1.1.1425 1.1.1424 1.1.1418 1.1.1417 1.1.1416 1.1.1415 1.1.1414 1.1.1413 1.1.1412 1.1.1410 1.1.1409 1.1.1408 1.1.1407 1.1.1406 1.1.1405 1.1.1404 1.1.1403 1.1.1402 1.1.1397 1.1.1396 1.1.1393 1.1.1392 1.1.1391 1.1.1390 1.1.1389 1.1.1388 1.1.1387 1.1.1380 1.1.1379 1.1.1378 1.1.1377 1.1.1376 1.1.1375 1.1.1374 1.1.1373 1.1.1372 1.1.1371 1.1.1370 1.1.1369 1.1.1368 1.1.1367 1.1.1366 1.1.1365 1.1.1364 1.1.1363 1.1.1362 1.1.1361 1.1.1360 1.1.1359 1.1.1358 1.1.1357 1.1.1356 1.1.1352 1.1.1351 1.1.1348 1.1.1347 1.1.1346 1.1.1345 1.1.1344 1.1.1343 1.1.1342 1.1.1341 1.1.1340 1.1.1339 1.1.1338 1.1.1337 1.1.1336 1.1.1335 1.1.1334 1.1.1333 1.1.1332 1.1.1331 1.1.1330 1.1.1328 1.1.1327 1.1.1325 1.1.1324 1.1.1323 1.1.1322 1.1.1321 1.1.1320 1.1.1319 1.1.1318 1.1.1317 1.1.1316 1.1.1315 1.1.1314 1.1.1313 1.1.1312 1.1.1311 1.1.1310 1.1.1309 1.1.1308 1.1.1307 1.1.1304 1.1.1302 1.0.1301 1.0.1300 1.0.1299 1.0.1298 1.0.1297 1.0.1296 1.0.1295 1.0.1294 1.0.1290 1.0.1289 1.0.1288 1.0.1287 1.0.1286 1.0.1285 1.0.1283 1.0.1281 1.0.1280 1.0.1279 1.0.1278 1.0.1277 1.0.1276 1.0.1275 1.0.1274 1.0.1273 1.0.1270 1.0.1269 1.0.1267 1.0.1266 1.0.1265 1.0.1263 1.0.1262 1.0.1261 1.0.1260 1.0.1259 1.0.1258 1.0.1257 1.0.1256 1.0.1255 1.0.1254 1.0.1251 1.0.1250 1.0.1249 1.0.1247 1.0.1245 1.0.1240 1.0.1239 1.0.1238 1.0.1236 1.0.1235 1.0.1233 1.0.1230 1.0.1229 1.0.1228 1.0.1227 1.0.1226 1.0.1225 1.0.1224 1.0.1223 1.0.1222 1.0.1221 1.0.1220 1.0.1219 1.0.1217 1.0.1216 1.0.1215

Web interface for Gamend, built with Phoenix Framework. Provides APIs, authentication, real-time features, and payments.

Current section

Files

Jump to
gamend_web README.md
Raw

README.md

# Gamend Web

The web layer of [Gamend](https://gamend.org) — the REST API,
WebSocket channels, player-facing LiveViews and the `/admin` console.
`gamend_core` holds the domain logic this sits on.

This is the package a **host app** consumes. Core is what a *plugin* calls to
add game rules; web is what your own Phoenix app mounts to get a server. The
two audiences barely overlap.

## What a host app uses

| Module | Role |
|---|---|
| `GamendWeb.Router.Shared` | The route macros. Import it and mount the groups you want - leaving one out is how you ship a smaller API surface. Start here. |
| `GamendWeb` | The `use GamendWeb, :controller` / `:live_view` / `:html` macros, so host modules get the same imports and layouts. |
| `GamendWeb.UserAuth` | Session plugs and the `on_mount` hooks behind authenticated and admin routes. |
| `GamendWeb.Layouts` | The app and root layouts, including navigation driven by your theme config. |
| `GamendWeb.CoreComponents` | The shared component set - `<.input>`, `<.timestamp>`, `<.pagination>`, `<.icon>` and friends. |
| `GamendWeb.Endpoint` | Sockets, static serving and the plug stack, if you do not supply your own. |
| `GamendWeb.OnMount.*`, `GamendWeb.Plugs.*` | Locale, theme, colour mode, connection tracking, feature gates and rate limiting. |

Everything else — controllers, channels, admin LiveViews — is mounted by those
route macros rather than called directly.

## Installation

Add `gamend_web` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:gamend_web, "~> 1.1"}
  ]
end
```

The package includes `priv/gettext` (translations), `priv/static/fonts` (Inter woff2), `priv/static/images` (logos/banners), `priv/static/.well-known` (app association examples), `robots.txt`, and `favicon.ico`. Compiled JS/CSS (`priv/static/assets/`) and game assets (`priv/static/game/`) are excluded — host apps compile their own assets.

## Icons when consuming from Hex

`gamend_web` templates use `<.icon name="hero-..." />`, which renders CSS classes like `hero-x-mark`.

When publishing to Hex, CI strips the GitHub `:heroicons` dependency from the package metadata (Hex only accepts Hex deps), so host apps should provide icon generation themselves.

Recommended setup in your host app:

1. Add Heroicons to host deps:

```elixir
{:heroicons,
 github: "tailwindlabs/heroicons",
 tag: "v2.2.0",
 sparse: "optimized",
 app: false,
 compile: false,
 depth: 1}
```

2. Import core's stylesheet, which loads the Heroicons plugin (and everything else core's pages need). Add the `gamend_assets` compiler to your `mix.exs`, which writes `assets/vendor/gamend/` on every compile (put it in `.gitignore`):

```elixir
compilers: Mix.compilers() ++ [:gamend_assets]
```

```css
/* assets/css/app.css */
@import "../vendor/gamend/gamend.css";
@source "../css";
@source "../../lib";
@plugin "../vendor/gamend/daisyui" { themes: false; }
@plugin "../vendor/gamend/daisyui-theme" { name: "light"; default: true; /* your colours */ }
```

The pointers find `apps/gamend_web` in a sibling `gamend` checkout or `deps/gamend_web`, and the plugin finds `deps/heroicons/optimized` in the project Tailwind runs in. Gamend's own server imports `apps/gamend_web/assets/css/gamend.css` directly.

3. Nothing of core's goes into your own stylesheet: a Gamend release brings what it adds. `priv/docs/10-setup/50-theme.md` ("Core's stylesheet") has the details.

If you want your own icon set, keep compatibility by either:
- providing CSS for the same `hero-*` class names used by templates, or
- replacing icon names/component usage in your fork.