- Elixir 92.9%
- CSS 4.4%
- Rust 1.6%
- HTML 0.6%
- JavaScript 0.3%
- Other 0.1%
Tracker
To start your Phoenix server:
- Run
mix setupto install and setup dependencies - Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Now you can visit localhost:6950 from your browser.
Ready to run in production? Please check our deployment guides.
Service accounts and API tokens
Tracker supports long-lived API bearer tokens for non-human callers. Service accounts are users with no GitHub identity; an admin creates one, then issues a token for it.
Create a service account
mix tracker.service_account.create \
--actor <admin-github-username> \
--name <account-name> \
--roles <comma-separated-roles>
--actor is the github_username of an existing admin user. --name becomes
service:<name> as the account's github_username. --roles is the
comma-separated role list (e.g. user,maintainer); the token will inherit
exactly these roles.
Issue a token for the service account
mix tracker.api_token.issue \
--actor <admin-github-username> \
--user service:<account-name> \
--label <human-readable-label> \
--expires-in <seconds>
--user accepts either a UUID or a github_username (including the
service:* form). --label and --expires-in are optional (default
lifetime is one year). The token is printed to stdout once — it cannot
be retrieved later, only revoked.
Issued tokens are prefixed with trk_ so they're easy to grep for in
logs and recognisable by secret scanners.
Revoke a token
mix tracker.api_token.revoke \
--actor <admin-github-username> \
--jti <jti>
The JTI is printed alongside the JWT when the token is issued.
Self-service for human users
Logged-in users can issue and revoke their own API tokens at
/account/tokens. Service account
management is admin-only and only available via the mix tasks above.
Using a token
GET /your/api/endpoint
Authorization: Bearer trk_<jwt>
Send the full prefixed token in the Authorization header. Pipe a route
through TrackerWeb.Plug.BearerAuth to authenticate and
TrackerWeb.Plug.RequireRole, role: :some_role to gate by role.
Learn more
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix