A full-stack web application that allows users to dynamically create database tables through an intuitive interface and perform CRUD operations on the generated tables in real-time.
- Visual Schema Builder: Create tables using an intuitive web interface
- Type-Safe Columns: Support for string, integer, decimal, boolean, text, date, datetime, and JSON types
- Column Constraints: Configure nullable fields, default values, and validation rules
- Real-time Validation: Instant feedback on schema validation and naming constraints
- Full CRUD Operations: Create, read, update, and delete records
- Advanced Search: Text search across multiple columns
- Pagination: Efficient data browsing with configurable page sizes
- Sorting: Sort by any column in ascending or descending order
- Responsive Tables: Mobile-friendly data display
- Table Registry: View all created tables with metadata
- Table Deletion: Remove tables and associated data safely
- Column Overview: Preview table structure and column types
- Creation Timestamps: Track when tables were created and modified
- SQL Injection Protection: Parameterized queries and input sanitization
- Schema Validation: Strict naming patterns and type checking
- Error Handling: Comprehensive error management with user-friendly messages
- Reserved Name Protection: Prevents conflicts with system columns
- RESTful API: Clean endpoint design following REST principles
- Metadata Registry: JSON-based table definitions stored in MySQL
- Dynamic DDL Generation: Automatic SQL table creation from metadata
- Query Builder: Type-safe database operations using Knex.js
- Modern React: Hooks-based architecture with functional components
- State Management: React Query for server state and caching
- Responsive Design: Mobile-first CSS with modern styling
- Client-side Routing: Single-page application with React Router
- Connection Pooling: Optimized database connections
- JSON Column Support: Native JSON storage for table metadata
- Auto-generated Tables: Dynamic table creation with consistent schema
- Node.js 18.0 or higher
- MySQL 8.0 or higher
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/ShikharSingh-GitHub/dynamic-table-builder.git cd dynamic-table-builder -
Install dependencies
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
-
Configure environment
# Copy environment template cd ../backend cp .env.example .env
Edit
.envwith your database credentials:MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=dynamic_table PORT=4000
-
Setup database
CREATE DATABASE dynamic_table;
-
Start the application
# Terminal 1: Start backend cd backend npm start # Terminal 2: Start frontend cd frontend npm run dev
-
Open your browser Navigate to
http://localhost:5173
| Method | Endpoint | Description |
|---|---|---|
GET |
/provision/tables |
List all created tables |
POST |
/provision/table |
Create a new table |
DELETE |
/provision/table/:name |
Delete a table |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/:table |
List records with pagination/search |
GET |
/api/:table/:id |
Get a specific record |
POST |
/api/:table |
Create a new record |
PUT |
/api/:table/:id |
Update a record |
DELETE |
/api/:table/:id |
Delete a record |
curl -X POST http://localhost:4000/provision/table \
-H "Content-Type: application/json" \
-d '{
"tableName": "users",
"columns": [
{
"name": "first_name",
"type": "string",
"nullable": false,
"default": ""
},
{
"name": "email",
"type": "string",
"nullable": false
},
{
"name": "age",
"type": "integer",
"nullable": true
},
{
"name": "is_active",
"type": "boolean",
"nullable": false,
"default": true
}
]
}'dynamic-table-builder/
βββ backend/ # Node.js API server
β βββ src/
β β βββ routes/ # API endpoints
β β βββ services/ # Business logic
β β βββ utils/ # Helper functions
β β βββ middleware/ # Express middleware
β βββ package.json
βββ frontend/ # React application
β βββ src/
β β βββ pages/ # React components
β β βββ hooks/ # Custom React hooks
β β βββ api/ # API client
β βββ package.json
βββ ARCHITECTURE_DOCUMENTATION.md
βββ README.md
npm start # Start production server
npm run dev # Start development server with nodemon
npm test # Run testsnpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLintRun the comprehensive Postman collection for API testing:
- Import
POSTMAN_API_TESTING_GUIDE.mdinto Postman - Set up environment variables
- Execute the test collection
| Variable | Description | Default |
|---|---|---|
MYSQL_HOST |
MySQL server host | localhost |
MYSQL_PORT |
MySQL server port | 3306 |
MYSQL_USER |
Database username | - |
MYSQL_PASSWORD |
Database password | - |
MYSQL_DATABASE |
Database name | dynamic_table |
PORT |
Backend server port | 4000 |
The application automatically creates a table_registry table to store metadata:
CREATE TABLE table_registry (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
table_name VARCHAR(30) UNIQUE NOT NULL,
definition JSON NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Node.js and Express
- Frontend powered by React and Vite
- Database operations with Knex.js
- Styling with modern CSS and custom utilities
- State management with TanStack Query
Shikhar Singh - @ShikharSingh-GitHub
Project Link: https://github.com/ShikharSingh-GitHub/dynamic-table-builder
β Star this repository if you find it helpful!