πŸ—οΈFeatures and Modules

🎯 Understanding Modules and Features

Flexbase organizes enterprise applications into Modules and Features - a clear, business-focused approach that maps directly to your requirements and user interface actions.


πŸ“¦ What is a Module?

A Module represents a complete business domain or functional area of your application. Think of it as a self-contained unit that handles all operations related to a specific business concept.

Examples of Modules:

  • πŸ›’ Orders Module - Complete order management

  • πŸ“¦ Products Module - Product catalog and inventory

  • πŸ’³ Payments Module - Payment processing

  • πŸ‘₯ Customers Module - Customer management

  • πŸ“Š Reports Module - Analytics and reporting


⚑ What is a Feature?

A Feature represents a single business action or operation within a module. Every button click, form submission, or user action in your application typically maps to one feature.

Feature Examples:

  • Insert (POST): AddOrder, CreateProduct, RegisterCustomer

  • Query (GET): GetOrders, SearchProducts, GetCustomerDetails

  • Update (PUT): UpdateOrder, ModifyProduct, EditCustomer

  • Delete (DELETE): CancelOrder, RemoveProduct, DeactivateCustomer


πŸ”„ Business Requirements β†’ Technical Mapping

The Mapping Process:

  1. Identify Business Domains β†’ Create Modules

  2. Identify User Actions β†’ Create Features

  3. Define Data Requirements β†’ Create DTOs

  4. Specify Business Rules β†’ Create Domain Logic


πŸ“‹ Real-World Example: E-Commerce Application

Let's walk through a complete example of how business requirements translate to Flexbase modules and features.

Business Requirements:

"We need an e-commerce system where customers can browse products, place orders, and make payments. Administrators should be able to manage products and view order reports."


πŸ›’ Module 1: Orders Module

Business Domain: Order Management

Features in Orders Module:

1. AddOrder Feature (POST)

Business Requirement: "Customer clicks 'Place Order' button"

Screen Action: Customer fills order form and clicks "Place Order"

Technical Implementation:

API Endpoint: POST /api/Orders/AddOrder

2. GetOrders Feature (GET)

Business Requirement: "Admin clicks 'View Orders' to see all orders"

Screen Action: Admin navigates to Orders page

Technical Implementation:

πŸš€ Database Optimization Magic - No Complex SQL Required!

The beauty of Flexbase queries is that you don't write complex SELECT statements! Here's what happens automatically:

1. Automatic Projection to Output Model

2. Database-Level Optimization

What Flexbase generates automatically:

3. Performance Benefits

  • βœ… Only Required Fields - Database fetches only what's in your DTO

  • βœ… Automatic Joins - Include() statements become optimized SQL JOINs

  • βœ… No N+1 Queries - Single query with proper joins

  • βœ… Memory Efficient - No unnecessary data loaded into memory

  • βœ… Network Optimized - Less data transferred over the network

4. Complex Projections Made Simple

5. What You DON'T Have to Write

6. What You DO Write (Simple and Clean)

🎯 Key Benefits:

  1. No SQL Knowledge Required - Write C# LINQ, get optimized SQL

  2. Automatic Optimization - Only fetch what you need

  3. Type Safety - Compile-time validation of all projections

  4. Maintainable - Changes to DTO automatically update SQL

  5. Performance - Database-level optimization without complexity

  6. Readable - Business logic is clear and understandable

πŸ’‘ The Magic of SelectTo()

The SelectTo<GetOrdersDto>() method:

  • βœ… Analyzes your DTO - Sees what fields you need

  • βœ… Generates optimized SQL - Only selects required columns

  • βœ… Handles joins automatically - Based on Include() statements

  • βœ… Applies projections - Maps complex calculations

  • βœ… Optimizes performance - Database-level efficiency

Result: You focus on business logic while Flexbase handles all the complex SQL optimization automatically!

API Endpoint: GET /api/Orders/GetOrders


πŸ“¦ Module 2: Products Module

Business Domain: Product Catalog Management

Features in Products Module:

1. AddProduct Feature (POST)

Business Requirement: "Admin clicks 'Add New Product' button"

Screen Action: Admin fills product form and clicks "Save Product"

Technical Implementation:

API Endpoint: POST /api/Products/AddProduct

2. GetProducts Feature (GET)

Business Requirement: "Customer clicks 'Browse Products' to see available products"

Screen Action: Customer navigates to Products page

Technical Implementation:

