mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-07 03:59:35 +00:00
33751e1515
- Added comprehensive documentation for the TypeScript JSON Abstraction Pattern, detailing its architecture, benefits, and practical use cases. - Included examples of JSON input and corresponding TypeScript output, along with compiler implementation sketches. feat: Enhance RootLayout to load header and footer packages - Modified RootLayout to asynchronously load header and footer packages using the unified package loader. - Rendered header and footer conditionally based on package metadata availability. refactor: Update package-glue structure and imports - Refactored package-glue exports to streamline imports and improve organization. - Removed deprecated package-loader module and adjusted related imports accordingly. fix: Correct package catalog imports in loader functions - Updated import paths in various loader functions to reference the core package catalog correctly. chore: Introduce unified package loader for better package management - Created a unified package loader to handle loading packages from both filesystem JSON and legacy in-memory catalog. - Implemented functions to load single and all packages, check package existence, and list package IDs. feat: Add minimal declarative component renderer - Introduced a lightweight declarative component registry to facilitate package component loading. - Implemented functions for loading, retrieving, and listing registered components.
Source Code (src/)
This directory contains the main React application source code for MetaBuilder's frontend.
Structure
- components/ - React UI components organized by feature and level
- lib/ - Utility libraries, database access, authentication, and business logic
- hooks/ - Custom React hooks for state management and side effects
- types/ - TypeScript type definitions
- styles/ - Global stylesheets (SCSS)
- tests/ - Component and unit tests
- seed-data/ - Initial database population scripts
Key Files
main.tsx- Application entry pointApp.tsx- Main application component with 5-level architecture logicindex.scss- Global styles (imports all component styles)
Architecture
The application uses a 5-level permission system:
- Level 1 (Public) - Unauthenticated access
- Level 2 (User) - Basic authenticated user
- Level 3 (Admin) - Administrative functions
- Level 4 (God) - Advanced system functions
- Level 5 (Supergod) - Complete system control
Permission checking is handled in lib/auth.ts and enforced throughout the component hierarchy.
Technologies
- React 18+ - UI framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Prisma ORM - Database access
- Shadcn/ui - UI component library
- Vite - Build tool
Development
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run tests
npm run test
Database
The application uses Prisma ORM with SQLite/PostgreSQL. Database schema is defined in prisma/schema.prisma and migrations are managed through prisma/migrations/.
Adding New Features
- Define data model in
prisma/schema.prisma - Create Prisma migration:
npm run db:migrate - Build components in
components/ - Implement business logic in
lib/ - Add permissions check via
canAccessLevel() - Test at appropriate permission levels
See /docs/ for comprehensive development guides.