@voltx/cli
v0.4.7
Published
VoltX CLI — dev server, build, start, generate, and scaffolding
Maintainers
Readme
Command-line tools for the VoltX framework. Full-stack dev server (Vite + Hono), production build with SSR, code generation, and project scaffolding.
Installation
npm install @voltx/cliCommands
Development
voltx dev # Start Vite dev server with HMR + backend
voltx build # Build for production (client + SSR + server)
voltx start # Start production servervoltx dev starts a single process that serves both the React frontend and Hono API backend with hot module replacement. No separate frontend/backend servers needed.
Create a New Project
voltx create my-app
voltx create my-app --template chatbot
voltx create my-app --template agent-app --shadcn
voltx create my-app --template rag-app --auth jwtFor the full interactive experience with tool selection, RAG toggle, shadcn/ui, and API key management, use
npx create-voltx-appinstead.
Code Generation
voltx generate route api/users # New API route
voltx generate agent assistant # New agent definition
voltx generate tool search # New tool for agentsBuild Pipeline
voltx build runs a 3-phase build when SSR is detected:
- Client build — Vite builds
src/entry-client.tsx→dist/client/ - SSR build — Vite builds
src/entry-server.tsx→dist/server/ - Server build — tsup bundles
server.ts→dist/index.js
Falls back to a 2-phase build (client + server) if no src/entry-server.tsx exists.
Project Structure
All templates generate a full-stack project with file-based routing:
my-app/
├── api/ # Backend API routes (auto-discovered via voltx/api)
│ ├── index.ts # GET /api — health check
│ ├── chat.ts # POST /api/chat (chatbot/agent-app)
│ └── agent.ts # POST /api/agent (agent-app)
├── src/
│ ├── pages/ # Frontend pages (auto-discovered via voltx/router)
│ │ └── index.tsx # / — home page
│ ├── layout.tsx # Root layout wrapper
│ ├── globals.css # Tailwind CSS v4
│ ├── entry-client.tsx # Client hydration
│ ├── entry-server.tsx # SSR rendering
│ ├── voltx-env.d.ts # Type declarations for voltx/router & voltx/api
│ ├── components/ # React components
│ ├── hooks/ # Custom hooks
│ └── lib/ # Utilities (cn() if shadcn enabled)
├── agents/ # AI agents (agent-app)
├── tools/ # Agent tools (agent-app)
├── public/ # Static assets (favicon, robots.txt, manifest)
├── server.ts # Hono app entry
├── vite.config.ts # Vite + Tailwind + voltxRouter() + voltxAPI()
├── components.json # shadcn/ui config (if enabled)
├── voltx.config.ts # VoltX config
└── tsconfig.json # TypeScript (with @/* path alias)What's Included
- File-based page routing —
src/pages/*.tsxauto-discovered viavoltxRouter()Vite plugin - File-based API routing —
api/**/*.tsauto-discovered viavoltxAPI()Vite plugin - Navigation —
Link,NavLink,useNavigate,useParamsfromvoltx/router - Tailwind CSS v4 — native Vite plugin, no PostCSS config needed
- Path aliases —
@/*maps tosrc/*in both TypeScript and Vite - shadcn/ui (optional) —
--shadcnflag pre-configurescomponents.json,cn()utility, and CSS variables - React SSR — streaming server-side rendering via
@voltx/server - Auto .env loading —
@voltx/coreloads.envfiles automatically
Programmatic Usage
import { createProject } from "@voltx/cli";
await createProject({
name: "my-app",
template: "chatbot",
auth: "jwt",
shadcn: true,
});Part of VoltX
This package is part of the VoltX framework. See the monorepo for full documentation.
License
MIT — Made by the Promptly AI Team