API Endpoint: GET /api/Products/GetProducts


🎯 Screen-to-Feature Mapping Examples

Example 1: Customer Order Screen

Screen Element
User Action
Feature
HTTP Method
Endpoint

"Place Order" Button

Click

AddOrder

POST

/api/Orders/AddOrder

"View My Orders" Link

Click

GetCustomerOrders

GET

/api/Orders/GetCustomerOrders

"Order Details" Link

Click

GetOrderDetails

GET

/api/Orders/GetOrderDetails

"Cancel Order" Button

Click

CancelOrder

PUT

/api/Orders/CancelOrder

Example 2: Admin Product Management Screen

Screen Element
User Action
Feature
HTTP Method
Endpoint

"Add Product" Button

Click

AddProduct

POST

/api/Products/AddProduct

"Edit Product" Button

Click

UpdateProduct

PUT

/api/Products/UpdateProduct

"Delete Product" Button

Click

DeleteProduct

DELETE

/api/Products/DeleteProduct

"Search Products" Input

Type + Enter

SearchProducts

GET

/api/Products/SearchProducts

"Filter by Category" Dropdown

Select

GetProductsByCategory

GET

/api/Products/GetProductsByCategory

Example 3: Customer Dashboard Screen

Screen Element
User Action
Feature
HTTP Method
Endpoint

"View Profile" Link

Click

GetCustomerProfile

GET

/api/Customers/GetCustomerProfile

"Edit Profile" Button

Click

UpdateCustomerProfile

PUT

/api/Customers/UpdateCustomerProfile

"Order History" Tab

Click

GetOrderHistory

GET

/api/Orders/GetOrderHistory

"Wishlist" Tab

Click

GetWishlist

GET

/api/Products/GetWishlist


πŸ—οΈ Complete Module Structure

Typical Module Contains:


🎯 Feature Development Workflow

Step 1: Identify Business Requirement

"Customer needs to be able to place an order"

Step 2: Map to Screen Action

"Customer clicks 'Place Order' button on order form"

Step 3: Define Feature

"AddOrder feature in Orders module"

Step 4: Generate Code

Step 5: Add Business Logic

Step 6: Test and Deploy

  • βœ… Unit tests generated automatically

  • βœ… Integration tests ready

  • βœ… API documentation generated

  • βœ… Ready for deployment


πŸ“Š Module Planning Template

For Each Business Domain, Ask:

  1. What is the main business concept? β†’ Module Name

  2. What actions can users perform? β†’ Features

  3. What data is needed for each action? β†’ DTOs

  4. What business rules apply? β†’ Domain Logic

  5. What events should be published? β†’ Domain Events

Example: Customer Management Module

Question
Answer

Main Business Concept

Customer Management

User Actions

Register, Login, Update Profile, View Profile, Deactivate

Data Requirements

Name, Email, Phone, Address, Preferences

Business Rules

Email validation, Password requirements, Profile completeness

Events

CustomerRegistered, ProfileUpdated, CustomerDeactivated


πŸš€ Best Practices

Module Design:

  • βœ… Single Responsibility - One business domain per module

  • βœ… Clear Boundaries - Minimal coupling between modules

  • βœ… Consistent Naming - Follow business terminology

  • βœ… Complete Coverage - All related features in one module

Feature Design:

  • βœ… One Action Per Feature - Each feature does one thing

  • βœ… Clear Input/Output - Well-defined DTOs

  • βœ… Business Logic in Domain - Keep controllers thin

  • βœ… Proper Validation - Validate at multiple levels

Naming Conventions:

  • Modules: OrdersModule, ProductsModule, CustomersModule

  • Features: AddOrder, GetOrders, UpdateProduct, DeleteCustomer

  • DTOs: AddOrderDto, GetOrdersDto, OrderDto

  • Handlers: AddOrderHandler, GetOrdersHandler


πŸŽ‰ Summary

Flexbase Modules and Features provide a clear, business-focused approach to enterprise application development:

  • Modules = Business domains (Orders, Products, Customers)

  • Features = User actions (AddOrder, GetProducts, UpdateCustomer)

  • Screen Actions = Direct mapping to features

  • Business Requirements = Clear path to technical implementation

The result: A maintainable, scalable application that directly reflects your business needs and user interface requirements.


Start mapping your business requirements to Flexbase modules and features today. Transform your ideas into working enterprise applications in minutes, not months.

Last updated