Skip to content

FastSecForge πŸ” β€” A pluggable FastAPI security boilerplate generator with JWT auth, MongoDB/SQLAlchemy support, and a CLI for instant project scaffolding. Boost your backend development with built-in best practices!

License

Notifications You must be signed in to change notification settings

Reprompts/fastsecforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” FastSecForge

Downloads

FastSecForge is a robust, pluggable Python security boilerplate generator built on top of FastAPI, SQLAlchemy, and MongoDB. It provides JWT authentication, user management, and a powerful CLI (typer) to scaffold fully functional, secure project templates in one command.


πŸš€ Features

  • πŸ”‘ JWT Authentication with secure password hashing (passlib[bcrypt])
  • 🧩 Supports SQL (SQLAlchemy) & MongoDB (Motor)
  • πŸ“¦ Pydantic v2+ for type-safe data validation and settings
  • πŸ”§ Typer-based CLI for instant FastAPI boilerplate creation
  • ♻️ Async-ready architecture optimized for performance
  • πŸ” Security best practices out of the box (OAuth2 flows, CORS, rate limiting)

πŸ“¦ Installation

Install FastSecForge from PyPI:

pip install fastsecforge

Or install in editable mode from source:

git clone https://github.com/reprompts/fastsecforge.git
cd fastsecforge
python -m venv venv
source venv/bin/activate    # Windows: venv\\Scripts\\activate
pip install -e .            # editable mode

πŸ› οΈ CLI Usage

FastSecForge exposes one primary command: new_project. This will scaffold a complete FastAPI project for you.

fastsecforge <project_name>
  • <project_name>: Name of the new project (also used as package name).

After running this, you will have:

<project_name>/
└── src/
    └── <project_name>/
        β”œβ”€β”€ __init__.py
        β”œβ”€β”€ main.py          # FastAPI app entrypoint
        β”œβ”€β”€ config.py        # Settings loader
        β”œβ”€β”€ database.py      # DB session & models
        β”œβ”€β”€ core/
        β”‚   β”œβ”€β”€ __init__.py
        β”‚   └── security.py  # Auth, password hashing, JWT utilities
        β”œβ”€β”€ models/
        β”‚   β”œβ”€β”€ __init__.py
        β”‚   └── user.py      # User ORM models
        β”œβ”€β”€ routers/
        β”‚   β”œβ”€β”€ __init__.py
        β”‚   β”œβ”€β”€ auth.py      # Authentication routes
        β”‚   └── users.py     # User management routes
        β”œβ”€β”€ schemas/
        β”‚   β”œβ”€β”€ __init__.py
        β”‚   └── user.py      # Pydantic schemas
        └── templates/      # Additional template assets

πŸš€ Running the Generated Project

  1. Navigate into the new project

    cd <project_name>
  2. Create & activate a virtual environment

    python -m venv venv
    source venv/bin/activate    # Windows: venv\\Scripts\\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    • Rename .env.example to .env
    • Fill in your database URIs, JWT secret key, and other settings
  5. Start the development server

    uvicorn src.<project_name>.main:app --reload

    Your API will be available at http://127.0.0.1:8000 with interactive docs at http://127.0.0.1:8000/docs.


πŸ§ͺ Tests (Optional)

If you scaffold tests, run:

pytest

πŸ“œ License

This project is licensed under the MIT License.


🀝 Contributing

Contributions welcome! Open an issue or submit a pull request against main.

Releases

No releases published

Packages

No packages published

Languages