This guide explains how to run weconnect-server in a local Docker environment.
- Docker Desktop (or Docker Engine + Compose plugin on Linux)
- Git
All WeVote services (WeVoteServer, WebApp, weconnect-server) share a Docker network named wevote. Create it once:
docker network create wevoteCopy the template and fill in your values:
cp .env-template .envIf you want to customize the database username and password used by weconnect-server, update the settings in the .env file:
# .env
DATABASE_USERNAME=your_username_here
DATABASE_PASSWORD=your_password_hereThe Docker Compose file overrides DATABASE_HOST, DATABASE_PORT, HTTPS_SSL_CERT, and HTTPS_SSL_KEY automatically, so you do not need to set those in .env for Docker.
docker compose up --buildThis will:
- Start a PostgreSQL database
- Wait for the database to be healthy
- Run
prisma generateandprisma migrate deployto apply all migrations - Start the weconnect-server with nodemon (auto-reloads on file changes)
The API will be available at https://localhost:4500.
To run in the background:
docker compose up --build -ddocker compose downTo also remove the database volume (deletes all data):
docker compose down -vThe source directory is mounted into the container at /app, so edits you make on the host are reflected immediately. nodemon watches for changes and restarts the server automatically.
To run Prisma commands inside the running container:
# Open a shell in the api container
docker compose exec weconnect-api sh
# Then run Prisma commands
npx prisma studio # visual database browser at http://localhost:5555
npx prisma migrate dev # create a new migration
npx prisma db seed # run seed script (if configured)Or run them directly without opening a shell:
docker compose exec weconnect-api npx prisma studio
docker compose exec weconnect-api npx prisma migrate dev --name my_migrationdocker compose exec weconnect-api npm testdocker compose logs -f weconnect-api # follow api logs
docker compose logs -f weconnect-db # follow database logsdocker network create wevote fails with "already exists"
The network already exists — this is fine, proceed to the next step.
Prisma migration fails on startup
Check that the database settings are correct in .env. Run docker compose logs weconnect-db to inspect database errors.
node_modules issues or package errors
Rebuild the image to reinstall dependencies:
docker compose build --no-cache
docker compose up