Skip to main content

A production-grade CLI tool to generate deployment configuration files for Django/React projects.

Project description

deployfilegen

deployfilegen is a production-grade Python CLI library designed to automatically generate infrastructure-as-code for full-stack applications (Django + React/Next.js/Vite).

It automates the creation of Dockerfiles, docker-compose.yml, and GitHub Actions workflows, using secure, battle-tested defaults.

🚀 Key Features (v0.1.28+)

  • Zero-Config Dev Mode: Works with any existing .env file. No forced variable naming.
  • Smart Framework Detection: Automatically detects Vite (port 5173), Next.js (port 3000), or Create React App.
  • Production-Grade Defaults:
    • Security: Non-root users, unprivileged Nginx.
    • Reliability: Healthchecks, depends_on, and race-condition prevention.
    • Optimization: Multi-stage builds, .dockerignore generation, layer caching.
  • Environment Agnostic: Reads defaults from your .env (root, backend/, or frontend/).

📦 Quick Start

1. Install

pip install deployfilegen

2. Local Development (Zero Config)

Just run this in your project root. It detects your setup and generates a working local dev environment.

deployfilegen init --mode dev

Then start your app:

docker compose -f docker-compose.dev.yml up --build

What you get:

  • backend/Dockerfile (Hot-reload enabled)
  • frontend/Dockerfile (Hot-reload enabled, correct port detected)
  • docker-compose.dev.yml (Binds to your local .env)

3. Production Deployment

generate hardened artifacts for deployment.

deployfilegen init --mode prod

What you get:

  • backend/Dockerfile (Optimized, Gunicorn, Static files)
  • frontend/Dockerfile (Nginx, Multi-stage build)
  • docker-compose.prod.yml (Restart policies, Healthchecks)
  • .github/workflows/deploy.yml (CI/CD pipeline)

🛠 Supported Stacks

Backend:

  • Django: Auto-detects project name from manage.py.
  • Python: Uses 3.11-slim by default.

Frontend:

  • Vite: Auto-configures port 5173 and host binding.
  • Next.js: Auto-configures port 3000 and standalone build.
  • Create React App: Auto-configures port 3000.

⚙️ Configuration

.env File

For Dev Mode, you just need a .env file. The tool respects whatever variables you have.

For Production Mode, you need these variables to generate the CI/CD workflow:

# Container Registry
DOCKER_USERNAME=your_username
BACKEND_IMAGE_NAME=your_repo/backend
FRONTEND_IMAGE_NAME=your_repo/frontend

# Deployment Server (SSH)
DEPLOY_HOST=1.2.3.4
DEPLOY_USER=ubuntu

You can generate a template with:

deployfilegen template

📖 CLI Reference

Usage: deployfilegen init [OPTIONS]

Options:
  --mode [dev|prod]    Generation mode (Default: prod)
  --force, -f          Overwrite existing files
  --with-db            Include a Postgres service in docker-compose
  --docker-only        Generate only Dockerfiles
  --compose-only       Generate only docker-compose.yml
  --github-only        Generate only GitHub Actions (Prod only)
  --backend-only       Only generate backend assets
  --frontend-only      Only generate frontend assets
  --with-db            Include a Postgres service in docker-compose
  # Stability Overrides
  --frontend-port      Override detected frontend dev port
  --start-command      Override detected frontend start command
  --project-name       Override detected Django project name
  --help               Show this message

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deployfilegen-0.1.30.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deployfilegen-0.1.30-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file deployfilegen-0.1.30.tar.gz.

File metadata

  • Download URL: deployfilegen-0.1.30.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for deployfilegen-0.1.30.tar.gz
Algorithm Hash digest
SHA256 4251cc07e2e15e236fba6ff9e0ca7c4cb4dba9d1c0ee0de7c6e6b8ace230d827
MD5 10139661f7c1acd5d08b5760c1bf738c
BLAKE2b-256 a172f23a5126cf1121438b439d0d2175432c3028cf0e679b84388dd66ea1eab5

See more details on using hashes here.

File details

Details for the file deployfilegen-0.1.30-py3-none-any.whl.

File metadata

  • Download URL: deployfilegen-0.1.30-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for deployfilegen-0.1.30-py3-none-any.whl
Algorithm Hash digest
SHA256 a2b2902bda8e9cc374aeb5dcd6f9044e372081d5e8ad3695f024e98730386c01
MD5 e5ae4673f8eedda688d455b929b4c9e7
BLAKE2b-256 e8ee405354e6515442f277e677ebeb5574cfdc940c936db56c1b80d26a2711f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page