A powerful, modern web application for creating and managing database schemas with automatic code generation. Build schemas visually or through JSON, and instantly generate TypeScript interfaces, Zod validation schemas, and database models.
- Visual Schema Builder: Intuitive drag-and-drop interface for creating database schemas
- JSON Editor: Monaco-powered code editor for direct schema definition
- Multi-Format Support: Generate code for both NoSQL (MongoDB/Mongoose) and SQL databases
- Type Safety: Automatic TypeScript interface generation with proper typing
- Validation: Zod schema generation with smart defaults and custom validation rules
- Real-time Preview: Instant code generation as you build your schema
- Field Types: Support for strings, numbers, booleans, dates, arrays, and nested objects
- Advanced Validation: Min/max values, regex patterns, unique constraints, and default values
- Modern UI: Built with Tailwind CSS and Radix UI components
- Framework: Next.js 13.5.1 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI primitives
- Code Editor: Monaco Editor
- Form Handling: React Hook Form with Zod validation
- Icons: Lucide React
- Node.js 18+
- npm or yarn package manager
- Clone the repository:
git clone <repository-url>
cd schema-builder- Install dependencies:
npm install- Start the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run build
npm start- Click the "Form Builder" tab
- Enter a schema name (e.g., "User", "Product")
- Add fields using the "Add Field" button
- Configure each field:
- Name: Field identifier
- Type: string, number, boolean, date, array, or object
- Required: Whether the field is mandatory
- Unique: Whether the field must be unique
- Validation: Min/max values, regex patterns, default values
- Click the "Code Editor" tab
- Write your schema in JSON format:
{
"name": "User",
"fields": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true,
"validation": {
"regex": "^[^@]+@[^@]+\\.[^@]+$"
}
},
{
"name": "age",
"type": "number",
"required": false,
"validation": {
"min": 0,
"max": 120
}
}
]
}The application automatically generates:
- Zod Schema: For runtime validation
- TypeScript Interface: For type safety
- Database Model: MongoDB/Mongoose or SQL schema
string: Text data with optional regex validationnumber: Numeric data with min/max constraintsboolean: True/false valuesdate: Date/timestamp fieldsarray: Arrays with typed elementsobject: Nested object structures
min: Minimum value/lengthmax: Maximum value/lengthregex: Regular expression pattern (strings only)default: Default valuerequired: Whether field is mandatoryunique: Whether field must be unique
interface Schema {
name: string;
fields: Field[];
}
interface Field {
name: string;
type: "string" | "number" | "boolean" | "date" | "array" | "object";
required: boolean;
unique?: boolean;
validation?: ValidationOptions;
arrayType?: "string" | "number" | "boolean" | "date" | "object";
objectFields?: Field[];
}- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
npm run dev: Start development servernpm run build: Build for productionnpm run start: Start production servernpm run lint: Run ESLint
This project is licensed under the MIT License.
For support and questions, please open an issue on GitHub.