Package Exports
- create-precast-app
- create-precast-app/package.json
Readme
create-precast-app
CLI tool for scaffolding full-stack web applications with modern frameworks and tools.
Features
- Multi-framework support - React, Vue, Angular, Next.js, Nuxt, Svelte, Solid, Remix, Astro, Vite, and Vanilla JS
- Backend integration - Express, Fastify, Hono, NestJS, Koa, or Next.js API Routes
- Database setup - PostgreSQL, MySQL, MongoDB, SQLite with Prisma or Drizzle ORM
- Authentication - Auth.js or Better Auth with social providers
- UI libraries - Shadcn/ui, DaisyUI, Material UI, Chakra UI, Ant Design
- Claude Code integration - Automatic .claude folder setup with project-specific configurations
- Smart package manager handling - Detects and handles Bun compatibility issues automatically
Quick Start
# Interactive mode
npx create-precast-app@latest
# With options
npx create-precast-app my-app --framework react --backend express --database postgres
# Skip all prompts with defaults
npx create-precast-app my-app -y
Available Options
Frameworks
react
- React 18 with Vitevue
- Vue 3 with Viteangular
- Angular 17+next
- Next.js 14 App Routernuxt
- Nuxt 3svelte
- SvelteKitsolid
- SolidJSremix
- Remixastro
- Astrovite
- Vanilla Vitevanilla
- Vanilla JavaScript/TypeScript
Backends
express
- Express.js serverfastify
- Fastify serverhono
- Hono servernestjs
- NestJS frameworkkoa
- Koa servernextjs-api
- Next.js API Routesnone
- Frontend only
Databases
postgres
- PostgreSQLmysql
- MySQLmongodb
- MongoDBsqlite
- SQLitenone
- No database
ORMs
prisma
- Prisma ORM (SQL databases + MongoDB)drizzle
- Drizzle ORM (SQL databases)none
- No ORM
Styling
tailwind
- Tailwind CSScss
- Plain CSSscss
- SCSS/Sass
UI Libraries
shadcn
- shadcn/ui componentsdaisyui
- DaisyUI componentsmui
- Material UIchakra
- Chakra UIant
- Ant Designnone
- No UI library
Authentication
auth.js
- Auth.js (NextAuth v5)better-auth
- Better Authnone
- No authentication
Additional Options
--typescript
/--no-typescript
- TypeScript support (default: true)--git
/--no-git
- Initialize git repository (default: true)--install
/--no-install
- Install dependencies after creation--ai
- Include AI context files (.claude, cursor, etc)--docker
- Include Docker configuration--eslint
- Add ESLint configuration--prettier
- Add Prettier configuration--mcp
- Add Model Context Protocol configuration--pm <manager>
- Package manager (npm, yarn, pnpm, bun)-y, --yes
- Skip prompts and use defaults
Command Line Usage
# Create a new project
create-precast-app [project-name] [options]
# Add features to existing project
create-precast-app add [feature] [options]
# Show version
create-precast-app --version
# Show help
create-precast-app --help
Project Structure
packages/cli/
├── src/
│ ├── commands/ # CLI commands (init, add)
│ ├── generators/ # Framework generators
│ ├── templates/ # Handlebars templates
│ ├── utils/ # Utilities (auth, package manager, etc)
│ └── cli.ts # Main entry point
├── tests/ # Vitest test files
├── dist/ # Built output
└── package.json
Database Configuration
When you select a database, the CLI:
- Validates ORM compatibility
- Generates connection configuration in
.env.example
- Adds required dependencies
- Creates configuration files (Prisma schema, Drizzle config, etc.)
- Sets up Docker Compose (if Docker enabled)
Example: PostgreSQL with Prisma
Generated files include:
.env.example
withDATABASE_URL
docker-compose.yml
for local development- Database scripts in
package.json
:db:generate
- Generate Prisma clientdb:migrate
- Run migrationsdb:push
- Push schema changesdb:studio
- Open Prisma Studio
Database Setup
# Using Docker (recommended)
docker-compose up -d
npm run db:migrate
# Using local database
# 1. Install your database
# 2. Update DATABASE_URL in .env
# 3. Run migrations
Testing
Running Tests
# Build the CLI
bun run build
# Run all tests
bun test
# Generate test combinations
bun smart-test-generator.ts
# Run tests with coverage
bun test --coverage
Test Coverage
The test suite covers:
- All framework combinations
- Database and ORM compatibility
- TypeScript/JavaScript generation
- Styling options
- Authentication setups
- UI library integrations
- Package manager handling
Development
Building from Source
# Clone the repository
git clone https://github.com/BuunGroupCore/precast-app.git
cd precast-app/packages/cli
# Install dependencies
bun install
# Build the CLI
bun run build
# Test locally
./dist/cli.js init test-project
Adding New Frameworks
- Create a generator file in
src/generators/[framework]-template.ts
- Add templates in
src/templates/frameworks/[framework]/
- Update framework definitions in
shared/stack-config.ts
- Add tests for the new framework
Template System
Handlebars Helpers
{{#if typescript}}
// TypeScript code
{{else}}
// JavaScript code
{{/if}}
{{#if (eq database "postgres")}}
DATABASE_URL=postgresql://...
{{/if}}
{{#ifAny (eq backend "express") (eq backend "fastify")}}
// Server code
{{/ifAny}}
Available Helpers
eq
- Equality checkand
,or
,not
- Logical operatorsincludes
- Array includesifAny
,ifAll
- Multiple conditionscapitalize
- Capitalize stringkebabCase
- Convert to kebab-case
Contributing
Contributions are welcome! Please ensure all tests pass before submitting a pull request.
License
MIT
Package Manager Support
The CLI automatically detects your preferred package manager and handles compatibility issues:
- Bun - Uses
--ignore-scripts
flag to avoid postinstall script failures - npm - Standard npm with automatic vulnerability fixing
- Yarn - Classic Yarn support
- pnpm - Efficient disk space usage
Bun Compatibility
When using Bun, the CLI automatically adds --ignore-scripts
to avoid issues with packages that have postinstall scripts (like esbuild, prisma, sharp). This ensures smooth installation without manual intervention.
Claude Code Integration
Every generated project includes:
.claude/settings.json
- Project-specific permissions and configurationCLAUDE.md
- Comprehensive project context for Claude- MCP configuration for enhanced Claude Code features
- Framework-specific permissions (e.g., WebFetch for documentation sites)
Troubleshooting
Installation Issues
If you encounter installation errors:
- With Bun: The CLI automatically uses
--ignore-scripts
. If issues persist, try using npm instead. - Permission errors: Run with
sudo
on Unix systems or as Administrator on Windows - Network issues: Check your internet connection and proxy settings
Common Issues
- "Command not found": Ensure npx is installed or install globally with
npm i -g create-precast-app
- Template errors: Update to the latest version with
npm update create-precast-app
- Database connection: Ensure Docker is running if using containerized databases