backend-craft-wizard
v1.0.1
Published
Backend-Craft-Wizard is a JavaScript tool designed to automate and streamline backend project generation based on contextual data samples.
Downloads
11
Maintainers
Readme
Backend-Craft-Wizard
Backend-Craft-Wizard is a Node.js tool designed to automate and streamline backend project generation based on contextual data samples and predefined types. It simplifies the process of creating backend structures by generating necessary files and directories, tailored to your project's needs. This tool helps you quickly set up a FastAPI or Node.js Express backend with MongoDB, complete with models, routes, services, controllers, and configuration files.
Features
- Automatic Backend Project Generation: Create backend projects with FastAPI or Node.js Express and MongoDB configurations based on sample data and predefined types.
- Dynamic File Generation: Automatically generates models, controllers, services, routes, and config files based on provided types and sample data.
- Structured Directory Setup: Automatically creates the necessary directories and files, including
models
,routes
,controllers
,services
, and configuration files. - Seamless Integration: Includes entry points for both FastAPI (
main.py
) and Node.js Express (server.js
) for easy integration and deployment. - Environment Setup: Dynamically creates a Python virtual environment for FastAPI projects, installs dependencies, and starts the server.
- Help Commands: Easily access help and explanations for all available commands.
Installation
You can install Backend-Craft-Wizard globally or locally in your Node.js project using npm or yarn.
Global Installation
npm install -g backend-craft-wizard
or
yarn global add backend-craft-wizard
Local Installation
npm install backend-craft-wizard --save-dev
or
yarn add backend-craft-wizard --dev
Usage
Once installed, you can use the command line interface to generate the necessary files and directories for your backend project.
Command Line Interface
Run the following command to generate the backend project structure and necessary files:
npx server <type-name> <framework> mongodb
- Replace
<type-name>
with one of the type names from the list in the command categories and options section. - Replace
<framework>
with eitherpython-fastapi
for FastAPI ornodejs-express
for Node.js Express.
Project Structure
After running the command, the tool will create the following directory structure:
For FastAPI:
/backend
├── config
│ ├── database.py
│ └── settings.py
├── controllers
│ └── <generated controllers>
├── models
│ └── <generated models>
├── routes
│ └── <generated routes>
├── services
│ └── <generated services>
├── utils
│ └── common_utils.py
├── main.py
├── .env
└── venv
For Node.js Express:
/backend
├── config
│ └── database.js
├── controllers
│ └── <generated controllers>
├── models
│ └── <generated models>
├── routes
│ └── <generated routes>
├── services
│ └── <generated services>
├── utils
│ └── commonUtils.js
├── server.js
├── .env
└── node_modules
backend/config/database.js
: Contains MongoDB connection setup for Node.js Express.backend/config/database.py
: Contains MongoDB connection setup for FastAPI.backend/controllers/
: Holds the controller files, where the logic is handled.backend/models/
: Contains the Mongoose (Node.js) or Pydantic (FastAPI) models generated from your types.backend/routes/
: Holds the Express routes (Node.js) or FastAPI route files.backend/services/
: Contains service files where business logic is managed.backend/utils/commonUtils.js
: Contains common utility functions for Node.js Express.backend/utils/common_utils.py
: Contains common utility functions for FastAPI.backend/server.js
: Entry point for your Node.js Express application.backend/main.py
: Entry point for your FastAPI application.backend/.env
: Environment configuration file.backend/venv/
: Virtual environment directory for Python dependencies.
Command Categories and Options
1. Data Management Types
Generate types and sample data for various data management needs:
dataset-data
: Types and data for datasets.evaluation-metrics
: Types and data for evaluation metrics.interactive-exercises
: Types and data for interactive exercises.learning-progress
: Types and data for tracking learning progress.
2. Financial Management
Generate types and sample data for financial management:
investment-portfolios
: Types and data for investment portfolios.market-trends
: Types and data for market trends.financial-reports
: Types and data for financial reports.
3. Customer and Supply Chain Management
Generate types and sample data for customer and supply chain management:
crm
: Types and data for customer relationship management, including customer details and interaction history.supply-chain-management
: Types and data for managing supply chain aspects like inventory levels and order status.
4. Developer and User Profiles
Generate types and sample data for profiles:
developer-profile
: Types and data for developer profiles.user
: Types and data for user profiles.
5. Health and Nutrition
Generate types and sample data for health and nutrition:
meal-plans
: Types and data for meal plans and dietary restrictions.mental-health
: Types and data for mental health, including therapy session notes and mood tracking.medical-records
: Types and data for medical records.treatment-plans
: Types and data for treatment plans.
6. Media and Entertainment
Generate types and sample data for media and entertainment:
playlist-data
: Types and data for music playlists and streaming metrics.episode-metadata
: Types and data for TV episode metadata and cast data.music-streaming
: Types and data for music streaming metrics.
7. Environment and Agriculture
Generate types and sample data for environmental and agricultural management:
air-quality
: Types and data for air quality monitoring.water-quality
: Types and data for water quality monitoring.weather-data
: Types and data for weather data.soil-data
: Types and data for soil data.farm-activities
: Types and data for farm activities and management.crop-data
: Types and data for crop management.
8. Technology
Generate types and sample data for various technology-related information:
model-data
: Types and data for AI model data.deployment-info
: Types and data for deployment configurations.
9. Media
Generate types and sample data for media:
audio
: Types and data for audio content, including metadata and formats.video
: Types and data for video content, including metadata and formats.image-metadata
: Types and data for image metadata.image-tags
: Types and data for image tags.image-usage
: Types and data for image usage statistics.
10. Event and Education
Generate types and sample data for events and educational purposes:
event
: Types and data for event management, including event details and scheduling.education-game
: Types and data for educational games and their mechanics.
New Command
The following command has been added to generate Node.js Express backends:
npx server <type-name> nodejs-express mongodb
This command allows you to generate a Node.js Express backend with MongoDB, similar to the FastAPI generation feature.
Help Commands
To list all available commands and their explanations:
npx server --help
To get help on a specific command:
npx server <type-name> --help
Contributing
Contributions to Backend-Craft-Wizard are welcome! If you have ideas for improvements or find any issues, please open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For questions or support, please reach out to [email protected].