Open source ยท MIT
Open infrastructure for better African digital public services.
Build accessible, locally adaptable public-service websites with open-source components, country-specific design systems, auditing tools, image optimisation, and WordPress support.
afrigov gives governments and civic developers a shared foundation for building better digital services, without locking them into a particular framework, platform, or vendor. Every afrigov tool can also be adopted independently.
The toolkit
A site does not have to be built with afrigov to use the others.
-
Design system
Components and country packs in plain CSS. Two link tags to install, with no build step.
-
Audit
Scores any government page for accessibility and weight, and says what to fix first.
npx afrigov-audit https://example.gov.ng/ -
Images
Turns a heavy photograph into light WebP files for each screen size, with the HTML to paste.
npx afrigov-images ./photos --out ./images -
WordPress
A theme and a blocks plugin: build pages from afrigov's components in the WordPress editor, with no code. The theme is on GitHub.
The design system
Version 0.16.0
One country-neutral core. A colour pack per country. Plain CSS that passes WCAG 2.1 AA on every commit and loads on a 2G connection.
With two link tags
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/afrigov@0.16.0/dist/core.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/afrigov@0.16.0/dist/ng.min.css">
Nigeria's pack is shown as the example. Preview a country and this becomes its file.
Or from npm
npm install afrigov
import "afrigov/core.css";
import "afrigov/ng.css";
The script for menus and video is optional: see Get started.
- CSS, gzipped
- 10 KB
- Components
- 49
- Country packs
- 9
- Contrast
- AA in CI
Styles
Colour, type, spacing and language. The rules every component follows, and the tokens behind them.
Components
49 building blocks, each with when to use it, the HTML, and its accessibility notes.
Patterns
Answers to common service questions, like asking for a date of birth or showing errors.
Country packs
National colours, flag, banner strings and country data, one JSON file per country.
Use cases
Four real government websites rebuilt on afrigov, with the real sites' scores beside them.
Community
How to contribute a pack or a translation, and the decisions behind the system.
Why afrigov
Most government websites on the continent are slow, heavy and hard to use with a screen reader. The people who build them care; the trouble is that every ministry and contractor starts from zero. afrigov is the starting point.
-
Lighter pages cost people less
Every megabyte a page downloads is paid for by the person reading it, most often on a prepaid phone bundle. afrigov is 10 KB of CSS. One ministry home page we rebuilt went from 8.9 MB to 29 KB, and from 14 seconds to 3 seconds on a phone.
-
Fast on slow phones and networks
System fonts only, so there are no fonts to download. Every component works with JavaScript turned off, and video loads only when someone presses play. A page is readable on a 2G connection.
-
Accessible, and checked on every change
The build fails if any colour pair misses 4.5:1. axe-core runs on every page of this site, with every pack, on every pull request.
-
Two link tags to install
Plain CSS with custom properties. No Sass, no bundler, no framework, and nothing to build.
-
A pack for each country
The core has no flag colours. A pack adds them, derives text-safe variants, and carries the official banner strings in the country's languages.
-
You do not have to rebuild to start
Run Audit on the site you have today, and fix its heavy images with Images. Move to the design system or the WordPress theme when a rebuild comes. Each step helps on its own.