create-push-universal-app
v1.0.0
Published
CLI tool to scaffold Push Chain universal applications with Next.js or Vite
Maintainers
Readme
Create Push App
A CLI tool to scaffold Push Chain applications with your choice of framework and tooling.
Quick Start
npm install -g create-push-app
create-push-app my-appOr use npx:
npx create-push-app my-appFeatures
- ⚡ Multiple Frameworks: Choose between Next.js or Vite (React)
- 🎨 UI Components: Optional shadcn/ui integration
- 🔧 ESLint: Optional code linting setup
- 📦 Push Chain Integration: Pre-configured with @pushchain/core and @pushchain/ui-kit
- 🚀 TypeScript: Full TypeScript support out of the box
Usage
Interactive Mode
Run the CLI without arguments to enter interactive mode:
create-push-appYou'll be prompted to:
- Choose your project name
- Select a framework (Next.js or Vite)
- Enable/disable ESLint
- Enable/disable shadcn/ui
Command Line Options
create-push-app my-app --framework nextjs --eslint --shadcnAvailable options:
-f, --framework <framework>: Choose 'nextjs' or 'vite'--eslint / --no-eslint: Include/exclude ESLint configuration--shadcn / --no-shadcn: Include/exclude shadcn/ui components
Generated Project Structure
Next.js Project
my-app/
├── src/
│ ├── app/
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/
│ │ ├── ui/ # shadcn components (if enabled)
│ │ └── push-chain-demo.tsx
│ └── lib/
│ ├── pushchain.tsx # Push Chain provider
│ └── utils.ts # Utility functions
├── package.json
├── next.config.js
├── tsconfig.json
└── tailwind.config.js # (if shadcn enabled)Vite Project
my-app/
├── src/
│ ├── components/
│ │ ├── ui/ # shadcn components (if enabled)
│ │ └── push-chain-demo.tsx
│ ├── lib/
│ │ ├── pushchain.tsx # Push Chain provider
│ │ └── utils.ts # Utility functions
│ ├── App.tsx
│ ├── main.tsx
│ └── index.css
├── index.html
├── package.json
├── vite.config.ts
├── tsconfig.json
└── tailwind.config.js # (if shadcn enabled)Push Chain Integration
The generated project includes:
1. PushChain Provider
A React context provider that manages the Push Chain connection:
import { usePushChain } from '@/lib/pushchain'
function MyComponent() {
const { pushChain, isConnected, connect, disconnect, error } = usePushChain()
// Use Push Chain methods here
}2. Demo Component
A working example showing how to:
- Connect to Push Chain
- Send messages
- Handle errors
- Display connection status
3. Environment Variables
Configure your Push Chain settings:
# Next.js
NEXT_PUBLIC_PUSHCHAIN_API_KEY=your_api_key_here
NEXT_PUBLIC_PUSHCHAIN_NETWORK=testnet
# Vite
VITE_PUSHCHAIN_API_KEY=your_api_key_here
VITE_PUSHCHAIN_NETWORK=testnetDevelopment
To work on this CLI tool:
git clone <repository>
cd create-push-app
npm install
npm run build
npm linkThen you can test it:
create-push-app test-appScripts
npm run build- Build the CLInpm run dev- Run in development modenpm start- Run the built CLI
Next Steps
After creating your project:
- Configure Environment Variables: Set up your Push Chain API keys
- Customize the Integration: Replace example code with your specific Push Chain functionality
- Add Features: Build upon the generated structure
- Explore Push Chain: Check out the @pushchain/ui-kit for additional components
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
