Apache STeVe (Secure Team Voting Engine) v3 is a web-based voting system built for the Apache Software Foundation. It provides a secure, anonymous voting platform for elections, supporting multiple vote types (e.g., Yes/No/Abstain motions and Single Transferable Vote elections). The server is implemented in Python using the Quart asynchronous web framework, with a SQLite database backend for persistence.
The architecture emphasizes security, modularity, and ease of maintenance. It follows a layered design with clear separation of concerns: web handling, business logic, data access, and utilities.
v3/ ├── server/ # Main server application │ ├── api.py # API endpoints (currently minimal) │ ├── bin/ # Command-line utilities │ │ ├── load-fakedata.py # Script to populate test data │ │ └── tally.py # Election tallying and reporting │ ├── certs/ # TLS certificates for HTTPS │ ├── config.yaml # Server configuration (YAML) │ ├── docs/ # Per-issue documentation storage │ ├── main.py # Application entry point │ ├── pages.py # Web page handlers (routes) │ ├── static/ # Static assets (CSS, JS, images) │ │ ├── css/ │ │ ├── js/ │ │ └── favicon.ico │ └── templates/ # EZT templates for HTML rendering ├── steve/ # Core business logic and data models │ ├── crypto.py # Cryptographic utilities (salts, keys, tokens) │ ├── election.py # Election model and database operations │ ├── persondb.py # Person/PersonDB model for voter management │ └── vtypes/ # Vote type implementations │ └── __init__.py # Registry of supported vote types └── tests/ # (Removed in some contexts) Unit tests
pages.py with decorators like @APP.get('/'). Routes are organized by functionality (e.g., voter pages, admin pages).asfquart.auth. Requires committer-level access for most operations.templates/ and use [variable] syntax for substitution. Includes includes for headers/footers.static/ directory, including Bootstrap CSS/JS, custom CSS, and JavaScript utilities.steve/)election.py): Core class Election manages election lifecycle (creation, opening, closing). Handles issues, votes, and voter eligibility. Uses prepared SQL queries for database interactions.persondb.py): Manages voter information (PID, name, email). Provides lookup and addition methods.crypto.py): Handles secure token generation, salts, and vote encryption. Uses Argon2 for key derivation.vtypes/): Modular system for different voting methods (e.g., ‘yna’ for Yes/No/Abstain, ‘stv’ for Single Transferable Vote). Registry in __init__.py.Election class.sqlite3 with row factories for dict-like access.bin/)tally.py): Command-line tool for processing election results. Uses the Election class to compute tallies and generate reports.load-fakedata.py): Populates the database with test data for development.import pathlib, import quart), then local modules. Uses absolute imports within the package.FMT_DATE = '%b %d'). No abbreviations unless standard.ElectionNotFound). No broad try/except blocks; scripts exit on failure.logging module. Root logger set to INFO to suppress third-party noise. Local loggers (e.g., _LOGGER) can be DEBUG. F-strings for log messages (e.g., logger.debug(f"Processing {item}")).pages.py for routes, election.py for model).server/, business logic in steve/, scripts in bin/.config.yaml), with defaults in code.static/.templates/, with includes for reuse.mayvote table).certs/.main.py with if __name__ == '__main__' for standalone, ASGI for production.config.yaml relative to app directory.tests/ (removed in some contexts).uv (Python package manager); includes Quart, asfpy, etc.@load_election and @load_election_issue decorators fetch and pass database objects to handlers.edict from easydict for dict-like objects with attribute access (e.g., result.election = election.get_metadata()).asfquart.utils.render() for EZT templates.asfpy.stopwatch.Stopwatch() for performance monitoring in debug mode.ezt.boolean() for conditional rendering in templates.This architecture supports scalable, secure voting while remaining maintainable and extensible.