generate-project Command
Interface
The command creates a new Pinstripe project with the following signature:
pinstripe generate-project <name> [--with <dependencies>]
Parameters
name(required) - The name of the project to create--with <dependencies>(optional) - Additional space-separated dependencies to include alongsidepinstripe
Examples
# Create a basic project
pinstripe generate-project my-blog
# Create a project with additional dependencies
pinstripe generate-project my-app --with "@blognami/main @blognami/pages"
# Create a project with multiple dependencies
pinstripe generate-project e-commerce --with "@blognami/main @blognami/posts @blognami/tags"
Description
The generate-project command is a project scaffolding tool that creates a complete Pinstripe application with:
- Project structure - Creates directory structure with
lib/folder - Package configuration - Generates
package.jsonwith ES module settings - Pinstripe configuration - Sets up
pinstripe.config.jswith database and mail configurations - Entry point - Creates
lib/index.jswith imports and initialization - Documentation - Generates basic
README.md - Dependency installation - Automatically runs
npm install - Project initialization - Runs
pinstripe initialize-projectto complete setup
Generated Project Structure
project-name/
├── package.json # NPM package configuration
├── pinstripe.config.js # Pinstripe application configuration
├── README.md # Basic documentation
├── lib/
│ └── index.js # Main entry point
├── development.db # SQLite database (created after initialization)
└── node_modules/ # Installed dependencies
Key Features
Automatic Dependency Management
- Always includes
pinstripeas a core dependency - Accepts additional dependencies via
--withparameter - Prevents duplicate dependencies in the dependency list
- Runs
npm installautomatically after generating files
Environment-Specific Configuration
- Development: Uses SQLite database and dummy mail adapter
- Production: Configured for MySQL database and SMTP mail delivery
- Environment detection via
NODE_ENVenvironment variable
Database Configuration
// Development (default)
database: {
adapter: 'sqlite',
filename: 'development.db'
}
// Production
database: {
adapter: 'mysql',
host: 'localhost',
user: 'root',
password: '',
database: 'project_name_production'
}
Mail Configuration
// Development (default)
mail: {
adapter: 'dummy' // No actual emails sent
}
// Production
mail: {
adapter: 'smtp',
host: "smtp.example.com",
port: 465,
secure: true,
auth: {
user: "username",
pass: "password"
}
}
Common Dependency Combinations
Blog Projects
# Minimal blog
--with "@blognami/main @blognami/posts"
# Blog with pages and tags
--with "@blognami/main @blognami/posts @blognami/pages @blognami/tags"
# Full-featured blog with documentation
--with "@blognami/main @blognami/posts @blognami/pages @blognami/tags"
Application Projects
# Basic web application
--with "@blognami/main @pinstripe/static-site"
# Multi-tenant application
--with "@blognami/main @pinstripe/multi-tenant"
# Application with utilities and database features
--with "@blognami/main @pinstripe/utils @pinstripe/database"
Related Commands
initialize-project- Sets up database and project structure (run automatically)generate-service- Add business logic services to the projectgenerate-view- Add web views and controllersgenerate-command- Add CLI commands to the projectgenerate-background-job- Add scheduled tasks and jobsstart-server- Start the development or production serverinitialize-database- Set up database schema and initial data