WebApp 2.0.1 Features

Comprehensive overview of WebApp package features and capabilities

WebApp Package Features

WebApp Package is a robust Dart package designed to streamline the development of powerful web applications. With version 2.0.1, we've introduced significant new features and improvements.

🚀 Rapid API Development

The WebApp package provides a streamlined framework for setting up and managing APIs. Define endpoints, handle requests, and manage responses effortlessly, enabling you to focus on building the core functionality of your application.

Key Benefits:

  • Quick endpoint definition
  • Automatic request/response handling
  • Built-in middleware support
  • RESTful API standards compliance

🗄️ Database Support

MongoDB Integration

Integrate MongoDB seamlessly into your web application. The package offers tools to connect to MongoDB instances, perform CRUD operations, and manage data efficiently.

  • Database connection management
  • CRUD operations with type safety
  • Query builder for complex operations
  • Schema validation and data modeling

MySQL Database Support (NEW in v2.0.1)

Full-featured MySQL integration with comprehensive database management tools:

  • MySQL Query Builder: Type-safe SQL query construction with fluent API
  • Database Migrations: Automated schema management and version control
  • Table Management: Create, modify, and manage MySQL tables programmatically
  • Connection Management: Efficient connection pooling and management
  • Advanced SQL Features: Support for joins, subqueries, aggregations, and complex conditions
// Example MySQL query
var query = Q()
  .selects([QSelectAll()])
  .from(QField('users'))
  .where(WhereOne(QField('status'), QO.EQ, QVar('active')))
  .orderBy(QOrder('created_at', desc: true))
  .limit(10);

📚 OpenAPI v3.0 Documentation (NEW)

Automatically generate OpenAPI v3.0 documentation for your APIs. This feature facilitates the use of UI tools like Swagger, providing an interactive interface for testing and exploring your APIs.

Features:

  • Automatic API documentation generation
  • Swagger UI integration
  • Interactive API testing
  • Client SDK generation support
  • Schema validation documentation

🎨 Frontend Widget Creation

Develop and manage reusable frontend widgets to render dynamic content. The package supports the creation of interactive UI components, enhancing the user experience and ensuring consistency across your web application.

Capabilities:

  • Dynamic widget rendering
  • Template engine integration (Jinja2)
  • Asset management
  • Component reusability

🔄 WebSocket Support

Implement real-time communication features using WebSockets. Whether you're building chat applications, live data feeds, or interactive dashboards, the WebApp package makes adding WebSocket functionality straightforward and efficient.

Features:

  • Real-time bidirectional communication
  • Connection management
  • Broadcasting to multiple clients
  • Event-driven architecture
// WebSocket example
final socketManager = SocketManager(
  server,
  event: SocketEvent(
    onConnect: (socket) {
      socket.send({'message': 'Welcome!'}, path: 'connected');
    },
    onMessage: (socket, data) {
      // Handle incoming messages
    },
  ),
);

🔧 Nginx Compatibility

Deploy your Dart web application with ease using Nginx. The package is designed to work seamlessly with Nginx, providing robust and scalable server management suitable for production environments.

📧 SMTP Email Sending

Send emails directly from your web application using the Simple Mail Transfer Protocol (SMTP). Essential for functionalities like user registration, password recovery, and sending notifications.

bool success = await MailSender.sendEmail(
  from: 'sender@example.com',
  to: ['recipient@example.com'],
  subject: 'Welcome!',
  html: '<h1>Welcome to our service!</h1>',
  // SMTP configuration...
);

🛠️ Comprehensive Data Handling Tools

Simplify web development with built-in tools for managing common data structures such as Strings, Maps, and Lists. These utilities include string encoding and manipulation, as well as efficient handling of Maps and Lists.

🔐 Advanced Routing with Authentication

Handle client-side request routing effectively with built-in support for managing authentication and permissions. Define secure routes and control access to various parts of your application effortlessly.

Features:

  • Route-level authentication
  • Permission-based access control
  • Middleware support
  • Dynamic routing with parameters
WebRoute(
  path: 'admin/panel',
  rq: rq,
  index: adminController.panel,
  auth: authController,
  permissions: ['admin'],
)

🏗️ MVC Architecture for Scalability

Scale large projects effortlessly using the Model-View-Controller (MVC) architecture. Extend the provided classes such as WaController, DBModel, and DBCollection to structure your application logically and maintainably.

✅ Form Validators

Utilize built-in FormValidators to manage and validate client-side data on the server. This feature ensures data integrity and security by validating API requests and user inputs effectively.

Validation Types:

  • Email validation
  • Required field validation
  • Length constraints
  • Custom validation rules
  • Server-side validation

⏰ CronJob Development

Implement scheduled tasks quickly using the WaCron class. Automate routine operations, such as data backups or periodic data processing, with minimal configuration.

WaCron.schedule('0 0 * * *', () async {
  // Daily backup task
  await performDatabaseBackup();
});

🎯 Flexible Output Rendering

Render client requests using various methods, including JSON, HTML, Text, Widgets, and variable dumps. The package supports multiple output formats, allowing you to present data in the most appropriate form for your users.

📦 Asset Management

Manage and include assets effortlessly during request rendering. Extend the Layout class and use the include_controller to add and manage assets, ensuring your application resources are well-organized and easily accessible.

🛠️ WebApp CLI

Powerful command-line interface for project management:

webapp create --name myapp    # Create new project
webapp run                    # Run your application
webapp build                  # Build for production
webapp test                   # Run tests

🔄 Easy Socket Request Development

Develop and manage Socket requests with ease. The WebApp package provides intuitive APIs to handle Socket connections, enabling real-time data exchange and interactive features.

📊 Performance Features

  • Connection pooling for databases
  • Efficient memory management
  • Optimized query execution
  • Caching support
  • Load balancing ready

🔧 Development Tools

  • Hot reload support
  • Debug logging
  • Error handling and reporting
  • Testing utilities
  • Development server

Getting Started

  1. Installation: dart pub add webapp
  2. CLI Setup: dart pub global activate webapp
  3. Create Project: webapp create --name myapp
  4. Start Development: webapp run

Platform Support

  • Dart: 3.0+ compatible
  • Platforms: Android, iOS, Linux, macOS, Web, Windows
  • SDK: Dart & Flutter