Anahita Web

Customising

Making an installation your own: its name, look, languages and legal documents.

The three are the server's settings, in anahita-services' config.env, which the app reads from NodeInfo when it loads: a site changes them with no code and no rebuild.

Shown Set by, on the server Without it
The name, on the home page and in the menu ANAHITA_INSTANCE_NAME, or SITE_NAME REACT_APP_NAME
The description, on the home page ANAHITA_INSTANCE_DESCRIPTION REACT_APP_DESCRIPTION
The logo, on the home page and in the menu SITE_LOGO_URL, which is also the logo of the sign-in pages and of every email: a full address, to a PNG The theme's media/logo

REACT_APP_NAME and REACT_APP_DESCRIPTION are the build's own: shown until the server has answered, and used in the page title and meta tags in index.html. See Configuration.

The icons are files in the build, at fixed names, which a site's own build replaces with its own after yarn build (banu.io's web/build.sh does):

File Shown
favicon.ico In a browser's tab, and by browsers that read nothing else
icon-32.png In a browser's tab
icon-180.png On an iPhone's or an iPad's home screen
icon-192.png, icon-512.png On an Android home screen, and for the installed app, named in manifest.json
manifest.json The installed app's name and icons

Themes

A theme is a directory under src/assets/. The app uses the one named by REACT_APP_ASSETS, or src/assets/default when it is unset.

To make your own, copy the default and point the app at the copy:

cp -r src/assets/default src/assets/mysite
REACT_APP_ASSETS=mysite

A theme exports, from its index.js:

Part Directory What it controls
logo media/logo The logo in the menu and on the home page, when the server gives none (SITE_LOGO_URL): color for light mode and white for dark, which may be the same file. The default theme's is Anahita's mark, an SVG for both
opengraph media/og An image for link previews. Exported, but nothing in the app uses it yet: the picture a shared link shows is public/statics/media/ogimage.jpg (below)
Home home/ The home page signed-out visitors see. The default's, under the name, description and ways in, shows a theme's pages/home.md if it has one, with an icon above Anahita's own parts
navs navs/ The left menu
styles styles/ The Material UI theme: fonts and colours, for light and dark mode
pages pages/ Markdown pages for the site, such as contact.md and join.md at /pages/:alias, and home.md, the home page's own words

The picture of a shared link is public/statics/media/ogimage.jpg, 1200 by 630 pixels: Anahita's logo, its name and "Connect your people, here and everywhere." Every page without a picture of its own shows it, in index.html and from web-shell. A site with its own puts its picture there in its build, at the same name.

A theme is compiled into the bundle, so changing one means rebuilding. Keep the parts' names and exports as they are in the default theme; the app imports them by those names.

A home page of your own

The home page somebody not signed in sees has the site's logo, name and description, the ways in, and how many are on it; then Anahita's own parts, what can be done here and what may be looked at. To say what your site is for in its own words as well, give your theme a pages/home.md, and name it in pages/index.js:

import contact from './contact.md';
import join from './join.md';
import home from './home.md';

export default { contact, join, home };

It is shown with an icon, as Anahita's own parts are, between the ways in and those parts, which stay. A line of --- in it divides it in two: what comes after is a narrow column of its own beside the rest, three parts to one, for a few lines such as where to find you. A list there has no bullets, and a line that links to a handle is a row with the network's icon:

