A static-first web application that builds a local SQLite database from official open-data exports, then serves searchable pages for public votes, deputies, and political groups.
- Home dashboard with dataset volume, covered period, and recent public votes.
- Searchable and paginated list of public votes.
- Vote filters by legislature, result, vote type, parliamentary body, date range, and close votes.
- Vote detail pages with ballot metadata, group positions, and individual deputy votes.
- Deputy pages with mandate information, vote summaries, and searchable voting history.
- Political group pages with aggregated voting statistics and member lists.
- htmx-enhanced filtering and pagination with normal links and forms as a fallback.
- Local preprocessing pipeline from Assemblée nationale JSON exports to SQLite.
- Read-only web runtime with startup validation for schema and required tables.
The preprocessing command expects the Assemblée nationale open-data JSON exports under data/raw/.
The helper script downloads the 17th legislature datasets used by the project:
Scrutins.json.zipfor public votes.AMO20_dep_sen_min_tous_mandats_et_organes.json.zipfor actors, mandates, and organs.Amendements.json.zipfor optional amendment links.Dossiers_Legislatifs.json.zipfor optional legislative dossier links.
Generated data is written to data/processed/gouv-viz.sqlite. Raw and processed datasets are ignored by Git.
- Go 1.25
- Echo for HTTP routing and middleware
- templ for server-rendered components
- htmx for progressive interactions
- SQLite through
modernc.org/sqlite golang-migratefor embedded schema migrations- Plain CSS bundled from
web/assets/css/src/
- Go 1.25 or newer
templv0.3.1001curlandunzipto usescripts/download-data.sh- Air, optional, for
make dev - Docker, optional, for container builds
Install templ:
go install github.com/a-h/templ/cmd/templ@v0.3.1001./scripts/download-data.sh
make preprocess
make runLocal development uses the dev.env file through make run and make dev. The web application listens on http://localhost:9456 by default.
Configuration is read from environment variables. The application loads ENV_FILE when set, otherwise .env when present, otherwise dev.env. Values already present in the process environment take precedence over env files.
| Variable | Default | Description |
|---|---|---|
ENV |
dev |
Runtime environment. Set to prod to disable development-only routes. |
ENV_FILE |
unset | Optional env file path to load before applying defaults. |
PORT |
9456 |
HTTP port. |
ASSETS_PATH |
web/assets |
Static assets directory served at /assets. |
DATABASE_PATH |
data/processed/gouv-viz.sqlite |
SQLite database used by the web server. |
BASE_URL |
unset | Canonical base URL for absolute links, e.g. https://gouv.viz. When unset, the server derives the base URL from each request. |
Generate CSS and templ files:
make generateRun the web server:
make runRun with Air live reload:
make devRun tests:
make testRun the full local verification suite:
make verifymake verify rebuilds CSS, regenerates templ code, formats Go files, tidies modules, runs tests, runs go vet, and builds all packages.
Download the current supported raw datasets:
./scripts/download-data.shBuild the SQLite database:
make preprocessUse custom input or output paths:
go run ./cmd/preprocess -raw data/raw -out data/processed/gouv-viz.sqliteThe preprocessing command creates a temporary SQLite file, applies embedded migrations, imports actors, organs, mandates, public votes, group vote totals, and individual votes, then atomically replaces the output database after validation.
Optional amendment and dossier data is used when data/raw/amendements/json/ and data/raw/dossiers/json/ exist.
make perf-check runs representative store queries against the generated SQLite database and reports slow queries or suspicious query plans.
make perf-check
go run ./cmd/storeperf -db data/processed/gouv-viz.sqlite -runs 5 -slow 500ms
go run ./cmd/storeperf -db data/processed/gouv-viz.sqlite -strictUse -strict in CI-like checks when slow queries or plan issues should fail the command.
The Docker image contains the web binary and static assets. It does not contain the generated Assemblée nationale database.
Copy the example environment file, build the database, then start the web container with Docker Compose:
cp .env.example .env
make preprocess
docker compose up --buildThe Compose service reads .env through Docker Compose variable interpolation, builds the local Dockerfile, exposes http://localhost:${PORT}, and mounts ${DATABASE_PATH} read-only at the same path inside /app.
Default .env values:
ENV=prod
PORT=9456
ASSETS_PATH=web/assets
DATABASE_PATH=data/processed/gouv-viz.sqliteAt startup, the web process opens SQLite in read-only immutable mode and validates the expected schema version and required tables. Missing or incompatible database mounts fail at startup.
| Route | Description |
|---|---|
/ |
Home dashboard and recent votes. |
/scrutins |
Searchable public vote list. |
/scrutins/:uid |
Public vote detail page. |
/deputes |
Searchable deputy list. |
/deputes/:uid |
Deputy detail page. |
/groupes |
Political group list. |
/groupes/:uid |
Political group detail page. |
/ping |
Health check endpoint. |
In development mode, /ws is also registered for hot reload support.
cmd/web/ Web server entrypoint
cmd/preprocess/ JSON-to-SQLite preprocessing command
cmd/storeperf/ Store query timing and query-plan checks
docker-compose.yml Local container orchestration for the web app
internal/config/ Environment loading and validation
internal/dbmigration/ Embedded SQLite migrations
internal/store/ Read-side SQLite queries and page DTOs
internal/testdb/ Test helpers for migrated SQLite databases
web/handlers/ HTTP handlers and request parsing
web/components/ templ components and generated Go files
web/assets/ Static assets served by Echo
web/assets/css/src/ Source CSS modules
scripts/build-css.sh CSS bundle builder
scripts/download-data.sh Assemblée nationale dataset downloader
data/fixtures/ Small committed fixtures for tests
data/raw/ Local raw open-data exports, ignored by Git
data/processed/ Generated SQLite output, ignored by Git
This project is licensed under the MIT License. See the LICENSE file for details.
