Skip to content

grittypuffy/pact-backend

Repository files navigation

PACT: Prompt Auto-Correction and Testing

"A golden gateway to improve prompt-engineering skills of the users."

Backend Development

  1. Install the dependencies by creating a virtual environment
git clone https://github.com/grittypuffy/pact-backend
cd pact-backend
poetry env use python3.13

Activate the virtual environment on Linux distrubutions.

source $(poetry env info --path)/bin/activate

Install dependencies

poetry install
  1. Generate self-signed certificates for HTTPS, this is needed to set cookies during local development. Install mkcert to generate it.
mkdir certs
cd certs
mkcert localhost
  1. Start the development server in the project root directory by the following command once the environment variables have been configured correctly as per .env sample:
poetry run python -m uvicorn --ssl-certfile certs/localhost.pem --ssl-keyfile certs/localhost-key.pem --workers 4 pact_backend.server:app --reload

This should start the development server at https://0.0.0.0:8000/

Docker

  1. Build the Docker image using the following command:
docker buildx build -t pact-backend:latest .
  1. Deploy it using docker run command or by pushing to a container registry (Azure Container Registry or Docker Hub) by tagging the image appropriately.