- **Fediverse** [@ana@example.org](/@ana)
- **Bluesky** [@example.org](https://bsky.app/profile/example.org)
``` A theme can take everything else from the default one and change only what is
its own:

```js
import base from '../default';
import logo from './media/logo';
import pages from './pages';

export default { ...base, logo, pages };

For a home page that is altogether different, a theme's Home can be a component of its own: fork the repository and change it as you like.

styles/index.js exports global({ colors, prefersDarkMode }), which returns Material UI theme options (opens in a new tab) for createTheme. prefersDarkMode follows the visitor's system setting, so set palette.mode from it ('dark' or 'light') and choose colours for each. Options you return are applied over the app's defaults; to change how a component looks everywhere, add it under components, for example components: { MuiButton: { defaultProps: { disableElevation: true } } }.

The theme's colours are everybody's until they choose others: somebody signed in can pick one of fifteen palettes under Colours in the left menu, kept in their browser, and Reset goes back to the theme's. A palette chosen replaces the theme's primary and secondary only (Anahita's colours (opens in a new tab)).

Languages

The app is in seven languages. Five are bases, with every string; two are layers, with only the strings that differ from their base:

Language Directory Holds Falls back to
English (Canada), en-CA src/languages/en-CA/ Every string —
English (United States), en-US src/languages/en-US/ The strings that differ: canceled, license, gray en-CA
French (France), fr-FR src/languages/fr-FR/ Every string en-CA
German (Germany), de-DE src/languages/de-DE/ Every string en-CA
Spanish (Latin America), es-419 src/languages/es-419/ Every string en-CA
Portuguese (Brazil), pt-BR src/languages/pt-BR/ Every string en-CA
French (Quebec), fr-CA src/languages/fr-CA/ The strings that differ: courriel for email, mot-clic for hashtag fr-FR, then en-CA

Each file in a directory is a namespace of strings, and index.js gathers them. A string a language does not have is read from the one it falls back to.

Who translated them. The translations, from the Canadian English the app is written in, are made by Claude, an AI model made by Anthropic, at the project's request. Nobody who speaks French, German, Spanish or Portuguese, or any language to come, as their first language has read them yet. They speak to the reader as Mastodon does in each language: du in German, tú in Spanish, você in Portuguese, and vous in French. If something reads wrong to you, please say so: a correction to a string in src/languages/ is welcome.

Which language a visitor sees is chosen from their browser's languages, in their order, by src/languages/choose.js:

The browser asks for Shown
en-US en-US
Any other English: en-CA, en-GB, en-AU, en en-CA
fr-CA fr-CA
Any other French: fr-FR, fr-BE, fr-CH, fr fr-FR
Any German: de-DE, de-AT, de-CH, de de-DE
Any Spanish: es-MX, es-ES, es-AR, es es-419
Any Portuguese: pt-BR, pt-PT, pt pt-BR
None of these The site's default, REACT_APP_LANGUAGE; en-CA when unset

So somebody whose browser prefers Japanese, then French, sees French. It is chosen again on each visit. There is no choice of language in a person's settings: the operating system is the source of truth, and the browser passes on its languages. Dates, times and numbers are written in the language shown, and the page's lang follows it.

The space before ?, ! and ; is written once in the French strings, as an ordinary space, and made as each string is shown (src/languages/frenchSpacing.js): a narrow no-break space in fr-FR, so the mark never starts a line, and none in fr-CA.

To add a language:

  1. Copy src/languages/en-CA to a directory named for the new locale, for example de-DE, and translate its files. Keep every key.
  2. Import it in src/languages/index.js and add it to resources.
  3. Add it to LANGUAGES and FALLBACK in src/languages/choose.js, and say in match which of the browser's languages it is shown for.

To add a layer, such as fr-BE, make a directory with only the strings that differ, and give it its base in FALLBACK. The tests check that every base has every string the Canadian English has and no other (add a new base to BASES in choose.js), and that a layer has no key its base does not.

When you add a string to the app, add it to both bases. Add it to a layer only when it differs there. The Canadian English files are the reference.

Terms of Service and Privacy Policy

The documents are Markdown files in src/statics/legal/:

Document File Shown at
Terms of Service tos.md /legal/tos
Privacy Policy privacy.md /legal/privacy

The ones in this repository are boilerplate. Replace them with your own before going live.

Each document has a version in src/statics/legal/index.js. When you change a document, raise its version. Every signed-in person whose accepted version is older is sent to /agreements, and must accept the new one before they can use the app again. This applies to existing members and new ones alike.

  • Versions are compared as numbers, part by part: 1.0.0 to 1.0.1 or 1.1.0 asks everybody again. Going back down asks nobody.
  • Use digits and dots only, up to three parts. The server refuses anything else.
  • The two documents are versioned separately. Raise only the one whose text changed, or people are asked to accept a document they have already accepted.

The site's rules, which everybody ticks one by one on the same page, are not the web app's: they are in the services' site.json, with their version, and changed there (Rules and promises).

Where the code is

What Where
Choosing the theme (REACT_APP_ASSETS) src/assets/index.js
The default theme src/assets/default/
Applying a theme's styles over the app's defaults src/styles/index.js (createTheme)
A theme's Markdown pages, at /pages/:alias src/assets/default/pages/, src/containers/page/index.jsx
The home page, and a theme's home.md in it src/assets/default/home/index.jsx, given the active theme's logo and page by src/containers/home/index.js
Which logo is shown: the server's or the theme's src/utils/siteLogo.js, tested in src/utils/__tests__/siteLogo.test.js; used by src/components/Logo.jsx and the home page
The page title and meta tags src/components/HeaderMeta.jsx
The languages, and the one in use src/languages/index.js, src/languages/en-CA/, en-US/, fr-FR/, fr-CA/
Choosing the language from the browser's src/languages/choose.js, tested in src/languages/__tests__/languages.test.js
The space before ?, ! and ; in French src/languages/frenchSpacing.js
The legal documents and their versions src/statics/legal/
Who must accept a new version src/utils/agreements.js (needsAcceptance), tested in src/utils/__tests__/agreements.test.js
The page that asks for it, at /agreements src/containers/agreements/
The documents as pages, at /legal/tos and /legal/privacy src/containers/legal/index.jsx

From anahitasocial/anahita-web, 2026-11-09.

Written by Claude, reviewed by Rastin Mehr · About this