create-lego-one 2.0.10 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +179 -0
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -3
- package/template/.cursor/rules/rules.mdc +639 -0
- package/template/.dockerignore +58 -0
- package/template/.env.example +18 -0
- package/template/.eslintignore +5 -0
- package/template/.eslintrc.js +28 -0
- package/template/.prettierignore +6 -0
- package/template/.prettierrc +11 -0
- package/template/CLAUDE.md +634 -0
- package/template/Dockerfile +67 -0
- package/template/PROMPT.md +457 -0
- package/template/README.md +325 -0
- package/template/docker-compose.yml +48 -0
- package/template/docker-entrypoint.sh +23 -0
- package/template/docs/checkpoints/.template.md +64 -0
- package/template/docs/checkpoints/framework/01-infrastructure-setup.md +132 -0
- package/template/docs/checkpoints/framework/02-pocketbase-setup.md +155 -0
- package/template/docs/checkpoints/framework/03-host-kernel.md +170 -0
- package/template/docs/checkpoints/framework/04-auth-system.md +163 -0
- package/template/docs/checkpoints/framework/phase-05-multitenancy-rbac.md +223 -0
- package/template/docs/checkpoints/framework/phase-06-ui-components.md +260 -0
- package/template/docs/checkpoints/framework/phase-07-communication-system.md +276 -0
- package/template/docs/checkpoints/framework/phase-08-plugin-system.md +91 -0
- package/template/docs/checkpoints/framework/phase-09-dashboard-plugin.md +111 -0
- package/template/docs/checkpoints/framework/phase-10-todo-plugin.md +169 -0
- package/template/docs/checkpoints/framework/phase-11-testing.md +264 -0
- package/template/docs/checkpoints/framework/phase-12-deployment.md +294 -0
- package/template/docs/checkpoints/framework/phase-13-documentation.md +312 -0
- package/template/docs/framework/plans/00-index.md +164 -0
- package/template/docs/framework/plans/01-infrastructure-setup.md +855 -0
- package/template/docs/framework/plans/02-pocketbase-setup.md +1374 -0
- package/template/docs/framework/plans/03-host-kernel.md +1518 -0
- package/template/docs/framework/plans/04-auth-system.md +1466 -0
- package/template/docs/framework/plans/05-multitenancy-rbac.md +1527 -0
- package/template/docs/framework/plans/06-ui-components.md +1478 -0
- package/template/docs/framework/plans/07-communication-system.md +1106 -0
- package/template/docs/framework/plans/08-plugin-system.md +1179 -0
- package/template/docs/framework/plans/09-dashboard-plugin.md +1137 -0
- package/template/docs/framework/plans/10-todo-plugin.md +1343 -0
- package/template/docs/framework/plans/11-testing.md +935 -0
- package/template/docs/framework/plans/12-deployment.md +896 -0
- package/template/docs/framework/prompts/0-boilerplate-modernjs.md +151 -0
- package/template/docs/framework/research/00-modernjs-audit.md +488 -0
- package/template/docs/framework/research/01-system-blueprint.md +721 -0
- package/template/docs/framework/research/02-data-migration-protocol.md +699 -0
- package/template/docs/framework/research/03-host-setup.md +714 -0
- package/template/docs/framework/research/04-plugin-architecture.md +645 -0
- package/template/docs/framework/research/05-slot-injection-pattern.md +671 -0
- package/template/docs/framework/research/06-cli-strategy.md +615 -0
- package/template/docs/framework/research/07-deployment.md +629 -0
- package/template/docs/framework/research/README.md +282 -0
- package/template/docs/framework/setup/00-index.md +210 -0
- package/template/docs/framework/setup/01-framework-structure.md +308 -0
- package/template/docs/framework/setup/02-development-workflow.md +405 -0
- package/template/docs/framework/setup/03-environment-setup.md +215 -0
- package/template/docs/framework/setup/04-kernel-architecture.md +499 -0
- package/template/docs/framework/setup/05-plugin-system.md +620 -0
- package/template/docs/framework/setup/06-communication-patterns.md +451 -0
- package/template/docs/framework/setup/07-plugin-development.md +582 -0
- package/template/docs/framework/setup/08-component-library.md +658 -0
- package/template/docs/framework/setup/09-data-integration.md +609 -0
- package/template/docs/framework/setup/10-auth-rbac.md +497 -0
- package/template/docs/framework/setup/11-hooks-api.md +393 -0
- package/template/docs/framework/setup/12-components-api.md +665 -0
- package/template/docs/framework/setup/13-deployment-guide.md +566 -0
- package/template/docs/framework/setup/README.md +548 -0
- package/template/host/e2e/auth.spec.ts +38 -0
- package/template/host/e2e/layout.spec.ts +38 -0
- package/template/host/modern.config.ts +19 -0
- package/template/host/package.json +71 -0
- package/template/host/playwright.config.ts +34 -0
- package/template/host/postcss.config.mjs +6 -0
- package/template/host/src/App.tsx +6 -0
- package/template/host/src/bootstrap.tsx +74 -0
- package/template/host/src/global.css +59 -0
- package/template/host/src/index.ts +2 -0
- package/template/host/src/kernel/__tests__/lib-utils.test.ts +32 -0
- package/template/host/src/kernel/__tests__/rbac-hooks.test.tsx +114 -0
- package/template/host/src/kernel/__tests__/rbac-utils.test.ts +108 -0
- package/template/host/src/kernel/auth/ProtectedRoute.tsx +41 -0
- package/template/host/src/kernel/auth/components/LoginForm.tsx +97 -0
- package/template/host/src/kernel/auth/components/LogoutButton.tsx +79 -0
- package/template/host/src/kernel/auth/hooks.ts +174 -0
- package/template/host/src/kernel/auth/index.ts +5 -0
- package/template/host/src/kernel/auth/schemas.ts +27 -0
- package/template/host/src/kernel/auth/service.ts +197 -0
- package/template/host/src/kernel/auth/types.ts +36 -0
- package/template/host/src/kernel/channels/ChannelBus.ts +181 -0
- package/template/host/src/kernel/channels/ChannelProvider.tsx +57 -0
- package/template/host/src/kernel/channels/events.ts +27 -0
- package/template/host/src/kernel/channels/hooks.ts +168 -0
- package/template/host/src/kernel/channels/index.ts +6 -0
- package/template/host/src/kernel/channels/integrations/ToastIntegration.tsx +60 -0
- package/template/host/src/kernel/channels/plugin-hooks.ts +72 -0
- package/template/host/src/kernel/channels/types.ts +112 -0
- package/template/host/src/kernel/components/__tests__/Badge.test.tsx +35 -0
- package/template/host/src/kernel/components/__tests__/Button.test.tsx +63 -0
- package/template/host/src/kernel/components/__tests__/Input.test.tsx +64 -0
- package/template/host/src/kernel/components/index.ts +32 -0
- package/template/host/src/kernel/components/ui/alert.tsx +58 -0
- package/template/host/src/kernel/components/ui/avatar.tsx +47 -0
- package/template/host/src/kernel/components/ui/badge.tsx +35 -0
- package/template/host/src/kernel/components/ui/button.tsx +50 -0
- package/template/host/src/kernel/components/ui/card.tsx +78 -0
- package/template/host/src/kernel/components/ui/dialog.tsx +116 -0
- package/template/host/src/kernel/components/ui/dropdown-menu.tsx +192 -0
- package/template/host/src/kernel/components/ui/index.ts +7 -0
- package/template/host/src/kernel/components/ui/input.tsx +24 -0
- package/template/host/src/kernel/components/ui/label.tsx +21 -0
- package/template/host/src/kernel/components/ui/popover.tsx +28 -0
- package/template/host/src/kernel/components/ui/progress.tsx +25 -0
- package/template/host/src/kernel/components/ui/scroll-area.tsx +45 -0
- package/template/host/src/kernel/components/ui/select.tsx +155 -0
- package/template/host/src/kernel/components/ui/separator.tsx +28 -0
- package/template/host/src/kernel/components/ui/skeleton.tsx +15 -0
- package/template/host/src/kernel/components/ui/switch.tsx +26 -0
- package/template/host/src/kernel/components/ui/table.tsx +116 -0
- package/template/host/src/kernel/components/ui/tabs.tsx +52 -0
- package/template/host/src/kernel/components/ui/toast.tsx +126 -0
- package/template/host/src/kernel/components/ui/toaster.tsx +34 -0
- package/template/host/src/kernel/components/ui/tooltip.tsx +27 -0
- package/template/host/src/kernel/components/ui/use-toast.ts +183 -0
- package/template/host/src/kernel/index.ts +48 -0
- package/template/host/src/kernel/lib/cn.ts +1 -0
- package/template/host/src/kernel/lib/utils.ts +36 -0
- package/template/host/src/kernel/plugins/Slot.tsx +41 -0
- package/template/host/src/kernel/plugins/SlotProvider.tsx +88 -0
- package/template/host/src/kernel/plugins/index.ts +23 -0
- package/template/host/src/kernel/plugins/loader.ts +122 -0
- package/template/host/src/kernel/plugins/schemas.ts +54 -0
- package/template/host/src/kernel/plugins/store.ts +185 -0
- package/template/host/src/kernel/plugins/types.ts +103 -0
- package/template/host/src/kernel/providers/PocketBaseProvider.tsx +70 -0
- package/template/host/src/kernel/providers/QueryProvider.tsx +28 -0
- package/template/host/src/kernel/providers/ThemeProvider.tsx +25 -0
- package/template/host/src/kernel/providers/index.ts +3 -0
- package/template/host/src/kernel/rbac/components/OrganizationSelector.tsx +69 -0
- package/template/host/src/kernel/rbac/components/PermissionGate.tsx +43 -0
- package/template/host/src/kernel/rbac/hooks.ts +379 -0
- package/template/host/src/kernel/rbac/index.ts +6 -0
- package/template/host/src/kernel/rbac/service.ts +504 -0
- package/template/host/src/kernel/rbac/types.ts +164 -0
- package/template/host/src/kernel/rbac/utils.ts +34 -0
- package/template/host/src/kernel/shared-state/bridge.ts +31 -0
- package/template/host/src/kernel/shared-state/index.ts +3 -0
- package/template/host/src/kernel/shared-state/store.ts +62 -0
- package/template/host/src/kernel/shared-state/types.ts +60 -0
- package/template/host/src/kernel/use-migrations.ts +72 -0
- package/template/host/src/layout/MobileMenu.tsx +61 -0
- package/template/host/src/layout/Shell.tsx +42 -0
- package/template/host/src/layout/Sidebar.tsx +178 -0
- package/template/host/src/layout/Topbar.tsx +50 -0
- package/template/host/src/layout/index.ts +4 -0
- package/template/host/src/lib/pocketbase/client.ts +38 -0
- package/template/host/src/lib/pocketbase/collections/audit_logs.ts +87 -0
- package/template/host/src/lib/pocketbase/collections/index.ts +19 -0
- package/template/host/src/lib/pocketbase/collections/organizations.ts +63 -0
- package/template/host/src/lib/pocketbase/collections/permissions.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/roles.ts +55 -0
- package/template/host/src/lib/pocketbase/collections/todos.ts +74 -0
- package/template/host/src/lib/pocketbase/collections/user_roles.ts +57 -0
- package/template/host/src/lib/pocketbase/collections/users.ts +43 -0
- package/template/host/src/lib/pocketbase/index.ts +5 -0
- package/template/host/src/lib/pocketbase/migrations.ts +44 -0
- package/template/host/src/lib/pocketbase/seed/permissions.ts +8 -0
- package/template/host/src/lib/pocketbase/seed/roles.ts +22 -0
- package/template/host/src/lib/pocketbase/seed.ts +113 -0
- package/template/host/src/lib/pocketbase/types.ts +102 -0
- package/template/host/src/modern.runtime.ts +26 -0
- package/template/host/src/plugins.d.ts +9 -0
- package/template/host/src/providers/PocketBaseProvider.tsx +30 -0
- package/template/host/src/routes/_.tsx +6 -0
- package/template/host/src/routes/dashboard._.tsx +41 -0
- package/template/host/src/routes/index.tsx +93 -0
- package/template/host/src/routes/login.tsx +36 -0
- package/template/host/src/saas.config.ts +52 -0
- package/template/host/src/test/setup.ts +65 -0
- package/template/host/src/test/utils.tsx +69 -0
- package/template/host/src/test/vitest-globals.d.ts +19 -0
- package/template/host/src/vite-env.d.ts +16 -0
- package/template/host/tailwind.config.ts +77 -0
- package/template/host/tsconfig.json +19 -0
- package/template/host/vitest.config.ts +30 -0
- package/template/nginx.conf +72 -0
- package/template/package.json +44 -0
- package/template/packages/plugins/@lego/plugin-dashboard/modern.config.ts +19 -0
- package/template/packages/plugins/@lego/plugin-dashboard/package.json +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/App.tsx +27 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/ActivityFeed.tsx +63 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActionSlot.tsx +11 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/QuickActions.tsx +68 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/SidebarWidget.tsx +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/components/StatCard.tsx +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/global.css +24 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useChannelIntegration.ts +43 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useDashboardStats.ts +65 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/usePocketBase.ts +47 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/hooks/useRecentActivity.ts +55 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/lib/utils.ts +6 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/pages/DashboardPage.tsx +105 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.config.ts +121 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/plugin.ts +18 -0
- package/template/packages/plugins/@lego/plugin-dashboard/src/vite-env.d.ts +32 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tailwind.config.ts +35 -0
- package/template/packages/plugins/@lego/plugin-dashboard/tsconfig.json +18 -0
- package/template/packages/plugins/@lego/plugin-todo/modern.config.ts +18 -0
- package/template/packages/plugins/@lego/plugin-todo/package.json +41 -0
- package/template/packages/plugins/@lego/plugin-todo/postcss.config.mjs +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/App.tsx +12 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/SidebarWidget.tsx +16 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoDialog.tsx +55 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoFilters.tsx +79 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoForm.tsx +94 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoItem.tsx +121 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/TodoList.tsx +41 -0
- package/template/packages/plugins/@lego/plugin-todo/src/components/index.ts +6 -0
- package/template/packages/plugins/@lego/plugin-todo/src/global.css +59 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useCreateTodo.ts +62 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useDeleteTodo.ts +46 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/usePocketBase.ts +38 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useTodos.ts +64 -0
- package/template/packages/plugins/@lego/plugin-todo/src/hooks/useUpdateTodo.ts +35 -0
- package/template/packages/plugins/@lego/plugin-todo/src/index.tsx +5 -0
- package/template/packages/plugins/@lego/plugin-todo/src/lib/utils.ts +20 -0
- package/template/packages/plugins/@lego/plugin-todo/src/pages/TodoPage.tsx +89 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.config.ts +104 -0
- package/template/packages/plugins/@lego/plugin-todo/src/plugin.ts +13 -0
- package/template/packages/plugins/@lego/plugin-todo/src/schemas.ts +37 -0
- package/template/packages/plugins/@lego/plugin-todo/src/types.ts +42 -0
- package/template/packages/plugins/@lego/plugin-todo/src/vite-env.d.ts +31 -0
- package/template/packages/plugins/@lego/plugin-todo/tailwind.config.ts +51 -0
- package/template/packages/plugins/@lego/plugin-todo/tsconfig.json +18 -0
- package/template/pnpm-workspace.yaml +4 -0
- package/template/pocketbase/CHANGELOG.md +911 -0
- package/template/pocketbase/LICENSE.md +17 -0
- package/template/scripts/create-plugin.js +221 -0
- package/template/scripts/deploy.sh +56 -0
- package/template/tsconfig.base.json +26 -0
- package/template/tsconfig.json +8 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# {APP_NAME}
|
|
2
|
+
|
|
3
|
+
> {DESCRIPTION}
|
|
4
|
+
|
|
5
|
+
Built with [Lego-One](https://github.com/your-org/lego-one) - A modular SaaS boilerplate with microkernel architecture.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Quick Start
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- **Node.js** 20+ - [Download](https://nodejs.org/)
|
|
14
|
+
- **pnpm** 9+ - Install: `npm install -g pnpm`
|
|
15
|
+
- **Git** - [Download](https://git-scm.com/)
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install dependencies
|
|
21
|
+
pnpm install
|
|
22
|
+
|
|
23
|
+
# Set up PocketBase (see PocketBase Setup below)
|
|
24
|
+
# Then start development
|
|
25
|
+
pnpm run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Visit **http://localhost:8080** to see your application.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📁 Project Structure
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
{APP_NAME}/
|
|
36
|
+
├── host/ # Main application (Kernel)
|
|
37
|
+
│ ├── src/
|
|
38
|
+
│ │ ├── kernel/ # Core systems (auth, RBAC, state)
|
|
39
|
+
│ │ ├── layout/ # Layout components (Sidebar, Topbar)
|
|
40
|
+
│ │ ├── routes/ # Page routes
|
|
41
|
+
│ │ └── providers/ # Context providers
|
|
42
|
+
│ └── package.json
|
|
43
|
+
│
|
|
44
|
+
├── packages/
|
|
45
|
+
│ └── plugins/
|
|
46
|
+
│ └── @lego/
|
|
47
|
+
│ ├── plugin-dashboard/ # Dashboard plugin (built-in)
|
|
48
|
+
│ ├── plugin-todo/ # Todo plugin (built-in)
|
|
49
|
+
│ └── plugin-*/ # Your custom plugins go here
|
|
50
|
+
│
|
|
51
|
+
├── pocketbase/ # PocketBase backend
|
|
52
|
+
│ ├── pb_data/ # Database files (created on first run)
|
|
53
|
+
│ └── README.md # PocketBase setup instructions
|
|
54
|
+
│
|
|
55
|
+
├── scripts/ # Utility scripts
|
|
56
|
+
│ └── create-plugin.js # Create new plugin: pnpm run create-plugin
|
|
57
|
+
│
|
|
58
|
+
├── docs/ # Documentation
|
|
59
|
+
│ └── framework/ # Framework documentation for AI assistants
|
|
60
|
+
│
|
|
61
|
+
├── CLAUDE.md # AI workflow guide (for vibe coding)
|
|
62
|
+
├── PROMPT.md # Session template (for vibe coding)
|
|
63
|
+
└── README.md # This file
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🛠️ Development
|
|
69
|
+
|
|
70
|
+
### Running the Application
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Start host and all plugins
|
|
74
|
+
pnpm run dev:all
|
|
75
|
+
|
|
76
|
+
# Or start individually:
|
|
77
|
+
pnpm run dev:host # Host only (:8080)
|
|
78
|
+
pnpm run dev:plugins # All plugins only
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Service URLs:**
|
|
82
|
+
- **Host:** http://localhost:8080
|
|
83
|
+
- **Dashboard Plugin:** http://localhost:3001
|
|
84
|
+
- **Todo Plugin:** http://localhost:3002
|
|
85
|
+
- **PocketBase Admin:** http://localhost:8090/_/
|
|
86
|
+
|
|
87
|
+
### Creating a New Plugin
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Interactive plugin creation
|
|
91
|
+
pnpm run create-plugin
|
|
92
|
+
|
|
93
|
+
# This will:
|
|
94
|
+
# 1. Prompt for plugin name
|
|
95
|
+
# 2. Create plugin structure in packages/plugins/@lego/
|
|
96
|
+
# 3. Register plugin in host/modern.runtime.ts
|
|
97
|
+
# 4. Add to saas.config.ts
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Building for Production
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Build all (host + plugins)
|
|
104
|
+
pnpm run build
|
|
105
|
+
|
|
106
|
+
# Output: host/dist/ contains production-ready files
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🗄️ PocketBase Setup
|
|
112
|
+
|
|
113
|
+
PocketBase is the backend database and API for your application.
|
|
114
|
+
|
|
115
|
+
### First Time Setup
|
|
116
|
+
|
|
117
|
+
1. **Download PocketBase:**
|
|
118
|
+
```bash
|
|
119
|
+
cd pocketbase
|
|
120
|
+
|
|
121
|
+
# Visit https://pocketbase.io/docs and download for your OS
|
|
122
|
+
# Or use the setup script:
|
|
123
|
+
# Windows: Download pocketbase.exe
|
|
124
|
+
# macOS/Linux: Download pocketbase
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
2. **Start PocketBase:**
|
|
128
|
+
```bash
|
|
129
|
+
cd pocketbase
|
|
130
|
+
./pocketbase serve
|
|
131
|
+
# Or on Windows:
|
|
132
|
+
./pocketbase.exe serve
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
3. **Create Admin Account:**
|
|
136
|
+
- Visit http://localhost:8090/_/
|
|
137
|
+
- Create your admin account (first user becomes admin)
|
|
138
|
+
|
|
139
|
+
4. **Import Collections (if needed):**
|
|
140
|
+
- The framework includes built-in collections for auth, organizations, etc.
|
|
141
|
+
- Check `pocketbase/pb_migrations/` for migration files
|
|
142
|
+
|
|
143
|
+
### Production Setup
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Production mode
|
|
147
|
+
cd pocketbase
|
|
148
|
+
./pocketbase serve --prod
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Important:** Change default admin credentials in production!
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 📚 Documentation
|
|
156
|
+
|
|
157
|
+
### For Development
|
|
158
|
+
|
|
159
|
+
- **[Framework Structure](./docs/framework/setup/01-framework-structure.md)** - Architecture overview
|
|
160
|
+
- **[Plugin Development](./docs/framework/setup/07-plugin-development.md)** - Creating custom plugins
|
|
161
|
+
- **[Hooks API](./docs/framework/setup/11-hooks-api.md)** - Available kernel hooks
|
|
162
|
+
- **[Components API](./docs/framework/setup/12-components-api.md)** - UI component library
|
|
163
|
+
|
|
164
|
+
### For AI-Assisted Development (Vibe Coding)
|
|
165
|
+
|
|
166
|
+
- **[CLAUDE.md](./CLAUDE.md)** - Complete AI workflow guide
|
|
167
|
+
- **[PROMPT.md](./PROMPT.md)** - Session template for AI assistants
|
|
168
|
+
- **[Documentation Index](./docs/framework/setup/00-index.md)** - Complete documentation index
|
|
169
|
+
|
|
170
|
+
**How to use:**
|
|
171
|
+
1. Read `CLAUDE.md` to understand the framework architecture
|
|
172
|
+
2. Use `PROMPT.md` template for each development session
|
|
173
|
+
3. AI assistants will read documentation automatically
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 🔌 Built-in Plugins
|
|
178
|
+
|
|
179
|
+
### Dashboard (`@lego/plugin-dashboard`)
|
|
180
|
+
- Organization statistics
|
|
181
|
+
- Recent activity feed
|
|
182
|
+
- Quick actions
|
|
183
|
+
- **Route:** `/dashboard`
|
|
184
|
+
|
|
185
|
+
### Todo (`@lego/plugin-todo`)
|
|
186
|
+
- Full CRUD operations
|
|
187
|
+
- Priority levels
|
|
188
|
+
- Due dates
|
|
189
|
+
- Multi-tenancy support
|
|
190
|
+
- **Route:** `/todos`
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🧪 Testing
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Run all tests
|
|
198
|
+
pnpm test
|
|
199
|
+
|
|
200
|
+
# Unit and component tests
|
|
201
|
+
pnpm --filter './host' test
|
|
202
|
+
|
|
203
|
+
# E2E tests (requires dev server)
|
|
204
|
+
pnpm test:e2e
|
|
205
|
+
|
|
206
|
+
# Type checking
|
|
207
|
+
pnpm run typecheck
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 🚢 Deployment
|
|
213
|
+
|
|
214
|
+
### Docker Deployment
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Build Docker image
|
|
218
|
+
docker build -t {APP_NAME} .
|
|
219
|
+
|
|
220
|
+
# Run with Docker Compose
|
|
221
|
+
docker-compose up -d
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Environment Variables
|
|
225
|
+
|
|
226
|
+
Copy `.env.example` to `.env` and configure:
|
|
227
|
+
|
|
228
|
+
```env
|
|
229
|
+
# PocketBase
|
|
230
|
+
POCKETBASE_URL=http://localhost:8090
|
|
231
|
+
|
|
232
|
+
# Application
|
|
233
|
+
NODE_ENV=production
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 🔄 Updating Framework
|
|
239
|
+
|
|
240
|
+
Update your application with the latest framework changes:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Update framework files (preserves your custom code)
|
|
244
|
+
npx create-lego-one@latest update
|
|
245
|
+
|
|
246
|
+
# Dry run to preview changes
|
|
247
|
+
npx create-lego-one@latest update --dry-run
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**What gets updated:**
|
|
251
|
+
- ✅ New plugins (added without overwriting yours)
|
|
252
|
+
- ✅ Kernel improvements (preserves your customizations)
|
|
253
|
+
- ✅ Dependencies (merged with your custom scripts)
|
|
254
|
+
- ❌ Your plugins (never overwritten)
|
|
255
|
+
- ❌ Your configs (`saas.config.ts`, `modern.config.ts`)
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 📝 Code Quality
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Lint code
|
|
263
|
+
pnpm run lint
|
|
264
|
+
|
|
265
|
+
# Fix linting issues
|
|
266
|
+
pnpm run lint:fix
|
|
267
|
+
|
|
268
|
+
# Format code
|
|
269
|
+
pnpm run format
|
|
270
|
+
|
|
271
|
+
# Check formatting
|
|
272
|
+
pnpm run format:check
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 🎨 Tech Stack
|
|
278
|
+
|
|
279
|
+
| Layer | Technology |
|
|
280
|
+
|-------|-----------|
|
|
281
|
+
| **Framework** | Modern.js with Rspack |
|
|
282
|
+
| **Micro-Frontends** | Garfish |
|
|
283
|
+
| **UI** | React 18, Tailwind CSS, Radix UI |
|
|
284
|
+
| **State** | Zustand + TanStack Query v5 |
|
|
285
|
+
| **Backend** | PocketBase |
|
|
286
|
+
| **Language** | TypeScript (strict mode) |
|
|
287
|
+
| **Testing** | Vitest + Playwright |
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 🤝 Contributing
|
|
292
|
+
|
|
293
|
+
This is your application! Customize it as needed:
|
|
294
|
+
|
|
295
|
+
1. **Create plugins** - Add features as plugins in `packages/plugins/@lego/`
|
|
296
|
+
2. **Customize kernel** - Modify `host/src/kernel/` for core changes
|
|
297
|
+
3. **Add routes** - Add pages in `host/src/routes/`
|
|
298
|
+
4. **Extend UI** - Use or customize components in `host/src/kernel/components/`
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 📖 Learn More
|
|
303
|
+
|
|
304
|
+
- **[Lego-One Framework](https://github.com/your-org/lego-one)** - Framework repository
|
|
305
|
+
- **[Modern.js Docs](https://modernjs.dev/)** - Framework documentation
|
|
306
|
+
- **[PocketBase Docs](https://pocketbase.io/docs)** - Backend documentation
|
|
307
|
+
- **[Garfish Docs](https://www.garfishjs.org/)** - Micro-frontend engine
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 🆘 Support
|
|
312
|
+
|
|
313
|
+
- **Documentation:** Check `docs/` directory
|
|
314
|
+
- **Issues:** [GitHub Issues](https://github.com/your-org/lego-one/issues)
|
|
315
|
+
- **Discord:** [Community Chat](https://discord.gg/lego-one)
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 📄 License
|
|
320
|
+
|
|
321
|
+
MIT License - See [LICENSE](./LICENSE) for details.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
**Happy Coding! 🎉**
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
app:
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: Dockerfile
|
|
8
|
+
ports:
|
|
9
|
+
- "80:80"
|
|
10
|
+
- "8090:8090"
|
|
11
|
+
environment:
|
|
12
|
+
- VITE_POCKETBASE_URL=http://localhost:8090
|
|
13
|
+
- VITE_APP_NAME=Lego-One
|
|
14
|
+
- VITE_APP_URL=http://localhost
|
|
15
|
+
- VITE_PLUGINS_ENABLED=true
|
|
16
|
+
- VITE_ENABLE_DEVTOOLS=false
|
|
17
|
+
volumes:
|
|
18
|
+
- pb_data:/data/pb
|
|
19
|
+
restart: unless-stopped
|
|
20
|
+
healthcheck:
|
|
21
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:80"]
|
|
22
|
+
interval: 30s
|
|
23
|
+
timeout: 10s
|
|
24
|
+
retries: 3
|
|
25
|
+
start_period: 40s
|
|
26
|
+
|
|
27
|
+
# Optional: Add PostgreSQL for production instead of SQLite
|
|
28
|
+
# postgres:
|
|
29
|
+
# image: postgres:15-alpine
|
|
30
|
+
# environment:
|
|
31
|
+
# POSTGRES_DB: legoone
|
|
32
|
+
# POSTGRES_USER: legoone
|
|
33
|
+
# POSTGRES_PASSWORD: changeme
|
|
34
|
+
# volumes:
|
|
35
|
+
# - postgres_data:/var/lib/postgresql/data
|
|
36
|
+
# restart: unless-stopped
|
|
37
|
+
|
|
38
|
+
# Optional: Redis for caching/sessions
|
|
39
|
+
# redis:
|
|
40
|
+
# image: redis:7-alpine
|
|
41
|
+
# volumes:
|
|
42
|
+
# - redis_data:/data
|
|
43
|
+
# restart: unless-stopped
|
|
44
|
+
|
|
45
|
+
volumes:
|
|
46
|
+
pb_data:
|
|
47
|
+
# postgres_data:
|
|
48
|
+
# redis_data:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Start PocketBase in background
|
|
5
|
+
echo "Starting PocketBase..."
|
|
6
|
+
/usr/local/bin/pocketbase serve --dir=/data/pb > /var/log/pocketbase.log 2>&1 &
|
|
7
|
+
|
|
8
|
+
# Wait for PocketBase to be ready
|
|
9
|
+
echo "Waiting for PocketBase to start..."
|
|
10
|
+
sleep 5
|
|
11
|
+
|
|
12
|
+
# Check if PocketBase is running
|
|
13
|
+
if ! pgrep -f "pocketbase serve" > /dev/null; then
|
|
14
|
+
echo "ERROR: PocketBase failed to start"
|
|
15
|
+
cat /var/log/pocketbase.log
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "PocketBase started successfully"
|
|
20
|
+
|
|
21
|
+
# Start nginx in foreground
|
|
22
|
+
echo "Starting nginx..."
|
|
23
|
+
nginx -g 'daemon off;'
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Checkpoint: [Title]
|
|
2
|
+
|
|
3
|
+
**Type:** [Bugfix / Feature / Enhancement]
|
|
4
|
+
**Date:** [YYYY-MM-DD]
|
|
5
|
+
**Status:** [In Progress / Completed / Blocked]
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
[Brief description of the task, bug, or feature]
|
|
10
|
+
|
|
11
|
+
## Task Definition
|
|
12
|
+
|
|
13
|
+
**Original Request:**
|
|
14
|
+
- [User's original request or description of the issue]
|
|
15
|
+
|
|
16
|
+
**Acceptance Criteria:**
|
|
17
|
+
- [ ] [Criteria 1]
|
|
18
|
+
- [ ] [Criteria 2]
|
|
19
|
+
- [ ] [Criteria 3]
|
|
20
|
+
|
|
21
|
+
## Implementation
|
|
22
|
+
|
|
23
|
+
### Files Modified
|
|
24
|
+
- `path/to/file.ext` - [Description of changes]
|
|
25
|
+
|
|
26
|
+
### Files Created
|
|
27
|
+
- `path/to/new-file.ext` - [Description of purpose]
|
|
28
|
+
|
|
29
|
+
### Implementation Steps
|
|
30
|
+
1. [Step 1 description]
|
|
31
|
+
2. [Step 2 description]
|
|
32
|
+
3. [Step 3 description]
|
|
33
|
+
|
|
34
|
+
## Testing
|
|
35
|
+
|
|
36
|
+
### Test Cases
|
|
37
|
+
- [ ] [Test case 1]
|
|
38
|
+
- [ ] [Test case 2]
|
|
39
|
+
- [ ] [Test case 3]
|
|
40
|
+
|
|
41
|
+
### Test Results
|
|
42
|
+
[Results of testing - what works, what doesn't]
|
|
43
|
+
|
|
44
|
+
## Issues Encountered
|
|
45
|
+
|
|
46
|
+
| Issue | Solution | Status |
|
|
47
|
+
|-------|----------|--------|
|
|
48
|
+
| [Description] | [Solution applied] | [Resolved / Ongoing] |
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
[Additional notes, edge cases, or considerations]
|
|
53
|
+
|
|
54
|
+
## Next Steps
|
|
55
|
+
|
|
56
|
+
[What needs to be done next]
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
**Completion Checklist:**
|
|
61
|
+
- [ ] Code implemented
|
|
62
|
+
- [ ] Tests passing
|
|
63
|
+
- [ ] Documentation updated
|
|
64
|
+
- [ ] Checkpoint file complete
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Checkpoint: Phase 1 - Infrastructure Setup
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-01-23
|
|
4
|
+
**Plan:** `docs/framework/plans/01-infrastructure-setup.md`
|
|
5
|
+
**Status:** ✅ COMPLETED
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Files Created
|
|
10
|
+
|
|
11
|
+
### Root Configuration Files
|
|
12
|
+
- `package.json` - Root package.json with monorepo scripts and dev dependencies
|
|
13
|
+
- `pnpm-workspace.yaml` - pnpm workspace configuration
|
|
14
|
+
- `pnpm-lock.yaml` - Lock file (auto-generated)
|
|
15
|
+
- `.npmrc` - npm configuration
|
|
16
|
+
- `.gitignore` - Git ignore patterns
|
|
17
|
+
- `tsconfig.json` - Root TypeScript configuration with project references
|
|
18
|
+
- `tsconfig.base.json` - Base TypeScript configuration
|
|
19
|
+
- `.eslintrc.js` - ESLint configuration
|
|
20
|
+
- `.eslintignore` - ESLint ignore patterns
|
|
21
|
+
- `.prettierrc` - Prettier configuration
|
|
22
|
+
- `.prettierignore` - Prettier ignore patterns
|
|
23
|
+
|
|
24
|
+
### Environment Configuration
|
|
25
|
+
- `.env.development` - Development environment variables
|
|
26
|
+
- `.env.production` - Production environment variables
|
|
27
|
+
- `.env.example` - Environment variable template
|
|
28
|
+
- `src/env/env.schema.ts` - Zod validation schema for environment variables
|
|
29
|
+
|
|
30
|
+
### Scripts
|
|
31
|
+
- `scripts/create-plugin.js` - Plugin scaffolding CLI script
|
|
32
|
+
|
|
33
|
+
### Documentation
|
|
34
|
+
- `README.md` - Already exists (comprehensive project documentation)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Active State
|
|
39
|
+
|
|
40
|
+
### Dependencies Installed
|
|
41
|
+
- `@types/node` ^20.11.0
|
|
42
|
+
- `@typescript-eslint/eslint-plugin` ^7.0.0
|
|
43
|
+
- `@typescript-eslint/parser` ^7.0.0
|
|
44
|
+
- `eslint` ^8.57.0
|
|
45
|
+
- `eslint-config-prettier` ^9.1.0
|
|
46
|
+
- `prettier` ^3.2.0
|
|
47
|
+
- `prettier-plugin-tailwindcss` ^0.5.0
|
|
48
|
+
- `typescript` ^5.3.0
|
|
49
|
+
|
|
50
|
+
### Available Scripts
|
|
51
|
+
- `pnpm run dev` - Start host application
|
|
52
|
+
- `pnpm run dev:host` - Start host application
|
|
53
|
+
- `pnpm run dev:plugins` - Start all plugins
|
|
54
|
+
- `pnpm run dev:all` - Start host and all plugins
|
|
55
|
+
- `pnpm run build` - Build all workspaces
|
|
56
|
+
- `pnpm run lint` - Lint all workspaces
|
|
57
|
+
- `pnpm run lint:fix` - Fix linting issues
|
|
58
|
+
- `pnpm run format` - Format code with Prettier
|
|
59
|
+
- `pnpm run format:check` - Check code formatting
|
|
60
|
+
- `pnpm run typecheck` - Type check all workspaces
|
|
61
|
+
- `pnpm run test` - Run all tests
|
|
62
|
+
- `pnpm run test:e2e` - Run E2E tests
|
|
63
|
+
- `pnpm run clean` - Clean build artifacts and node_modules
|
|
64
|
+
- `pnpm run create-plugin` - Create a new plugin scaffold
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Pending Tasks
|
|
69
|
+
|
|
70
|
+
### Next Phase: PocketBase Setup
|
|
71
|
+
- **Plan File:** `docs/framework/plans/02-pocketbase-setup.md`
|
|
72
|
+
- **Prerequisites:** None (Phase 1 completed)
|
|
73
|
+
- **Overview:**
|
|
74
|
+
- Download and setup PocketBase
|
|
75
|
+
- Configure collections (organizations, users, roles, permissions)
|
|
76
|
+
- Set up API rules for multitenancy
|
|
77
|
+
- Create seed data script
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Verification Results
|
|
82
|
+
|
|
83
|
+
### File Structure Verification
|
|
84
|
+
✅ `package.json` - Created
|
|
85
|
+
✅ `pnpm-workspace.yaml` - Created
|
|
86
|
+
✅ `.npmrc` - Created
|
|
87
|
+
✅ `.gitignore` - Created
|
|
88
|
+
✅ `tsconfig.json` - Created
|
|
89
|
+
✅ `tsconfig.base.json` - Created
|
|
90
|
+
✅ `.eslintrc.js` - Created
|
|
91
|
+
✅ `.eslintignore` - Created
|
|
92
|
+
✅ `.prettierrc` - Created
|
|
93
|
+
✅ `.prettierignore` - Created
|
|
94
|
+
✅ `.env.development` - Created
|
|
95
|
+
✅ `.env.production` - Created
|
|
96
|
+
✅ `.env.example` - Created
|
|
97
|
+
✅ `scripts/create-plugin.js` - Created
|
|
98
|
+
✅ `src/env/env.schema.ts` - Created
|
|
99
|
+
✅ `README.md` - Already exists (kept)
|
|
100
|
+
|
|
101
|
+
### Dependencies Installation
|
|
102
|
+
✅ All dependencies installed successfully
|
|
103
|
+
✅ `node_modules` directory created
|
|
104
|
+
✅ `pnpm-lock.yaml` generated
|
|
105
|
+
|
|
106
|
+
### TypeScript Configuration
|
|
107
|
+
✅ Base config created with strict mode enabled
|
|
108
|
+
✅ Project references configured for host and plugins
|
|
109
|
+
✅ Path aliases configured (@/*)
|
|
110
|
+
|
|
111
|
+
### Code Quality Tools
|
|
112
|
+
✅ ESLint configured with TypeScript support
|
|
113
|
+
✅ Prettier configured with Tailwind plugin
|
|
114
|
+
✅ Git ignore patterns configured
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Gap Analysis
|
|
119
|
+
|
|
120
|
+
Against Research Documents:
|
|
121
|
+
- `docs/framework/research/00-modernjs-audit.md` - Aligned with Modern.js monorepo structure
|
|
122
|
+
- `docs/framework/research/01-system-blueprint.md` - Following microkernel architecture setup
|
|
123
|
+
|
|
124
|
+
All planned items for Phase 1 have been implemented and verified.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- The existing README.md was more comprehensive than the plan's template, so it was preserved
|
|
131
|
+
- Plugin scaffolding script uses Modern.js conventions as specified in research
|
|
132
|
+
- Environment configuration uses Vite-style prefix (VITE_) for consistency with Modern.js
|