Metadata-Version: 2.4
Name: deployfilegen
Version: 0.1.30
Summary: A production-grade CLI tool to generate deployment configuration files for Django/React projects.
Author-email: Shankarsan Sahoo <shankarsansahoo2001@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Shankarsan Sahoo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Shankarsan-Sahoo/deployfilegen
Project-URL: Repository, https://github.com/Shankarsan-Sahoo/deployfilegen.git
Project-URL: Issues, https://github.com/Shankarsan-Sahoo/deployfilegen/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer[all]
Requires-Dist: python-dotenv
Requires-Dist: pytest
Dynamic: license-file

# 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
```bash
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.

```bash
deployfilegen init --mode dev
```

Then start your app:
```bash
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.

```bash
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:

```ini
# 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:
```bash
deployfilegen template
```

---

## 📖 CLI Reference

```text
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
