diff --git a/Home.md b/Home.md index 3220a97..a214a1e 100644 --- a/Home.md +++ b/Home.md @@ -25,7 +25,7 @@ By leveraging Deno's secure runtime and Fresh's edge-ready web framework, PolyMP ## Explore the Wiki πŸ“š - **[Installation Guide](./installation)**: Learn how to set up PolyMPR on your local machine to start development. πŸ–₯️ -- **[Modules](./modules)**: Learn about the core and optional modules available in PolyMPR. 🧩 +- **[Modules](./modules)**: Learn how to create modules in PolyMPR. 🧩 - **[Tutorials](./tutorials)**: Step-by-step guides to help you get the most out of PolyMPR. πŸŽ“ - **[CLI Documentation](./cli)**: Dive into the technical details of PolyMPR's CLI. πŸ“„ - **[FAQs](./faqs)**: Find answers to common questions about PolyMPR. ❓ diff --git a/Installation.md b/Installation.md index 4d9e6c5..5213693 100644 --- a/Installation.md +++ b/Installation.md @@ -70,7 +70,7 @@ If you encounter any issues during installation, here are some common troublesho Now that you've successfully installed PolyMPR, you're ready to start exploring its features! Check out the following resources to continue your journey: -- **[Modules](./modules)**: Learn about the core and optional modules available in PolyMPR. 🧩 +- **[Modules](./modules)**: Learn how to create modules in PolyMPR. 🧩 - **[Tutorials](./tutorials)**: Step-by-step guides to help you get the most out of PolyMPR. πŸŽ“ - **[CLI Documentation](./cli)**: Dive into the technical details of PolyMPR's CLI. πŸ“„ - **[FAQs](./faqs)**: Find answers to common questions about PolyMPR. ❓ diff --git a/Modules.md b/Modules.md new file mode 100644 index 0000000..4233c76 --- /dev/null +++ b/Modules.md @@ -0,0 +1,101 @@ +# PolyMPR Modules 🧩 + +PolyMPR is designed with a **modulith architecture** to ensure flexibility, scalability, and ease of maintenance. Each module is a self-contained unit that can be added, removed, or updated independently. πŸ“¦ + +## Create Modules πŸ—οΈ + +Creating modules in PolyMPR is straightforward, thanks to its well-defined structure and conventions. Below, you'll find everything you need to know to build and integrate your own modules into the platform. + +### Module Structure 🧱 + +Each module must be placed inside the `routes/(apps)/` folder and follow the structure outlined below. This ensures consistency and makes it easier to maintain and extend the platform. + +#### Folder Structure: +``` +. +β”œβ”€β”€ api/ # API endpoints for the module +β”œβ”€β”€ (_components)/ # Shared components used within the module +β”œβ”€β”€ (_islands)/ # Interactive islands (client-side components) +β”œβ”€β”€ partials/ # Reusable partial templates +β”‚ └── index.tsx # Entry point for partials +β”œβ”€β”€ (_props)/ +β”‚ └── props.ts # Module-specific props +β”œβ”€β”€ index.tsx # Main entry point for the module +└── types.d.ts # TypeScript type definitions for the module +``` + +### Module Folders Explained 🧱 + +Here’s a breakdown of each folder and its purpose: + +1. **`api/`**: + - Contains API endpoints specific to the module. + - Each file in this folder represents a route handler for the module. + - Example: `api/users.ts` for handling user-related API requests. + +2. **`(_components)/`**: + - Houses shared React components used within the module. + - These components are reusable and can be imported into other parts of the module. + - Example: A `UserCard.tsx` component for displaying user information. + +3. **`(_islands)/`**: + - Contains interactive client-side components (islands) for the module. + - Islands are hydrated on the client side and enable interactivity. + - Example: A `SearchBar.tsx` component with dynamic search functionality. + +4. **`partials/`**: + - Stores reusable partial templates for rendering specific parts of the UI. + - The `index.tsx` file serves as the entry point for partials. + - Example: A `Header.tsx` partial for rendering the module's header. + +5. **`(_props)/`**: + - Defines the properties of the module. + - The CLI creates this file. + +6. **`index.tsx`**: + - The main entry point for the module. + - The CLI creates this file. + +7. **`types.d.ts`**: + - Contains TypeScript type definitions specific to the module. + - This file ensures type safety and consistency across the module. + - Example: Defining types for API responses or component props. + +### Creating a New Module πŸ› οΈ + +To create a new module, you can use the [CLI](./cli): +```bash +pmpr module create +``` +It will create all the required files for a module. + +### Example: User Management Module πŸ‘€ + +Here’s an example of how a `users/` module might look: + +``` +users/ +β”œβ”€β”€ api/ +β”‚ └── users.ts # API endpoints for user management +β”œβ”€β”€ (_components)/ +β”‚ └── UserCard.tsx # Component for displaying user info +β”œβ”€β”€ (_islands)/ +β”‚ └── SearchBar.tsx # Interactive search bar component +β”œβ”€β”€ partials/ +β”‚ └── index.tsx # Entry point for partials +β”œβ”€β”€ (_props)/ +β”‚ └── props.ts # Module-specific props +β”œβ”€β”€ index.tsx # Main entry point for the module +└── types.d.ts # TypeScript type definitions +``` + +## Next Steps πŸš€ + +Now that you know how to create modules, you can start building and customizing PolyMPR to meet your organization's needs. Check out the following resources to continue your journey: + +- **[Tutorials](./tutorials)**: Step-by-step guides to help you get the most out of PolyMPR. πŸŽ“ +- **[CLI Documentation](./cli)**: Dive into the technical details of PolyMPR's CLI. πŸ“„ +- **[FAQs](./faqs)**: Find answers to common questions about PolyMPR. ❓ +- **[Release Notes](./releases)**: Stay up-to-date with the latest features and improvements. πŸ“° + +Thank you for installing PolyMPR! If you have any questions or need further assistance, feel free to reach out to the community or consult the [FAQs](/faqs). Happy coding! πŸ’»βœ¨ \ No newline at end of file