This guide walks you through setting up the Crypto E-Voting API on your local machine. By the end you will have a running FastAPI server connected to PostgreSQL and Redis, with database migrations applied and a voter registered through the API.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Crypto-Project-ENSTA/back-end/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Make sure the following are installed and running before you begin:- Python 3.10 or later — the back-end uses union type syntax (
X | Y) available from 3.10+ - PostgreSQL — the primary data store for voters, votes, credentials, and election configuration
Setup
Clone the repository and install dependencies
Clone the project and install all Python dependencies from the pinned requirements file:Key packages installed include
fastapi, uvicorn, sqlalchemy, alembic, psycopg2-binary, redis, cryptography, and pydantic-settings.Configure your environment
Copy the example environment file and fill in your values:Open
.env.local and set each variable:Run database migrations
Apply all Alembic migrations to create the required tables:Alembic reads the
DATABASE_URL from your .env.local file and creates the voters, votes, credentials, counted_votes, and voting_system_config tables.Start the development server
Launch the API with hot-reload enabled:The server starts on
http://127.0.0.1:8000 by default. On startup it creates any missing database tables and starts the voter-watcher background thread that monitors for new registrations.Confirm the server is running:Register a voter
Register a voter by sending their email address to A successful registration returns HTTP If the email is already registered, the API returns HTTP
POST /voters/register:201:409:Next steps
Voter registration guide
Learn the full registration and credential delivery flow
Cryptographic protocol
Understand how RSA blind signatures and nonce credentials work together
API reference
Browse every endpoint with request and response schemas
Configuration reference
See all environment variables and their accepted values