CLI to scaffold PostPipe Appointment System
npm install create-postpipe-appointmentmongoose, zod) automatically.
bash
npx create-postpipe-appointment
`
What it does
1. Prompts you to confirm the database (currently supports MongoDB).
2. Copies the following files to your project:
- lib/models/Appointment.ts: The Mongoose model.
- lib/actions/appointment.ts: Server actions for form submissions.
- lib/dbConnect.ts: MongoDB connection utility (if not present).
- app/api/appointment/route.ts: API route handler.
3. Installs required dependencies: mongoose, zod.
4. Configures your .env file with a placeholder DATABASE_URI.
Usage
After running the CLI, you can use the generated Server Actions in your components:
`tsx
"use client";
import { useFormState } from "react-dom";
import { createAppointment } from "@/lib/actions/appointment";
export default function AppointmentForm() {
const [state, formAction] = useFormState(createAppointment, {
message: "",
success: false,
});
return (
);
}
``