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,312 @@
|
|
|
1
|
+
# Phase 13: Documentation - Complete
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Comprehensive documentation suite created for the Lego-One SaaS boilerplate, covering API reference, component library, plugin development, deployment, and troubleshooting.
|
|
6
|
+
|
|
7
|
+
## Documentation Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
docs/
|
|
11
|
+
├── api/
|
|
12
|
+
│ └── kernel-api.md # Kernel API reference
|
|
13
|
+
├── components/
|
|
14
|
+
│ └── ui-components.md # UI component library reference
|
|
15
|
+
├── guides/
|
|
16
|
+
│ ├── plugin-development.md # Plugin development guide
|
|
17
|
+
│ ├── deployment.md # Deployment guide
|
|
18
|
+
│ └── troubleshooting.md # Troubleshooting guide
|
|
19
|
+
└── checkpoints/
|
|
20
|
+
├── phase-08-plugin-system.md
|
|
21
|
+
├── phase-09-dashboard-plugin.md
|
|
22
|
+
├── phase-10-todo-plugin.md
|
|
23
|
+
├── phase-11-testing.md
|
|
24
|
+
└── phase-12-deployment.md
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Documentation Files
|
|
28
|
+
|
|
29
|
+
### 1. API Reference (`docs/api/kernel-api.md`)
|
|
30
|
+
|
|
31
|
+
**Sections:**
|
|
32
|
+
- Authentication hooks (`useAuth`, `useRequireAuth`)
|
|
33
|
+
- Authorization (RBAC) hooks and types
|
|
34
|
+
- Channel system for plugin-host communication
|
|
35
|
+
- Plugin system APIs
|
|
36
|
+
- Shared state management (Zustand)
|
|
37
|
+
- PocketBase integration utilities
|
|
38
|
+
- Utility functions
|
|
39
|
+
|
|
40
|
+
**Key APIs Documented:**
|
|
41
|
+
- `useAuth()` - Authentication state and methods
|
|
42
|
+
- `useCurrentOrganization()` - Organization context
|
|
43
|
+
- `useRequirePermission()` - Permission checking
|
|
44
|
+
- `useUserPermissions()` - User permissions query
|
|
45
|
+
- `useOrganizations()` - Organizations query
|
|
46
|
+
- `useHasPermission()` - Permission verification
|
|
47
|
+
- Channel hooks (`useAuthChannel`, `useOrganizationChannel`, `useToastChannel`)
|
|
48
|
+
- `useGlobalKernelState` - Global state management
|
|
49
|
+
- `usePocketBase()` - PocketBase client
|
|
50
|
+
|
|
51
|
+
### 2. Component Reference (`docs/components/ui-components.md`)
|
|
52
|
+
|
|
53
|
+
**Component Categories:**
|
|
54
|
+
- **Form Components:** Button, Input, Label, Select, Switch
|
|
55
|
+
- **Layout Components:** Card, Separator, ScrollArea
|
|
56
|
+
- **Feedback Components:** Alert, Badge, Progress, Skeleton, Toast
|
|
57
|
+
- **Navigation Components:** Tabs, Dropdown Menu
|
|
58
|
+
- **Display Components:** Avatar, Table
|
|
59
|
+
- **Overlay Components:** Dialog, Popover, Tooltip
|
|
60
|
+
|
|
61
|
+
**Each Component Includes:**
|
|
62
|
+
- Import statement
|
|
63
|
+
- Props interface
|
|
64
|
+
- Variant/size options
|
|
65
|
+
- Usage examples
|
|
66
|
+
- Accessibility notes
|
|
67
|
+
|
|
68
|
+
### 3. Plugin Development Guide (`docs/guides/plugin-development.md`)
|
|
69
|
+
|
|
70
|
+
**Sections:**
|
|
71
|
+
- Quick start with CLI
|
|
72
|
+
- Manual setup instructions
|
|
73
|
+
- Project structure
|
|
74
|
+
- Plugin configuration
|
|
75
|
+
- Slot injection patterns
|
|
76
|
+
- Routing setup
|
|
77
|
+
- Host communication via window bridge
|
|
78
|
+
- PocketBase integration
|
|
79
|
+
- Styling with Tailwind CSS
|
|
80
|
+
- Best practices
|
|
81
|
+
- Testing guidelines
|
|
82
|
+
- Common patterns
|
|
83
|
+
- Troubleshooting
|
|
84
|
+
|
|
85
|
+
**Key Topics:**
|
|
86
|
+
- Creating a plugin from scratch
|
|
87
|
+
- Using slots for UI injection
|
|
88
|
+
- Defining routes
|
|
89
|
+
- Communicating with the host
|
|
90
|
+
- Data fetching with PocketBase
|
|
91
|
+
- Form validation
|
|
92
|
+
- Error handling
|
|
93
|
+
|
|
94
|
+
### 4. Deployment Guide (`docs/guides/deployment.md`)
|
|
95
|
+
|
|
96
|
+
**Sections:**
|
|
97
|
+
- Prerequisites
|
|
98
|
+
- Environment setup
|
|
99
|
+
- Docker deployment
|
|
100
|
+
- Cloud platforms (Vercel, Railway, Render, DigitalOcean)
|
|
101
|
+
- Production checklist
|
|
102
|
+
- Monitoring & maintenance
|
|
103
|
+
- Scaling strategies
|
|
104
|
+
- CI/CD pipeline
|
|
105
|
+
- Rollback procedures
|
|
106
|
+
- Cost optimization
|
|
107
|
+
- Security best practices
|
|
108
|
+
|
|
109
|
+
**Key Topics:**
|
|
110
|
+
- Environment variable configuration
|
|
111
|
+
- Docker containerization
|
|
112
|
+
- Multi-platform deployment
|
|
113
|
+
- Production build optimization
|
|
114
|
+
- Health checks and monitoring
|
|
115
|
+
- Backup procedures
|
|
116
|
+
- Scaling (horizontal, database)
|
|
117
|
+
- Cost reduction strategies
|
|
118
|
+
|
|
119
|
+
### 5. Troubleshooting Guide (`docs/guides/troubleshooting.md`)
|
|
120
|
+
|
|
121
|
+
**Categories:**
|
|
122
|
+
- Development Issues
|
|
123
|
+
- Build Issues
|
|
124
|
+
- Deployment Issues
|
|
125
|
+
- Plugin Issues
|
|
126
|
+
- PocketBase Issues
|
|
127
|
+
- Performance Issues
|
|
128
|
+
|
|
129
|
+
**Common Issues Covered:**
|
|
130
|
+
- Port conflicts
|
|
131
|
+
- Hot reload failures
|
|
132
|
+
- TypeScript errors
|
|
133
|
+
- Import path issues
|
|
134
|
+
- Build failures
|
|
135
|
+
- Docker container errors
|
|
136
|
+
- Environment variable problems
|
|
137
|
+
- Plugin loading issues
|
|
138
|
+
- Route 404 errors
|
|
139
|
+
- PocketBase connection issues
|
|
140
|
+
- Authentication problems
|
|
141
|
+
- Performance bottlenecks
|
|
142
|
+
|
|
143
|
+
**Each Issue Includes:**
|
|
144
|
+
- Symptom description
|
|
145
|
+
- Root cause analysis
|
|
146
|
+
- Step-by-step solution
|
|
147
|
+
- Diagnostic commands
|
|
148
|
+
|
|
149
|
+
## Checkpoint Files
|
|
150
|
+
|
|
151
|
+
### Phase 8: Plugin System
|
|
152
|
+
- Kernel plugin infrastructure
|
|
153
|
+
- Slot injection system
|
|
154
|
+
- Plugin loader and store
|
|
155
|
+
- Plugin configuration types
|
|
156
|
+
|
|
157
|
+
### Phase 9: Dashboard Plugin
|
|
158
|
+
- Complete plugin implementation
|
|
159
|
+
- Statistics tracking
|
|
160
|
+
- Activity feed
|
|
161
|
+
- Quick actions widget
|
|
162
|
+
|
|
163
|
+
### Phase 10: Todo Plugin
|
|
164
|
+
- Full CRUD functionality
|
|
165
|
+
- Form validation
|
|
166
|
+
- Filtering and search
|
|
167
|
+
- Permission-based access
|
|
168
|
+
|
|
169
|
+
### Phase 11: Testing
|
|
170
|
+
- Vitest configuration
|
|
171
|
+
- Test utilities
|
|
172
|
+
- 32 unit/component tests
|
|
173
|
+
- Playwright E2E setup
|
|
174
|
+
|
|
175
|
+
### Phase 12: Deployment
|
|
176
|
+
- Docker multi-stage build
|
|
177
|
+
- Nginx configuration
|
|
178
|
+
- Docker Compose setup
|
|
179
|
+
- Production build verification
|
|
180
|
+
|
|
181
|
+
## Documentation Features
|
|
182
|
+
|
|
183
|
+
### Code Examples
|
|
184
|
+
All documentation includes:
|
|
185
|
+
- Working TypeScript/React code
|
|
186
|
+
- Import statements
|
|
187
|
+
- Complete examples
|
|
188
|
+
- Error handling patterns
|
|
189
|
+
|
|
190
|
+
### Cross-References
|
|
191
|
+
- Links between related documents
|
|
192
|
+
- API references in guides
|
|
193
|
+
- Component usage in examples
|
|
194
|
+
- Troubleshooting in all guides
|
|
195
|
+
|
|
196
|
+
### Best Practices
|
|
197
|
+
- Security considerations
|
|
198
|
+
- Performance optimization
|
|
199
|
+
- Accessibility guidelines
|
|
200
|
+
- Code organization tips
|
|
201
|
+
|
|
202
|
+
## Documentation Statistics
|
|
203
|
+
|
|
204
|
+
- **Total Documentation Files:** 10+
|
|
205
|
+
- **API References:** 40+ hooks/functions
|
|
206
|
+
- **Component Documentation:** 20+ components
|
|
207
|
+
- **Guides:** 4 comprehensive guides
|
|
208
|
+
- **Troubleshooting Topics:** 30+ issues
|
|
209
|
+
|
|
210
|
+
## Usage
|
|
211
|
+
|
|
212
|
+
### For Developers
|
|
213
|
+
|
|
214
|
+
1. **Getting Started:**
|
|
215
|
+
- Read README.md for project overview
|
|
216
|
+
- Follow setup guide in README.md
|
|
217
|
+
|
|
218
|
+
2. **Building Features:**
|
|
219
|
+
- Consult API Reference for available hooks
|
|
220
|
+
- Use Component Reference for UI elements
|
|
221
|
+
- Follow Plugin Development Guide for extensibility
|
|
222
|
+
|
|
223
|
+
3. **Deploying:**
|
|
224
|
+
- Follow Deployment Guide
|
|
225
|
+
- Use Troubleshooting Guide for issues
|
|
226
|
+
|
|
227
|
+
### For Plugin Developers
|
|
228
|
+
|
|
229
|
+
1. **Creating Plugins:**
|
|
230
|
+
- Read Plugin Development Guide
|
|
231
|
+
- Reference API documentation
|
|
232
|
+
- Check existing plugins (Dashboard, Todo)
|
|
233
|
+
|
|
234
|
+
2. **Integration:**
|
|
235
|
+
- Slot system documentation
|
|
236
|
+
- Window bridge API
|
|
237
|
+
- Channel communication
|
|
238
|
+
|
|
239
|
+
## Maintenance
|
|
240
|
+
|
|
241
|
+
### Keeping Docs Updated
|
|
242
|
+
|
|
243
|
+
When making changes:
|
|
244
|
+
1. Update API references for new hooks/functions
|
|
245
|
+
2. Document new components
|
|
246
|
+
3. Add troubleshooting entries for new issues
|
|
247
|
+
4. Update examples to reflect best practices
|
|
248
|
+
5. Cross-reference related sections
|
|
249
|
+
|
|
250
|
+
### Documentation Review
|
|
251
|
+
|
|
252
|
+
Before releasing:
|
|
253
|
+
- [ ] All new APIs are documented
|
|
254
|
+
- [ ] Code examples are tested
|
|
255
|
+
- [ ] Cross-references are correct
|
|
256
|
+
- [ ] Troubleshooting covers common issues
|
|
257
|
+
- [ ] Deployment guide works for all platforms
|
|
258
|
+
|
|
259
|
+
## Tools Used
|
|
260
|
+
|
|
261
|
+
- **Markdown:** Primary documentation format
|
|
262
|
+
- **TypeScript:** Code examples
|
|
263
|
+
- **Mermaid (optional):** Diagrams and flows
|
|
264
|
+
- **Code highlighting:** Syntax highlighting for all examples
|
|
265
|
+
|
|
266
|
+
## Future Improvements
|
|
267
|
+
|
|
268
|
+
1. **Interactive Examples:**
|
|
269
|
+
- Live code playgrounds
|
|
270
|
+
- Embedded demos
|
|
271
|
+
|
|
272
|
+
2. **Video Tutorials:**
|
|
273
|
+
- Getting started walkthrough
|
|
274
|
+
- Plugin development tutorial
|
|
275
|
+
- Deployment guide
|
|
276
|
+
|
|
277
|
+
3. **API Auto-Generation:**
|
|
278
|
+
- Generate from TypeScript types
|
|
279
|
+
- Automatic doc comments
|
|
280
|
+
|
|
281
|
+
4. **Search Integration:**
|
|
282
|
+
- Full-text search
|
|
283
|
+
- Tag-based navigation
|
|
284
|
+
|
|
285
|
+
5. **Translations:**
|
|
286
|
+
- Multi-language support
|
|
287
|
+
- Localized examples
|
|
288
|
+
|
|
289
|
+
## Documentation Quality
|
|
290
|
+
|
|
291
|
+
### Standards
|
|
292
|
+
- Clear, concise language
|
|
293
|
+
- Working code examples
|
|
294
|
+
- Consistent formatting
|
|
295
|
+
- Comprehensive coverage
|
|
296
|
+
- Regular updates
|
|
297
|
+
|
|
298
|
+
### Accessibility
|
|
299
|
+
- High contrast text
|
|
300
|
+
- Screen reader friendly
|
|
301
|
+
- Semantic HTML structure
|
|
302
|
+
- Keyboard navigation support
|
|
303
|
+
|
|
304
|
+
## Notes
|
|
305
|
+
|
|
306
|
+
Documentation is a living resource. As the project evolves, documentation should be updated to reflect:
|
|
307
|
+
- New features and APIs
|
|
308
|
+
- Breaking changes
|
|
309
|
+
- Best practices learned
|
|
310
|
+
- Common issues and solutions
|
|
311
|
+
|
|
312
|
+
All documentation files are in Markdown format for easy editing and version control.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Lego-One Implementation Plan Index
|
|
2
|
+
|
|
3
|
+
> **For AI Implementing This Plan:** Start with `01-infrastructure-setup.md` and proceed sequentially through all documents. Each document contains complete implementation details with exact file paths, code, and commands.
|
|
4
|
+
|
|
5
|
+
**Goal:** Build a complete, production-ready SaaS boilerplate with microkernel architecture using Modern.js + Garfish + PocketBase
|
|
6
|
+
|
|
7
|
+
**Architecture:** Host (Kernel) provides auth, multitenancy, RBAC, and shared services. Plugins (Dashboard, Todo) are feature modules that can be enabled/disabled. Development uses separate plugin servers; production bundles everything into single host deployment.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Modern.js, Rspack, Garfish, React 18, TypeScript, Zustand, TanStack Query v5, Tailwind CSS, Shadcn UI, PocketBase, Vitest, Playwright, Zod
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Implementation Plan Documents
|
|
14
|
+
|
|
15
|
+
### Phase 1: Foundation (Start Here)
|
|
16
|
+
|
|
17
|
+
| Document | Description | Prerequisites |
|
|
18
|
+
|----------|-------------|---------------|
|
|
19
|
+
| [`01-infrastructure-setup.md`](./01-infrastructure-setup.md) | Project structure, monorepo, dependencies, tooling | None |
|
|
20
|
+
| [`02-pocketbase-setup.md`](./02-pocketbase-setup.md) | PocketBase installation, collections, API rules, seed data | 01 |
|
|
21
|
+
| [`03-host-kernel.md`](./03-host-kernel.md) | Host app initialization, shared state, layout, routing | 01 |
|
|
22
|
+
| [`04-auth-system.md`](./04-auth-system.md) | Authentication, login/logout, session management | 02, 03 |
|
|
23
|
+
| [`05-multitenancy-rbac.md`](./05-multitenancy-rbac.md) | Organizations, users, roles, permissions system | 02, 03, 04 |
|
|
24
|
+
|
|
25
|
+
### Phase 2: User Interface
|
|
26
|
+
|
|
27
|
+
| Document | Description | Prerequisites |
|
|
28
|
+
|----------|-------------|---------------|
|
|
29
|
+
| [`06-ui-components.md`](./06-ui-components.md) | Shadcn components, shared UI library, theming | 03 |
|
|
30
|
+
| [`07-communication-system.md`](./07-communication-system.md) | Garfish channel bus, toast system, state bridge | 03 |
|
|
31
|
+
|
|
32
|
+
### Phase 3: Plugin System
|
|
33
|
+
|
|
34
|
+
| Document | Description | Prerequisites |
|
|
35
|
+
|----------|-------------|---------------|
|
|
36
|
+
| [`08-plugin-system.md`](./08-plugin-system.md) | Plugin architecture, slot injection, loader, config | 03, 07 |
|
|
37
|
+
| [`09-dashboard-plugin.md`](./09-dashboard-plugin.md) | Dashboard plugin implementation | 03, 06, 08 |
|
|
38
|
+
| [`10-todo-plugin.md`](./10-todo-plugin.md) | Todo plugin with CRUD | 03, 06, 08 |
|
|
39
|
+
|
|
40
|
+
### Phase 4: Quality & Deployment
|
|
41
|
+
|
|
42
|
+
| Document | Description | Prerequisites |
|
|
43
|
+
|----------|-------------|---------------|
|
|
44
|
+
| [`11-testing.md`](./11-testing.md) | Unit, component, and E2E tests | All above |
|
|
45
|
+
| [`12-deployment.md`](./12-deployment.md) | Build configuration, dev/prod environments, CI/CD | All above |
|
|
46
|
+
|
|
47
|
+
### Phase 5: Documentation
|
|
48
|
+
|
|
49
|
+
| Document | Description | Prerequisites |
|
|
50
|
+
|----------|-------------|---------------|
|
|
51
|
+
| [`13-setup-guide.md`](./13-setup-guide.md) | User guide: setup, creating plugins, configuration | All above |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Implementation Order
|
|
56
|
+
|
|
57
|
+
Follow this sequence for smooth implementation:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
1. Infrastructure Setup (01)
|
|
61
|
+
↓
|
|
62
|
+
2. PocketBase Setup (02)
|
|
63
|
+
↓
|
|
64
|
+
3. Host Kernel (03)
|
|
65
|
+
↓
|
|
66
|
+
4. Auth System (04)
|
|
67
|
+
↓
|
|
68
|
+
5. Multitenancy & RBAC (05)
|
|
69
|
+
↓
|
|
70
|
+
6. UI Components (06)
|
|
71
|
+
↓
|
|
72
|
+
7. Communication System (07)
|
|
73
|
+
↓
|
|
74
|
+
8. Plugin System (08)
|
|
75
|
+
↓
|
|
76
|
+
9. Dashboard Plugin (09)
|
|
77
|
+
↓
|
|
78
|
+
10. Todo Plugin (10)
|
|
79
|
+
↓
|
|
80
|
+
11. Testing (11)
|
|
81
|
+
↓
|
|
82
|
+
12. Deployment (12)
|
|
83
|
+
↓
|
|
84
|
+
13. Setup Guide (13)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## What Gets Built
|
|
90
|
+
|
|
91
|
+
After implementing this plan, you will have:
|
|
92
|
+
|
|
93
|
+
### Core Features
|
|
94
|
+
- ✅ Multi-tenant SaaS with organization/user management
|
|
95
|
+
- ✅ Role-based access control (full RBAC)
|
|
96
|
+
- ✅ Authentication (admin-seeded, no public signup)
|
|
97
|
+
- ✅ Plugin system with slot injection
|
|
98
|
+
- ✅ Enable/disable plugins via config or admin UI
|
|
99
|
+
- ✅ Custom toast system (Garfish channel example)
|
|
100
|
+
|
|
101
|
+
### Included Plugins
|
|
102
|
+
- ✅ **Dashboard Plugin** - Stats, recent activity, quick actions
|
|
103
|
+
- ✅ **Todo Plugin** - Basic CRUD (enable/disable via config)
|
|
104
|
+
|
|
105
|
+
### Technical Features
|
|
106
|
+
- ✅ Tailwind + Shadcn UI components
|
|
107
|
+
- ✅ Responsive (Desktop/Tablet/Mobile)
|
|
108
|
+
- ✅ TypeScript strict mode
|
|
109
|
+
- ✅ TanStack Query for server state
|
|
110
|
+
- ✅ Zustand for global state
|
|
111
|
+
- ✅ Zod validation
|
|
112
|
+
- ✅ Full testing (Vitest + Playwright)
|
|
113
|
+
- ✅ ESLint + Prettier
|
|
114
|
+
- ✅ Dev: Separate plugin servers
|
|
115
|
+
- ✅ Prod: Single bundled deployment
|
|
116
|
+
|
|
117
|
+
### Developer Experience
|
|
118
|
+
- ✅ CLI script to scaffold new plugins
|
|
119
|
+
- ✅ Complete setup guide in `/docs/setup/`
|
|
120
|
+
- ✅ Seed data for immediate testing
|
|
121
|
+
- ✅ Configurable admin credentials
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Quick Start for AI Implementation
|
|
126
|
+
|
|
127
|
+
**Step 1:** Read `01-infrastructure-setup.md` completely
|
|
128
|
+
**Step 2:** Follow tasks sequentially (each task is 2-5 minutes)
|
|
129
|
+
**Step 3:** Run `pnpm run dev:all` after each phase to verify
|
|
130
|
+
**Step 4:** Continue through all documents in order
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## File Structure After Implementation
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
lego-one/
|
|
138
|
+
├── host/ # Kernel application
|
|
139
|
+
│ ├── src/
|
|
140
|
+
│ │ ├── kernel/ # Shared systems
|
|
141
|
+
│ │ ├── components/
|
|
142
|
+
│ │ ├── layout/
|
|
143
|
+
│ │ ├── routes/
|
|
144
|
+
│ │ └── ...
|
|
145
|
+
│ ├── modern.config.ts
|
|
146
|
+
│ └── package.json
|
|
147
|
+
├── packages/
|
|
148
|
+
│ └── plugins/
|
|
149
|
+
│ └── @lego/
|
|
150
|
+
│ ├── plugin-dashboard/ # Dashboard plugin
|
|
151
|
+
│ └── plugin-todo/ # Todo plugin
|
|
152
|
+
├── pocketbase/
|
|
153
|
+
│ └── pb_data/ # PocketBase data
|
|
154
|
+
├── docs/
|
|
155
|
+
│ ├── research/ # Research docs (done)
|
|
156
|
+
│ ├── plans/ # Implementation docs (this folder)
|
|
157
|
+
│ └── setup/ # User setup guides
|
|
158
|
+
├── pnpm-workspace.yaml
|
|
159
|
+
└── package.json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
**Ready to begin implementation?** Start with → [`01-infrastructure-setup.md`](./01-infrastructure-setup.md)
|