···751751 - `/home/git/log`
752752 - `/home/git/guard.log`
753753754754+# Self-hosting an appview
755755+756756+The appview is the web frontend and indexer for a Tangled
757757+instance. It ingests events from the AT Protocol firehose,
758758+indexes repositories and social data, and serves the web UI.
759759+Running your own appview lets you host a fully independent
760760+Tangled instance scoped to your own users, knots, and
761761+content.
762762+763763+## NixOS
764764+765765+Refer to the [appview
766766+module](https://tangled.org/tangled.org/core/blob/master/nix/modules/appview.nix)
767767+for the full list of options. A minimal NixOS configuration:
768768+769769+```nix
770770+services.tangled.appview = {
771771+ enable = true;
772772+ package = pkgs.appview;
773773+774774+ appviewHost = "git.example.com";
775775+ appviewName = "My Forge";
776776+ dbPath = "/var/lib/appview/appview.db";
777777+778778+ environmentFile = "/etc/appview.env";
779779+ # secrets in the environment file:
780780+ # TANGLED_COOKIE_SECRET
781781+ # TANGLED_OAUTH_CLIENT_SECRET
782782+ # TANGLED_OAUTH_CLIENT_KID
783783+};
784784+```
785785+786786+## Project mode
787787+788788+Project mode collapses the URL namespace so the appview
789789+behaves like a single-project forge rather than a
790790+multi-user platform. When enabled:
791791+792792+- `/{repo}` is served as `/{user}/{repo}`, where `{user}`
793793+ is a configured project user (a handle or DID).
794794+- The home page and global timeline are disabled; `/`
795795+ serves the project user's profile page instead.
796796+- The `/signup` route and all signup CTAs are hidden.
797797+- The sites (static site hosting) settings are hidden.
798798+799799+Enable it in the NixOS module:
800800+801801+```nix
802802+services.tangled.appview = {
803803+ enable = true;
804804+ package = pkgs.appview;
805805+806806+ project = {
807807+ enable = true;
808808+ user = "anirudh.fi"; # handle or DID of the project owner
809809+ };
810810+};
811811+```
812812+813813+Or via environment variables:
814814+815815+```bash
816816+TANGLED_PROJECT_MODE=true
817817+TANGLED_PROJECT_USER=anirudh.fi
818818+```
819819+820820+All other routes (settings, notifications, login, search,
821821+issues, pull requests, pipelines) continue to work as
822822+normal. Existing `/{user}/{repo}` URLs remain valid and
823823+need not be updated.
824824+825825+## Caveats
826826+827827+The appview builds its index by consuming the AT Protocol
828828+Jetstream firehose from the point it starts. It does **not**
829829+backfill historical data on first run, so repositories,
830830+users, and social data that existed before your instance
831831+started will not appear until they produce new events on the
832832+network (a push, a new issue, a profile edit, etc.).
833833+834834+There is currently no first-party tool to perform a full
835835+network backfill.
836836+837837+## Custom templates
838838+839839+The appview UI is built from HTML templates embedded in the
840840+binary at build time. You can override individual templates
841841+by providing a custom templates directory whose structure
842842+mirrors `appview/pages/templates/`. Files present in the
843843+custom directory replace the defaults; everything else
844844+falls back to the originals.
845845+846846+Point to your custom directory in the NixOS module:
847847+848848+```nix
849849+services.tangled.appview = {
850850+ enable = true;
851851+ package = pkgs.appview;
852852+853853+ project = {
854854+ enable = true;
855855+ user = "anirudh.fi";
856856+ templatesDir = ./custom-templates;
857857+ };
858858+};
859859+```
860860+861861+Your `custom-templates/` directory only needs to contain
862862+the files you want to override. For example, to replace the
863863+footer:
864864+865865+```
866866+custom-templates/
867867+ layouts/
868868+ fragments/
869869+ footerMinimal.html
870870+```
871871+872872+For local development, copy your custom templates on top of
873873+the defaults and run with `TANGLED_DEV=true` for live
874874+reload:
875875+876876+```bash
877877+cp -rfv custom-templates/* appview/pages/templates/
878878+TANGLED_DEV=true nix run .#watch-appview
879879+```
880880+881881+## Custom CSS
882882+883883+For small CSS additions, override `layouts/base.html` in
884884+your custom templates directory and add a `<style>` block
885885+after the stylesheet link:
886886+887887+```html
888888+<link rel="stylesheet" href="/static/tw.css?{{ cssContentHash }}" type="text/css" />
889889+<style>
890890+ /* your overrides */
891891+ :root { --brand: #6366f1; }
892892+</style>
893893+```
894894+895895+For full Tailwind customisation, override the static files
896896+Nix package to run Tailwind with your own `input.css`:
897897+898898+```nix
899899+services.tangled.appview = {
900900+ package = pkgs.appview.override {
901901+ appview-static-files = pkgs.appview-static-files.overrideAttrs (old: {
902902+ buildCommand = old.buildCommand + ''
903903+ cat ${./extra.css} >> $out/tw.css
904904+ '';
905905+ });
906906+ };
907907+};
908908+```
909909+754910# Spindles
755911756912## Pipelines