Metadata-Version: 2.4
Name: shafikul_cli
Version: 2.1.3
Summary: CLI tool for FastAPI scaffolding with router, models, database, and templates.
Author-email: Md Shafikul Islam <buildwithshafikul@gmail.com>
Project-URL: Homepage, https://github.com/build-with-shafikul/shafikul_cli
Project-URL: Issues, https://github.com/build-with-shafikul/shafikul_cli/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer
Requires-Dist: rich
Requires-Dist: keyboard
Requires-Dist: pyautogui
Requires-Dist: pyperclip
Dynamic: license-file

# 🚀 Shafikul CLI

> **Lightning-fast FastAPI Project Scaffolding** — Generate production-ready boilerplate with user authentication, database models, and a complete folder structure in seconds.

<div align="center">

![Version](https://img.shields.io/badge/version-2.1.2-blue?style=flat-square)
![Python](https://img.shields.io/badge/python-3.9+-green?style=flat-square)
![License](https://img.shields.io/badge/license-MIT-purple?style=flat-square)
[![GitHub](https://img.shields.io/badge/GitHub-build--with--shafikul-black?style=flat-square&logo=github)](https://github.com/build-with-shafikul/shafikul_cli)

</div>

---

## 📋 What is Shafikul CLI?

Shafikul CLI is a **command-line scaffolding tool** that generates **complete FastAPI projects** with best practices built-in. Instead of manually creating routers, models, templates, and configurations, let the CLI do it for you—instantly.

Perfect for:
- 🎯 **Rapid Prototyping** — Start building features, not boilerplate
- 👥 **User Authentication** — Pre-configured login, logout, and registration
- 🗄️ **Database Setup** — SQLAlchemy models, Alembic migrations, auto-generated
- 🎨 **Templates Ready** — Organized template structure for web routes
- ⚡ **Zero Config** — Works out of the box with sensible defaults

---

## ✨ Features

| Feature | Status |
|---------|--------|
| 🏗️ Auto-generate FastAPI project structure | ✅ |
| 🔐 Built-in user authentication (login, logout, registration) | ✅ |
| 🗄️ SQLAlchemy models & Alembic migrations | ✅ |
| 🛣️ Auto-generate routers (Web & API) | ✅ |
| 📝 HTML templates (layouts, pages, error handling) | ✅ |
| ⚙️ Auto-update `main.py` and `.env` | ✅ |
| 🎨 CSS, JavaScript, and static assets folders | ✅ |
| 🧩 Interactive CLI with multiple input options | ✅ |
| 🌈 Colored console output | ✅ |
| 📦 Pip installable package | ✅ |

---

## 📦 Installation

### From PyPI (Recommended)
```bash
pip install shafikul_cli
```

### From Source (Development)
```bash
git clone https://github.com/build-with-shafikul/shafikul_cli.git
cd shafikul_cli
pip install -e .
```

---

## 🚀 Quick Start

### 1️⃣ Create a New FastAPI Project
```bash
mkdir project_name
shafikul_cli create app
```

### 2️⃣ Follow the Interactive Prompts
The CLI will create folders, files, install dependencies, and initialize the database automatically.

### 3️⃣ Start the Development Server
```bash
python main.py
```
Then visit **`http://127.0.0.1:8000`** in your browser.

---

## 📖 CLI Commands

### View Help
```bash
shafikul_cli --help
```

### Check Version
```bash
shafikul_cli --version
# or
shafikul_cli -v
```

### About
```bash
shafikul_cli --about
# or
shafikul_cli -a
```

### Create Resources (Interactive)
```bash
shafikul_cli create app
```

---

## 📁 Project Structure

```
your-project/
│
├── 📄 main.py                    # FastAPI application entry point
├── 📄 requirements.txt           # Python dependencies
├── 📄 .env                       # Environment variables (gitignored)
├── 📄 .env.example              # Environment template
├── 📄 .gitignore                # Git ignore rules
├── 📄 alembic.ini               # Database migration config
│
├── 📂 app/                       # Application core
│   ├── database.py              # Database connection & session
│   └── models.py                # SQLAlchemy ORM models
│
├── 📂 config/                    # Configuration
│   └── app.py                   # App settings & constants
│
├── 📂 router/                    # Route handlers
│   ├── web/                     # Web routes (HTML responses)
│   │   ├── auth.py              # Login, logout, register
│   │   ├── public.py            # Public pages
│   │   └── error.py             # Error pages
│   └── api/                     # API routes (JSON responses)
│       └── users.py             # User API endpoints
│
├── 📂 templates/                 # Jinja2 HTML templates
│   ├── layouts/                 # Base templates
│   │   ├── main.html            # Main layout
│   │   └── auth.html            # Auth layout
│   └── pages/                   # Page templates
│       ├── public/              # Public pages
│       │   └── index.html
│       ├── auth/                # Auth pages
│       │   ├── login.html
│       │   └── register.html
│       ├── authenticated/       # Protected pages
│       │   └── dashboard.html
│       └── error/               # Error pages
│           └── 404.html
│
├── 📂 asset/                     # Static assets
│   ├── css/
│   │   └── style.css
│   ├── js/
│   │   └── script.js
│   └── images/
│       └── icon.png
│
├── 📂 static/                    # Served static files
│   └── images/
│       └── logo.png
│
├── 📂 utility/                   # Helper functions
│   └── helper_function.py
│
├── 📂 migrations/                # Alembic migrations
│   ├── versions/
│   └── env.py
│
└── 📂 test.db                    # SQLite database (example)
```

---

## 🔐 Authentication Features

Shafikul CLI comes with **pre-built authentication** out of the box:

### ✅ Included
- **User Registration** — Form validation & password hashing
- **User Login** — Session management with secure cookies
- **User Logout** — Session cleanup
- **Password Security** — Bcrypt & Argon2 hashing
- **Protected Routes** — Dashboard & user pages
- **Database Models** — User table with indexes

### 🎯 Routes
```
GET  /                    → Homepage
GET  /register            → Registration form
POST /register            → Handle registration
GET  /login               → Login form
POST /login               → Handle login
GET  /dashboard           → Protected dashboard
POST /logout              → Logout user
GET  /404                 → Not found page
```

---

## 🗄️ Database & Migrations

The CLI automatically sets up:

1. **SQLite Database** (configurable)
2. **SQLAlchemy ORM** — Type-safe models
3. **Alembic Migrations** — Version control for schema

### Run Migrations
```bash
alembic upgrade head
```

### Create New Migration
```bash
alembic revision --autogenerate -m "Add new column"
```

### Rollback
```bash
alembic downgrade -1
```

---

## 📦 Dependencies

Shafikul CLI installs the following packages:

| Package | Purpose |
|---------|---------|
| **FastAPI** | Web framework |
| **Uvicorn** | ASGI server |
| **Jinja2** | Template engine |
| **SQLAlchemy** | ORM |
| **Alembic** | Migrations |
| **Passlib + Bcrypt** | Password hashing |
| **Argon2-CFFI** | Advanced password hashing |
| **python-dotenv** | Environment variables |
| **python-multipart** | Form data parsing |

See `requirements.txt` for the complete list.

---

## 🛠️ Development

### Fork & Contribute

1. **Fork** the [repository](https://github.com/build-with-shafikul/shafikul_cli/fork)
2. **Create a feature branch:**
   ```bash
   git checkout -b feature/your-feature-name
   ```
3. **Make your changes** and test thoroughly
4. **Commit with clear messages:**
   ```bash
   git commit -m "Add: description of your feature"
   ```
5. **Push to your fork:**
   ```bash
   git push origin feature/your-feature-name
   ```
6. **Open a Pull Request** with a clear description

### Development Setup
```bash
git clone https://github.com/build-with-shafikul/shafikul_cli.git
cd shafikul_cli
pip install -e ".[dev]"  # Install with dev dependencies
```

---

## 📚 Example Usage

### Generate a Complete Blog Project

```bash
# Create project
shafikul_cli create app
```

---

## 🐛 Troubleshooting

### Command not found: `shafikul_cli`
Make sure you've installed the package:
```bash
pip install shafikul_cli
```

### Port 8000 already in use
Change the port in `main.py`:
```python
uvicorn.run("main:app", host="127.0.0.1", port=8001, reload=True)
```

### Database migration failed
Reset your database:
```bash
rm test.db
alembic upgrade head
```

---

## 📄 License

MIT License — See [LICENSE](LICENSE) for details.

---

## 👤 Author

**Md Shafikul Islam**

- 🔗 [GitHub](https://github.com/build-with-shafikul)
- 📧 [Email](mailto:buildwithshafikul@gmail.com)

---

## ⭐ Show Your Support

If you find this tool helpful, please give it a star on [GitHub](https://github.com/build-with-shafikul/shafikul_cli) — it means a lot! 🙌

---

<div align="center">

**Made with ❤️ by Md Shafikul Islam**

*Simplifying FastAPI development, one command at a time.*

</div>
