A modern, modular portal framework built with React, TypeScript, and Module Federation for creating scalable micro-frontend applications.
This monorepo uses pnpm workspaces and Turbo for build orchestration, featuring a sophisticated plugin architecture with Module Federation that enables independent development and deployment of portal functionality.
Portal Framework (libs/portal-framework-*)
portal-framework-core: Core framework providing plugin management, routing, and component loading infrastructureportal-framework-ui: React components and UI layer built on top of the core frameworkportal-framework-ui-core: Shared UI components and styling (Tailwind CSS)portal-framework-auth: Authentication-related functionality
Portal SDK (libs/portal-sdk)
- Generated API client and types for portal backend communication
- Account management schemas and interfaces
Plugin System (libs/portal-plugin-*)
- Modular plugins that extend portal functionality
- Independent build and deployment capabilities
- Capability-based architecture for extensibility
Applications (apps/*)
portal-app-shell: Main application host that orchestrates pluginsportal-frontend: Public-facing marketing siteportal-storybook: Component documentation and testing- Additional specialized applications
- Node.js 18+
- pnpm 10.15.0+
- Git
# Clone the repository
git clone <repository-url>
cd lume-web
# Install dependencies
pnpm install
# Start development mode
pnpm devThe portal app shell requires environment variables:
# Required for portal-app-shell
VITE_PORTAL_APP_NAME=your-app-name
VITE_PORTAL_APP_TITLE=Your App Title
# Optional
VITE_PORTAL_APP_DISABLE_NAV=true
VITE_PORTAL_APP_DISABLE_ROUTING=truelume-web/
βββ apps/ # Application entry points
β βββ portal-app-shell/ # Main portal application host
β βββ portal-frontend/ # Public marketing site (Astro)
β βββ portal-storybook/ # Component documentation
β βββ web3.news/ # Web3 news application
β βββ lumeweb.com/ # Company website
β βββ docs.lumeweb.com/ # Documentation site
βββ libs/ # Shared libraries and plugins
β βββ portal-framework-*/ # Framework core libraries
β βββ portal-sdk/ # Generated API client
β βββ portal-plugin-*/ # Modular plugins
βββ packages/ # Additional shared packages
β βββ portal-storybook-config/ # Storybook configuration
βββ shared-modules.ts # Module Federation shared modules
βββ turbo.json # Turbo build configuration
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ AGENTS.md # AI agent development guidelines
βββ PLUGIN_GUIDELINES.md # Plugin development guidelines
βββ README.md # This file
The portal framework uses a sophisticated plugin architecture where each plugin is an independently deployable micro-frontend.
- portal-plugin-core: Essential functionality (NotFound routes, navigation)
- portal-plugin-dashboard: Main dashboard with authentication and file upload
- portal-plugin-ipfs: IPFS integration and file management
- portal-plugin-admin: Administrative interface
- portal-plugin-abuse: Abuse management system
- portal-plugin-abuse-report: Public abuse reporting interface
- portal-plugin-abuse-common: Shared types and API clients
See PLUGIN_GUIDELINES.md for comprehensive plugin development guidelines.
# Create new plugin directory
mkdir libs/portal-plugin-my-feature
cd libs/portal-plugin-my-feature
# Initialize with standard structure
# (Follow PLUGIN_GUIDELINES.md for detailed setup)# Development
pnpm dev # Start all packages in development mode
pnpm dev --filter=portal-app-shell # Start only app shell
# Building
pnpm build # Build all packages and apps
pnpm build:portal-app-shell # Build only app shell
pnpm build:portal-plugin-dashboard # Build specific plugin
# Testing
pnpm test # Run all tests
vitest run # Run unit tests
playwright test # Run E2E tests
# Code Quality
pnpm lint # Run linting across all packages
pnpm format # Format code with Prettier# Dashboard plugin
pnpm e2e:portal-plugin-dashboard # Run E2E tests
# Individual plugin development
cd libs/portal-plugin-dashboard
pnpm dev # Start plugin in isolationFramework libraries use tsdown for building:
cd libs/portal-framework-core
pnpm build # Build library with ESM/CJS outputThe monorepo uses Turbo for efficient build orchestration:
- Parallel builds: Dependencies are built in parallel where possible
- Incremental builds: Only changed packages are rebuilt
- Caching: Build outputs are cached for faster subsequent builds
The system uses Module Federation for:
- Plugin isolation: Each plugin builds independently
- Shared dependencies: Common libraries are shared to reduce bundle size
- Runtime composition: Plugins are loaded at runtime
- Development flexibility: Plugins can be developed independently
// shared-modules.ts
export const getSharedModules = () => ({
react: { singleton: true, requiredVersion: "^18.3.1" },
"react-dom": { singleton: true, requiredVersion: "^18.3.1" },
"react-router": { singleton: true, requiredVersion: "^7.5.2" },
// ... other shared modules
});The main application host is configured via:
plugin.config.json: Plugin registry configuration- Environment variables: App name, features, and server settings
- Vite configuration: Module Federation setup
[
{
"name": "core",
"port": 443,
"tunnelHost": "core.tunnel.pinner.xyz"
},
{
"name": "dashboard",
"port": 443,
"tunnelHost": "dashboard.tunnel.pinner.xyz"
}
]Each plugin requires:
plugin.config.ts: Module Federation configurationvite.config.ts: Build configuration using framework's Config helperpackage.json: Dependencies and metadatatsconfig.json: TypeScript configuration
- Framework: Vitest with Happy DOM
- Location:
*.spec.tsfiles alongside source code - Command:
vitest runorvitest --watch
- Framework: Playwright for E2E tests
- Location:
e2e/directories in plugins - Command:
playwright testorplaywright test --ui
- Framework: Vitest with browser environment
- Location:
*.browser.spec.tsfiles - Command:
vitest run --browser
- Storybook: Run
pnpm dev --filter=portal-storybook - URL: http://localhost:6006
- Purpose: Component development, testing, and documentation
- Location:
docs.lumeweb.comapp - Framework: Vocs
- Command:
pnpm dev --filter=@lumeweb/docs.lumeweb.com
- AGENTS.md: Guidelines for AI agents working with the codebase
- PLUGIN_GUIDELINES.md: Comprehensive plugin development guide
# Build all packages
pnpm build
# Build specific app
pnpm build:portal-app-shell
# Build with environment
NODE_ENV=production pnpm build:portal-app-shellEach plugin can be deployed independently:
cd libs/portal-plugin-dashboard
pnpm build
# Deploy dist/ directory to your hosting platformThe app shell requires:
- Built plugins available at configured URLs
- Environment variables configured
- Static file serving with SPA fallback support
Plugins communicate through:
- Capabilities: Exposed functionality interfaces
- Features: Major functionality encapsulation
- Events: Framework event system for loose coupling
- Shared Services: Framework-provided services
// Example capability
export class CustomCapability implements BaseCapability {
readonly id: string = "plugin:capability";
readonly type = "custom-type";
async initialize(framework: Framework) {
// Initialize capability
}
async destroy() {
// Cleanup
}
}// Example feature
export class Feature implements FrameworkFeature {
readonly id: NamespacedId = createNamespacedId("plugin", "feature");
async initialize(framework: Framework) {
// Initialize feature
}
}- Follow established patterns: Use framework abstractions and conventions
- Keep plugins focused: Single responsibility per plugin
- Use TypeScript: Leverage type safety throughout
- Test thoroughly: Unit tests for logic, E2E for user flows
- Document interfaces: Clear capability and feature contracts
- Lazy loading: Load components and features on demand
- Code splitting: Split large features into smaller chunks
- Bundle optimization: Monitor and optimize bundle sizes
- Shared dependencies: Use Module Federation sharing effectively
- Environment variables: Never expose secrets in client code
- Input validation: Use Zod schemas for validation
- Authentication: Use framework auth capabilities
- CORS: Configure properly for plugin communication
- Setup: Install dependencies and configure environment
- Create branch: Feature branches from main/develop
- Develop: Follow guidelines in AGENTS.md and PLUGIN_GUIDELINES.md
- Test: Ensure all tests pass
- Build: Verify build process works
- Submit: Create pull request with description
- ESLint: Configured with React and TypeScript rules
- Prettier: Code formatting with Tailwind plugin
- Conventional Commits: Use conventional commit format
- TypeScript: Strict mode enabled
# pnpm-workspace.yaml
packages:
- "apps/*"
- "libs/*"
- "apps/portal-storybook"
- "packages/portal-storybook-config"- Workspace dependencies: Use
workspace:*for internal packages - Peer dependencies: Properly declare for framework libraries
- Version alignment: Use overrides for consistent versions
- Port conflicts: Ensure unique dev ports for plugins
- Module Federation: Check shared modules configuration
- Build failures: Verify dependency versions and compatibility
- Environment variables: Ensure all required variables are set
# Check dependency tree
pnpm why react
# Clean build artifacts
pnpm clean # If available, or manually remove dist/ directories
# Rebuild with verbose output
TURBO_LOG=detail pnpm buildMIT License - see LICENSE file for details.
- Documentation: Check PLUGIN_GUIDELINES.md
- Issues: Create GitHub issues for bugs and feature requests
- Discussions: Use GitHub Discussions for questions and ideas