Packages
gamend_web
1.0.1255
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
Current section
Files
gamend_web
README.md
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.0.0"}
]
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. Ensure your Tailwind CSS includes the Heroicons plugin. If you copy the host shell from this repo, keep the small resolver wrappers in `assets/vendor/` and reference:
```css
@plugin "../vendor/heroicons";
```
That wrapper resolves the shared plugin from either `apps/gamend_web` or `deps/gamend_web`.
If you wire things up manually, the shared plugin lives in `apps/gamend_web/assets/vendor/heroicons.js`.
For this monorepo layout (host app at repo root):
```css
@plugin "../../apps/gamend_web/assets/vendor/heroicons";
```
For starter/fork layouts where `gamend_web` is installed as a dependency:
```css
@plugin "../../deps/gamend_web/assets/vendor/heroicons";
```
3. If you extract this into a standalone host app, keep either the shared asset tree with the reusable web package or the host-side resolver wrappers so the plugin can still find `deps/heroicons/optimized`.
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.