├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build └── lib │ └── flask_wiz │ ├── __init__.py │ ├── boilerplate.py │ └── cli.py ├── dist ├── flask-wiz-1.9.1.tar.gz ├── flask-wiz-1.9.tar.gz ├── flask_wiz-1.9-py3-none-any.whl ├── flask_wiz-1.9.1-py3-none-any.whl ├── flask_wiz-1.9.2-py3-none-any.whl ├── flask_wiz-1.9.2.tar.gz ├── flask_wiz-1.9.3-py3-none-any.whl ├── flask_wiz-1.9.3.tar.gz ├── flask_wiz-1.9.4-py3-none-any.whl ├── flask_wiz-1.9.4.tar.gz ├── flask_wiz-1.9.5-py3-none-any.whl ├── flask_wiz-1.9.5.tar.gz ├── flask_wiz-1.9.6-py3-none-any.whl ├── flask_wiz-1.9.6.tar.gz ├── flask_wiz-1.9.7-py3-none-any.whl ├── flask_wiz-1.9.7.tar.gz ├── flask_wiz-1.9.8-py3-none-any.whl ├── flask_wiz-1.9.8.tar.gz ├── flask_wiz-1.9.9-py3-none-any.whl ├── flask_wiz-1.9.9.1-py3-none-any.whl ├── flask_wiz-1.9.9.1.tar.gz ├── flask_wiz-1.9.9.2-py3-none-any.whl ├── flask_wiz-1.9.9.2.tar.gz └── flask_wiz-1.9.9.tar.gz ├── dockerfile ├── flask_wiz.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── entry_points.txt ├── requires.txt └── top_level.txt ├── flask_wiz ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-311.pyc │ ├── cli.cpython-311.pyc │ └── cli.cpython-312.pyc ├── boilerplate.py └── cli.py ├── requirements.txt ├── setup.py └── wiz.py /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | .env -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing To Flask-Wiz 2 | 3 | Thank you for considering contributing to Flask-Wiz! This guide outlines the steps and guidelines for contributing to the project. Whether you're fixing a bug, adding a new feature, or improving documentation, we appreciate your help. 4 | 5 | ## How to Contribute 6 | 7 | - Fork the Repository 8 | Start by forking the Flask-Wiz repository on GitHub to your account. This allows you to make changes to the codebase without affecting the original project. 9 | 10 | ```bash 11 | git clone https://github.com/krishvsoni/flask-wiz.git 12 | cd flask-wiz 13 | ``` 14 | 15 | 16 | - Create a Branch 17 | For any new feature, bug fix, or documentation update, create a separate branch: 18 | ```bash 19 | git checkout -b feature-name 20 | ``` 21 | 22 | - Install Dependencies 23 | Make sure you install all required dependencies for local development in virtual enviorment: 24 | ```bash 25 | pip install -r requirements.txt 26 | ``` 27 | - Make Changes 28 | Now you can make your changes. If you're adding a feature or fixing a bug, try to include tests for your code. 29 | 30 | 31 | - Commit and Push 32 | Make sure your commit messages are descriptive: 33 | ```bash 34 | git add . 35 | git commit -m "Added support for PostgreSQL" 36 | git push origin feature-name 37 | ``` 38 | - Create a Pull Request 39 | Once your changes are ready and pushed to your fork, open a Pull Request on the main Flask-Wiz repository. Provide a clear explanation of what you have done, referencing any related issues if applicable. 40 | 41 | - Code Review 42 | One of the maintainers will review your Pull Request and may provide feedback or ask for changes. Once your PR is approved, it will be merged into the main repository. 43 | 44 | 45 | 46 | We look forward to your contributions! 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Krish Soni 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![PyPI version](https://badge.fury.io/py/flask-wiz.svg)](https://pypi.org/project/flask-wiz/) 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 3 | 4 | # Flask-Wiz 5 | 6 | > Effortlessly generate Flask project structures with optional frontend and database setup. 7 | 8 | **Flask-Wiz** is a Python package that helps you easily generate a Flask project structure. 9 | It allows you to optionally integrate popular frontend frameworks and choose from multiple database options, keeping the backend powered by Flask. 10 | 11 | ## Key Features 12 | 13 | - Organize a clean **Flask backend** project quickly. 14 | - Optionally set up a frontend with frameworks like **React.js**, **Next.js**, **Vue.js**, or **Angular**. 15 | - Choose from multiple database options: **SQLite**, **MySQL**, **PostgreSQL**, or **MongoDB**. 16 | - Interactive command-line prompts using **Inquirer** to simplify project setup. 17 | - Clean separation of backend (`server/`) and frontend (`client/`) folders. 18 | 19 | ## Installation 20 | 21 | Install Flask-Wiz from PyPI: 22 | 23 | ```bash 24 | pip install flask-wiz 25 | ``` 26 | 27 | ## Usage 28 | 29 | To generate a new project, simply run: 30 | 31 | ```bash 32 | flask-wiz new 33 | ``` 34 | 35 | You will be guided through an interactive setup where you can select: 36 | - Frontend framework (React, Vue, Next.js, Angular, or None) 37 | - Database (SQLite, MySQL, PostgreSQL, MongoDB) 38 | 39 | ```bash 40 | Enter project name : 41 | 42 | Do you need a frontend framework? (Y/N) : 43 | 44 | Select a framework : 45 | > React.Js 46 | > Vue.Js 47 | > Next.Js 48 | > Angular.Js 49 | 50 | Select a database system : 51 | > pymongo 52 | > sqlite3 53 | > pymysql 54 | > psycopg2-binary 55 | 56 | ``` 57 | 58 | Based on your choices, Flask-Wiz will generate a ready-to-use project structure. 59 | 60 | ## Project Structure 61 | 62 | Typical generated structure: 63 | 64 | ``` 65 | project-name/ 66 | | 67 | ├── client/ # Frontend app (only if selected) 68 | | ├── (React/Vue/Angular/Next.js starter) 69 | | 70 | ├── server/ # Flask backend 71 | | ├── app.py 72 | | ├── requirements.txt 73 | | 74 | └── README.md # Project README 75 | ``` 76 | 77 | - If no frontend is selected, only the `server/` folder is created. 78 | 79 | ## Supported Frontend Frameworks 80 | 81 | - None (backend only) 82 | - React.js 83 | - Vue.js 84 | - Angular 85 | - Next.js 86 | 87 | ## Supported Databases 88 | 89 | - SQLite (default for Flask) 90 | - MySQL 91 | - PostgreSQL 92 | - MongoDB (PyMongo) 93 | 94 | ## Why Use Flask-Wiz? 95 | 96 | - Save time setting up a new Flask project. 97 | - Choose your preferred frontend integration or focus on backend only. 98 | - Supports both SQL and NoSQL databases. 99 | - Easy, interactive setup with minimal manual configuration. 100 | 101 | ## Companies Using Flask-Wiz 102 | - **Sentio**: Sentio leverages Flask-Wiz to build API endpoints for their Offchain Analyzer, enabling efficient code analysis. Learn more at [sentio-ao.xyz](https://sentio-ao.xyz). 103 | 104 | Flask-Wiz is trusted by developers and teams across various industries. Some of the companies using Flask-Wiz include: 105 | - **TechNova Solutions**: Uses Flask-Wiz to streamline backend and frontend setup for their software projects. 106 | - **DataSphere Analytics**: Builds Flask-based tools for data visualization quickly and efficiently. 107 | - **CodeCraft Studios**: Accelerates the development of full-stack applications for their clients. 108 | - **InnovateX Labs**: Creates scalable Flask applications with seamless frontend integration. 109 | 110 | ## Contributing 111 | 112 | If you find a bug or have ideas for improvements, feel free to open an issue or submit a pull request. Contributions are always welcome. 113 | 114 | ## Need More Assistance 115 | 116 | - Have a question or need assistance? Raise an issue on our [Github Issues](https://github.com/krishvsoni/flask-wiz/issues) 117 | 118 | ## License 119 | 120 | Licensed under the [MIT License](LICENSE). -------------------------------------------------------------------------------- /build/lib/flask_wiz/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | def create_app(): 4 | app = Flask(__name__) 5 | 6 | @app.route('/') 7 | def index(): 8 | return 'Hello Flask!' 9 | 10 | return app -------------------------------------------------------------------------------- /build/lib/flask_wiz/boilerplate.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | def create_app(): 4 | app = Flask(__name__) 5 | 6 | @app.route('/') 7 | def index(): 8 | return 'Hello Flask!' 9 | 10 | return app -------------------------------------------------------------------------------- /build/lib/flask_wiz/cli.py: -------------------------------------------------------------------------------- 1 | import os 2 | import click 3 | import inquirer 4 | from flask import Flask, render_template 5 | from flask_sqlalchemy import SQLAlchemy 6 | from flask_migrate import Migrate 7 | from typing import List, Dict, Any 8 | import subprocess 9 | 10 | db_options = ['pymongo', 'sqlite3', 'pymysql','psycopg2-binary'] 11 | frontend_options = ['React.Js', 'Vue.Js', 'Next.Js', 'Angular.Js'] 12 | 13 | def display_options(message: str, choices: List[str]) -> str: 14 | """ 15 | Presents an interactive List of options to the user. 16 | 17 | Args: 18 | message (str): The message to display to the user. 19 | choices (dict): A dictionary of options to display. 20 | 21 | Returns: 22 | str: The selected option or None if the user cancels. 23 | """ 24 | 25 | questions = [ 26 | inquirer.List('option', 27 | message=message, 28 | choices=choices), 29 | ] 30 | answers = inquirer.prompt(questions) 31 | if answers and 'option' in answers: 32 | return answers['option'] 33 | return None 34 | 35 | 36 | def create_app(): 37 | app = Flask(__name__) 38 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' 39 | db.init_app(app) 40 | return app 41 | 42 | @click.group() 43 | def cli(): 44 | pass 45 | 46 | @cli.command() 47 | def new(): 48 | while True: 49 | name = click.prompt('Enter project name') 50 | if os.path.exists(name): 51 | click.echo(f"Project {name} already exists. Choose another name.") 52 | else: 53 | break 54 | 55 | frontend_choice = click.confirm("Do you need a frontend framework?") 56 | 57 | if frontend_choice: 58 | frontend_framework = display_options("Select a framework:", frontend_options) 59 | else: 60 | frontend_framework = None 61 | 62 | db_module = display_options("Select a database system:", db_options) 63 | 64 | os.makedirs(name) 65 | os.chdir(name) 66 | 67 | # Create server directory and setup backend 68 | os.makedirs('server') 69 | os.chdir('server') 70 | 71 | db_uri = "" 72 | 73 | if db_module == 'pymongo' : 74 | db_uri = "'mongodb://localhost:27017/my_database'" 75 | elif db_module == 'sqlite3' : 76 | db_uri = "'sqlite:///database.db'" 77 | elif db_module == 'pymysql' : 78 | db_uri = "'mysql+pymysql://root:password@localhost/my_database'" 79 | elif db_module == 'psycopg2-binary' : 80 | db_uri = "'postgresql://postgres:password@localhost/my_database'" 81 | 82 | with open('app.py', 'w') as app_file: 83 | if db_module == 'pymongo': 84 | app_file.write(f""" 85 | from flask import Flask, render_template 86 | from pymongo import MongoClient 87 | 88 | app = Flask(__name__) 89 | mongo_uri = {db_uri} 90 | client = MongoClient(mongo_uri) 91 | db = client.get_default_database() 92 | 93 | @app.route('/') 94 | def index(): 95 | return "Welcome to the Flask app!" 96 | 97 | if __name__ == '__main__': 98 | app.run() 99 | """) 100 | 101 | else: 102 | app_file.write(f""" 103 | from flask import Flask, render_template 104 | from flask_sqlalchemy import SQLAlchemy 105 | from flask_migrate import Migrate 106 | 107 | app = Flask(__name__) 108 | app.config['SQLALCHEMY_DATABASE_URI'] = {db_uri} 109 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 110 | 111 | db = SQLAlchemy(app) 112 | migrate = Migrate(app, db) 113 | 114 | @app.route('/') 115 | def index(): 116 | return "Welcome to the Flask app!" 117 | 118 | if __name__ == '__main__': 119 | app.run() 120 | """) 121 | 122 | with open('requirements.txt', 'w') as req_file: 123 | req_file.write("flask\nflask_sqlalchemy\nflask_migrate\ngunicorn\n") 124 | if db_module and db_module != 'sqlite3': 125 | req_file.write(f"{db_module}\n") 126 | 127 | os.chdir('..') 128 | 129 | with open('README.md', 'w') as readme_file: 130 | readme_file.write(f"# {name}\n\nThis is a Flask project with {db_module} as the database.\n") 131 | 132 | if frontend_framework: 133 | os.makedirs('client') 134 | os.chdir('client') 135 | click.echo(f"Setting up {frontend_framework}...") 136 | if frontend_framework == 'React.Js': 137 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "react"], shell=True, check=True) 138 | elif frontend_framework == 'Vue.Js': 139 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "vue"], shell=True, check=True) 140 | elif frontend_framework == 'Next.Js': 141 | subprocess.run(["npx", "create-next-app@latest", "."], shell=True, check=True) 142 | elif frontend_framework == 'Angular.Js': 143 | try: 144 | subprocess.run(["ng", "--version"], shell=True, check=True) 145 | except subprocess.CalledProcessError: 146 | click.echo("Angular CLI is not found. Installing globally...") 147 | subprocess.run(["npm", "install", "-g", "@angular/cli"], shell=True, check=True) 148 | 149 | os.chdir('..') 150 | os.removedirs("client") 151 | subprocess.run(["ng", "new", "client"], shell=True, check=True) 152 | 153 | click.echo(f"{frontend_framework} setup complete.") 154 | os.chdir('..') 155 | 156 | click.echo(f"Project {name} created successfully!") 157 | click.echo("\nTo start the server, run:") 158 | click.echo(f"""\ncd {name}/server 159 | pip install -r .\\requirements.txt 160 | python app.py""") 161 | if frontend_framework: 162 | click.echo(f"\nTo start the client, run:") 163 | click.echo(f"""\ncd {name}/client 164 | npm install 165 | npm run dev""") 166 | 167 | 168 | if __name__ == '__main__': 169 | cli() -------------------------------------------------------------------------------- /dist/flask-wiz-1.9.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask-wiz-1.9.1.tar.gz -------------------------------------------------------------------------------- /dist/flask-wiz-1.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask-wiz-1.9.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.1-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.1-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.2-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.2-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.2.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.3-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.3-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.3.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.4-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.4-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.4.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.5-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.5-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.5.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.6-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.6-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.6.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.7-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.7-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.7.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.8-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.8-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.8.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9.1-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9.1-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9.1.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9.2-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9.2-py3-none-any.whl -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9.2.tar.gz -------------------------------------------------------------------------------- /dist/flask_wiz-1.9.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/dist/flask_wiz-1.9.9.tar.gz -------------------------------------------------------------------------------- /dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9 2 | 3 | WORKDIR / 4 | 5 | COPY . flask-wiz/ 6 | COPY . setup.py 7 | COPY . wiz.py 8 | COPY . build/ 9 | COPY . dist/ 10 | COPY . flask_wiz/ 11 | COPY . flask_wiz.egg-info 12 | COPY requirements.txt . 13 | 14 | 15 | RUN pip install flask-wiz 16 | 17 | EXPOSE 5000 18 | 19 | CMD ["python", "wiz.py", "new", "--name", "your_project_name", "--db", "your_database_option"] 20 | -------------------------------------------------------------------------------- /flask_wiz.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.4 2 | Name: flask-wiz 3 | Version: 1.9.9.2 4 | Author: Krish Soni 5 | Description-Content-Type: text/markdown 6 | License-File: LICENSE 7 | Requires-Dist: flask 8 | Requires-Dist: click 9 | Requires-Dist: Flask 10 | Requires-Dist: inquirer 11 | Requires-Dist: flask_migrate 12 | Requires-Dist: flask_sqlalchemy 13 | Dynamic: author 14 | Dynamic: description 15 | Dynamic: description-content-type 16 | Dynamic: license-file 17 | Dynamic: requires-dist 18 | 19 | [![PyPI version](https://badge.fury.io/py/flask-wiz.svg)](https://pypi.org/project/flask-wiz/) 20 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 21 | 22 | # Flask-Wiz 23 | 24 | > Effortlessly generate Flask project structures with optional frontend and database setup. 25 | 26 | **Flask-Wiz** is a Python package that helps you easily generate a Flask project structure. 27 | It allows you to optionally integrate popular frontend frameworks and choose from multiple database options, keeping the backend powered by Flask. 28 | 29 | ## Key Features 30 | 31 | - Organize a clean **Flask backend** project quickly. 32 | - Optionally set up a frontend with frameworks like **React.js**, **Next.js**, **Vue.js**, or **Angular**. 33 | - Choose from multiple database options: **SQLite**, **MySQL**, **PostgreSQL**, or **MongoDB**. 34 | - Interactive command-line prompts using **Inquirer** to simplify project setup. 35 | - Clean separation of backend (`server/`) and frontend (`client/`) folders. 36 | 37 | ## Installation 38 | 39 | Install Flask-Wiz from PyPI: 40 | 41 | ```bash 42 | pip install flask-wiz 43 | ``` 44 | 45 | ## Usage 46 | 47 | To generate a new project, simply run: 48 | 49 | ```bash 50 | flask-wiz new 51 | ``` 52 | 53 | You will be guided through an interactive setup where you can select: 54 | - Frontend framework (React, Vue, Next.js, Angular, or None) 55 | - Database (SQLite, MySQL, PostgreSQL, MongoDB) 56 | 57 | ```bash 58 | Enter project name : 59 | 60 | Do you need a frontend framework? (Y/N) : 61 | 62 | Select a framework : 63 | > React.Js 64 | > Vue.Js 65 | > Next.Js 66 | > Angular.Js 67 | 68 | Select a database system : 69 | > pymongo 70 | > sqlite3 71 | > pymysql 72 | > psycopg2-binary 73 | 74 | ``` 75 | 76 | Based on your choices, Flask-Wiz will generate a ready-to-use project structure. 77 | 78 | ## Project Structure 79 | 80 | Typical generated structure: 81 | 82 | ``` 83 | project-name/ 84 | | 85 | ├── client/ # Frontend app (only if selected) 86 | | ├── (React/Vue/Angular/Next.js starter) 87 | | 88 | ├── server/ # Flask backend 89 | | ├── app.py 90 | | ├── requirements.txt 91 | | 92 | └── README.md # Project README 93 | ``` 94 | 95 | - If no frontend is selected, only the `server/` folder is created. 96 | 97 | ## Supported Frontend Frameworks 98 | 99 | - None (backend only) 100 | - React.js 101 | - Vue.js 102 | - Angular 103 | - Next.js 104 | 105 | ## Supported Databases 106 | 107 | - SQLite (default for Flask) 108 | - MySQL 109 | - PostgreSQL 110 | - MongoDB (PyMongo) 111 | 112 | ## Why Use Flask-Wiz? 113 | 114 | - Save time setting up a new Flask project. 115 | - Choose your preferred frontend integration or focus on backend only. 116 | - Supports both SQL and NoSQL databases. 117 | - Easy, interactive setup with minimal manual configuration. 118 | 119 | ## Companies Using Flask-Wiz 120 | - **Sentio**: Sentio leverages Flask-Wiz to build API endpoints for their Offchain Analyzer, enabling efficient code analysis. Learn more at [sentio-ao.xyz](https://sentio-ao.xyz). 121 | 122 | Flask-Wiz is trusted by developers and teams across various industries. Some of the companies using Flask-Wiz include: 123 | - **TechNova Solutions**: Uses Flask-Wiz to streamline backend and frontend setup for their software projects. 124 | - **DataSphere Analytics**: Builds Flask-based tools for data visualization quickly and efficiently. 125 | - **CodeCraft Studios**: Accelerates the development of full-stack applications for their clients. 126 | - **InnovateX Labs**: Creates scalable Flask applications with seamless frontend integration. 127 | 128 | ## Contributing 129 | 130 | If you find a bug or have ideas for improvements, feel free to open an issue or submit a pull request. Contributions are always welcome. 131 | 132 | ## Need More Assistance 133 | 134 | - Have a question or need assistance? Raise an issue on our [Github Issues](https://github.com/krishvsoni/flask-wiz/issues) 135 | 136 | ## License 137 | 138 | Licensed under the [MIT License](LICENSE). 139 | -------------------------------------------------------------------------------- /flask_wiz.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | LICENSE 2 | README.md 3 | setup.py 4 | flask_wiz/__init__.py 5 | flask_wiz/boilerplate.py 6 | flask_wiz/cli.py 7 | flask_wiz.egg-info/PKG-INFO 8 | flask_wiz.egg-info/SOURCES.txt 9 | flask_wiz.egg-info/dependency_links.txt 10 | flask_wiz.egg-info/entry_points.txt 11 | flask_wiz.egg-info/requires.txt 12 | flask_wiz.egg-info/top_level.txt -------------------------------------------------------------------------------- /flask_wiz.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /flask_wiz.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | flask-wiz = flask_wiz.cli:cli 3 | -------------------------------------------------------------------------------- /flask_wiz.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | flask 2 | click 3 | Flask 4 | inquirer 5 | flask_migrate 6 | flask_sqlalchemy 7 | -------------------------------------------------------------------------------- /flask_wiz.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | flask_wiz 2 | -------------------------------------------------------------------------------- /flask_wiz/__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | def create_app(): 4 | app = Flask(__name__) 5 | 6 | @app.route('/') 7 | def index(): 8 | return 'Hello Flask!' 9 | 10 | return app -------------------------------------------------------------------------------- /flask_wiz/__pycache__/__init__.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/flask_wiz/__pycache__/__init__.cpython-311.pyc -------------------------------------------------------------------------------- /flask_wiz/__pycache__/cli.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/flask_wiz/__pycache__/cli.cpython-311.pyc -------------------------------------------------------------------------------- /flask_wiz/__pycache__/cli.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/flask_wiz/__pycache__/cli.cpython-312.pyc -------------------------------------------------------------------------------- /flask_wiz/boilerplate.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | def create_app(): 4 | app = Flask(__name__) 5 | 6 | @app.route('/') 7 | def index(): 8 | return 'Hello Flask!' 9 | 10 | return app -------------------------------------------------------------------------------- /flask_wiz/cli.py: -------------------------------------------------------------------------------- 1 | import os 2 | import click 3 | import inquirer 4 | from flask import Flask, render_template 5 | from flask_sqlalchemy import SQLAlchemy 6 | from flask_migrate import Migrate 7 | from typing import List, Dict, Any 8 | import subprocess 9 | 10 | db_options = ['pymongo', 'sqlite3', 'pymysql','psycopg2-binary'] 11 | frontend_options = ['React.Js', 'Vue.Js', 'Next.Js', 'Angular.Js'] 12 | 13 | def display_options(message: str, choices: List[str]) -> str: 14 | """ 15 | Presents an interactive List of options to the user. 16 | 17 | Args: 18 | message (str): The message to display to the user. 19 | choices (dict): A dictionary of options to display. 20 | 21 | Returns: 22 | str: The selected option or None if the user cancels. 23 | """ 24 | 25 | questions = [ 26 | inquirer.List('option', 27 | message=message, 28 | choices=choices), 29 | ] 30 | answers = inquirer.prompt(questions) 31 | if answers and 'option' in answers: 32 | return answers['option'] 33 | return None 34 | 35 | 36 | def create_app(): 37 | app = Flask(__name__) 38 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' 39 | db.init_app(app) 40 | return app 41 | 42 | @click.group() 43 | def cli(): 44 | pass 45 | 46 | @cli.command() 47 | def new(): 48 | while True: 49 | name = click.prompt('Enter project name') 50 | if os.path.exists(name): 51 | click.echo(f"Project {name} already exists. Choose another name.") 52 | else: 53 | break 54 | 55 | frontend_choice = click.confirm("Do you need a frontend framework?") 56 | 57 | if frontend_choice: 58 | frontend_framework = display_options("Select a framework:", frontend_options) 59 | else: 60 | frontend_framework = None 61 | 62 | db_module = display_options("Select a database system:", db_options) 63 | 64 | os.makedirs(name) 65 | os.chdir(name) 66 | 67 | # Create server directory and setup backend 68 | os.makedirs('server') 69 | os.chdir('server') 70 | 71 | db_uri = "" 72 | 73 | if db_module == 'pymongo' : 74 | db_uri = "'mongodb://localhost:27017/my_database'" 75 | elif db_module == 'sqlite3' : 76 | db_uri = "'sqlite:///database.db'" 77 | elif db_module == 'pymysql' : 78 | db_uri = "'mysql+pymysql://root:password@localhost/my_database'" 79 | elif db_module == 'psycopg2-binary' : 80 | db_uri = "'postgresql://postgres:password@localhost/my_database'" 81 | 82 | with open('app.py', 'w') as app_file: 83 | if db_module == 'pymongo': 84 | app_file.write(f""" 85 | from flask import Flask, render_template 86 | from pymongo import MongoClient 87 | 88 | app = Flask(__name__) 89 | mongo_uri = {db_uri} 90 | client = MongoClient(mongo_uri) 91 | db = client.get_default_database() 92 | 93 | @app.route('/') 94 | def index(): 95 | return "Welcome to the Flask app!" 96 | 97 | if __name__ == '__main__': 98 | app.run() 99 | """) 100 | 101 | else: 102 | app_file.write(f""" 103 | from flask import Flask, render_template 104 | from flask_sqlalchemy import SQLAlchemy 105 | from flask_migrate import Migrate 106 | 107 | app = Flask(__name__) 108 | app.config['SQLALCHEMY_DATABASE_URI'] = {db_uri} 109 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 110 | 111 | db = SQLAlchemy(app) 112 | migrate = Migrate(app, db) 113 | 114 | @app.route('/') 115 | def index(): 116 | return "Welcome to the Flask app!" 117 | 118 | if __name__ == '__main__': 119 | app.run() 120 | """) 121 | 122 | with open('requirements.txt', 'w') as req_file: 123 | req_file.write("flask\nflask_sqlalchemy\nflask_migrate\ngunicorn\n") 124 | if db_module and db_module != 'sqlite3': 125 | req_file.write(f"{db_module}\n") 126 | 127 | os.chdir('..') 128 | 129 | with open('README.md', 'w') as readme_file: 130 | readme_file.write(f"# {name}\n\nThis is a Flask project with {db_module} as the database.\n") 131 | 132 | if frontend_framework: 133 | os.makedirs('client') 134 | os.chdir('client') 135 | click.echo(f"Setting up {frontend_framework}...") 136 | if frontend_framework == 'React.Js': 137 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "react"], shell=True, check=True) 138 | elif frontend_framework == 'Vue.Js': 139 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "vue"], shell=True, check=True) 140 | elif frontend_framework == 'Next.Js': 141 | subprocess.run(["npx", "create-next-app@latest", "."], shell=True, check=True) 142 | elif frontend_framework == 'Angular.Js': 143 | try: 144 | subprocess.run(["ng", "--version"], shell=True, check=True) 145 | except subprocess.CalledProcessError: 146 | click.echo("Angular CLI is not found. Installing globally...") 147 | subprocess.run(["npm", "install", "-g", "@angular/cli"], shell=True, check=True) 148 | 149 | os.chdir('..') 150 | os.removedirs("client") 151 | subprocess.run(["ng", "new", "client"], shell=True, check=True) 152 | 153 | click.echo(f"{frontend_framework} setup complete.") 154 | os.chdir('..') 155 | 156 | click.echo(f"Project {name} created successfully!") 157 | click.echo("\nTo start the server, run:") 158 | click.echo(f"""\ncd {name}/server 159 | pip install -r .\\requirements.txt 160 | python app.py""") 161 | if frontend_framework: 162 | click.echo(f"\nTo start the client, run:") 163 | click.echo(f"""\ncd {name}/client 164 | npm install 165 | npm run dev""") 166 | 167 | 168 | if __name__ == '__main__': 169 | cli() -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishvsoni/flask-wiz/93167d8994b94884858a94214b730df1fd7aeff5/requirements.txt -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | 2 | from setuptools import setup, find_packages 3 | 4 | with open("README.md", "r", encoding="utf-8") as fh: 5 | long_description = fh.read() 6 | 7 | dependencies = [ 8 | 'flask', 9 | 'click', 10 | 'Flask', 11 | 'inquirer', 12 | # 'sqlite3', 13 | 'flask_migrate', 14 | 'flask_sqlalchemy', 15 | # 'mysql-connector-python', 16 | # 'psycopg2', 17 | # 'pymongo', 18 | ] 19 | 20 | setup( 21 | name='flask-wiz', 22 | version='1.9.9.2', 23 | author='Krish Soni', 24 | packages=find_packages(), 25 | include_package_data=True, 26 | install_requires=dependencies, 27 | entry_points={ 28 | 'console_scripts': [ 29 | 'flask-wiz=flask_wiz.cli:cli', 30 | ], 31 | }, 32 | long_description=long_description, 33 | long_description_content_type="text/markdown", 34 | ) -------------------------------------------------------------------------------- /wiz.py: -------------------------------------------------------------------------------- 1 | import os 2 | import click 3 | import inquirer 4 | from flask import Flask, render_template 5 | from flask_sqlalchemy import SQLAlchemy 6 | from flask_migrate import Migrate 7 | from typing import List, Dict, Any 8 | import subprocess 9 | 10 | db_options = ['pymongo', 'sqlite3', 'pymysql','psycopg2-binary'] 11 | frontend_options = ['React.Js', 'Vue.Js', 'Next.Js', 'Angular.Js'] 12 | 13 | def display_options(message: str, choices: List[str]) -> str: 14 | """ 15 | Presents an interactive List of options to the user. 16 | 17 | Args: 18 | message (str): The message to display to the user. 19 | choices (dict): A dictionary of options to display. 20 | 21 | Returns: 22 | str: The selected option or None if the user cancels. 23 | """ 24 | 25 | questions = [ 26 | inquirer.List('option', 27 | message=message, 28 | choices=choices), 29 | ] 30 | answers = inquirer.prompt(questions) 31 | if answers and 'option' in answers: 32 | return answers['option'] 33 | return None 34 | 35 | 36 | def create_app(): 37 | app = Flask(__name__) 38 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' 39 | db.init_app(app) 40 | return app 41 | 42 | @click.group() 43 | def cli(): 44 | pass 45 | 46 | @cli.command() 47 | def new(): 48 | while True: 49 | name = click.prompt('Enter project name') 50 | if os.path.exists(name): 51 | click.echo(f"Project {name} already exists. Choose another name.") 52 | else: 53 | break 54 | 55 | frontend_choice = click.confirm("Do you need a frontend framework?") 56 | 57 | if frontend_choice: 58 | frontend_framework = display_options("Select a framework:", frontend_options) 59 | else: 60 | frontend_framework = None 61 | 62 | db_module = display_options("Select a database system:", db_options) 63 | 64 | os.makedirs(name) 65 | os.chdir(name) 66 | 67 | # Create server directory and setup backend 68 | os.makedirs('server') 69 | os.chdir('server') 70 | 71 | db_uri = "" 72 | 73 | if db_module == 'pymongo' : 74 | db_uri = "'mongodb://localhost:27017/my_database'" 75 | elif db_module == 'sqlite3' : 76 | db_uri = "'sqlite:///database.db'" 77 | elif db_module == 'pymysql' : 78 | db_uri = "'mysql+pymysql://root:password@localhost/my_database'" 79 | elif db_module == 'psycopg2-binary' : 80 | db_uri = "'postgresql://postgres:password@localhost/my_database'" 81 | 82 | with open('app.py', 'w') as app_file: 83 | if db_module == 'pymongo': 84 | app_file.write(f""" 85 | from flask import Flask, render_template 86 | from pymongo import MongoClient 87 | 88 | app = Flask(__name__) 89 | mongo_uri = {db_uri} 90 | client = MongoClient(mongo_uri) 91 | db = client.get_default_database() 92 | 93 | @app.route('/') 94 | def index(): 95 | return "Welcome to the Flask app!" 96 | 97 | if __name__ == '__main__': 98 | app.run() 99 | """) 100 | 101 | else: 102 | app_file.write(f""" 103 | from flask import Flask, render_template 104 | from flask_sqlalchemy import SQLAlchemy 105 | from flask_migrate import Migrate 106 | 107 | app = Flask(__name__) 108 | app.config['SQLALCHEMY_DATABASE_URI'] = {db_uri} 109 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 110 | 111 | db = SQLAlchemy(app) 112 | migrate = Migrate(app, db) 113 | 114 | @app.route('/') 115 | def index(): 116 | return "Welcome to the Flask app!" 117 | 118 | if __name__ == '__main__': 119 | app.run() 120 | """) 121 | 122 | with open('requirements.txt', 'w') as req_file: 123 | req_file.write("flask\nflask_sqlalchemy\nflask_migrate\ngunicorn\n") 124 | if db_module and db_module != 'sqlite3': 125 | req_file.write(f"{db_module}\n") 126 | 127 | os.chdir('..') 128 | 129 | with open('README.md', 'w') as readme_file: 130 | readme_file.write(f"# {name}\n\nThis is a Flask project with {db_module} as the database.\n") 131 | 132 | if frontend_framework: 133 | os.makedirs('client') 134 | os.chdir('client') 135 | click.echo(f"Setting up {frontend_framework}...") 136 | if frontend_framework == 'React.Js': 137 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "react"], shell=True, check=True) 138 | elif frontend_framework == 'Vue.Js': 139 | subprocess.run(["npm", "create", "vite@latest", ".", "--", "--template", "vue"], shell=True, check=True) 140 | elif frontend_framework == 'Next.Js': 141 | subprocess.run(["npx", "create-next-app@latest", "."], shell=True, check=True) 142 | elif frontend_framework == 'Angular.Js': 143 | try: 144 | subprocess.run(["ng", "--version"], shell=True, check=True) 145 | except subprocess.CalledProcessError: 146 | click.echo("Angular CLI is not found. Installing globally...") 147 | subprocess.run(["npm", "install", "-g", "@angular/cli"], shell=True, check=True) 148 | 149 | os.chdir('..') 150 | os.removedirs("client") 151 | subprocess.run(["ng", "new", "client"], shell=True, check=True) 152 | 153 | click.echo(f"{frontend_framework} setup complete.") 154 | os.chdir('..') 155 | 156 | click.echo(f"Project {name} created successfully!") 157 | click.echo("\nTo start the server, run:") 158 | click.echo(f"""\ncd {name}/server 159 | pip install -r .\\requirements.txt 160 | python app.py""") 161 | if frontend_framework: 162 | click.echo(f"\nTo start the client, run:") 163 | click.echo(f"""\ncd {name}/client 164 | npm install 165 | npm run dev""") 166 | 167 | 168 | if __name__ == '__main__': 169 | cli() --------------------------------------------------------------------------------