khadem 1.0.0-beta copy "khadem: ^1.0.0-beta" to clipboard
khadem: ^1.0.0-beta copied to clipboard

A powerful and modern Dart backend framework for building scalable web applications with built-in CLI tools, code generation, database management, caching, authentication, and production-ready deploym [...]

[Khadem Framework]
Status Version Dart License

Khadem #

โšก A powerful, modern Dart backend framework for building scalable web applications

Khadem is a comprehensive backend framework built with Dart, designed for developers who demand performance, elegance, and full control. It provides a complete toolkit for building robust web applications with features like dependency injection, modular architecture, built-in CLI tools with automatic command discovery, database management, caching, authentication, and production-ready deployment capabilities.


๐Ÿš€ Key Features #

Core Architecture #

  • ๐Ÿš€ High Performance: Built with Dart for exceptional speed and efficiency
  • ๐Ÿงฑ Modular Design: Service provider architecture for clean, maintainable code
  • ๐Ÿ“ฆ Dependency Injection: Flexible container-based dependency management
  • โš™๏ธ Configuration System: Environment-aware configuration with dot-notation support

Development Tools #

  • ๐Ÿ› ๏ธ Powerful CLI: Comprehensive command-line tools with auto-discovery
  • ๐Ÿค– Code Generation: Automated generation of models, controllers, middleware, providers, jobs, and listeners
  • ๐Ÿ”ฅ Hot Reload: Development server with hot reload support
  • ๐Ÿ“ Migration System: Database migration and seeding support

Data & Storage #

  • ๐Ÿ—„๏ธ Database Layer: Support for MySQL with ORM capabilities
  • ๐Ÿ’พ Multiple Drivers: MySQL, Redis, and extensible driver system
  • ๐Ÿงต Queue System: Background job processing with Redis support
  • ๐Ÿ“ File Storage: Flexible file upload and storage management

Security & Auth #

  • ๐Ÿ” JWT Authentication: Secure token-based authentication system
  • ๐Ÿ›ก๏ธ Middleware System: Request/response middleware for security and processing
  • โœ… Input Validation: Comprehensive validation rules and error handling
  • ๐Ÿ”’ Security Features: Built-in protection against common web vulnerabilities

Production Ready #

  • ๐Ÿ“ˆ Caching: Multiple caching drivers (Redis, memory-based)
  • โฐ Task Scheduling: Background job scheduling and processing
  • ๐Ÿ“ Logging: Structured logging with multiple output formats

๐Ÿ“ฆ Installation #

Install Khadem CLI globally for project management:

# Install from local source (for development)
dart pub global activate --source path /path/to/khadem

Requirements #

  • Dart SDK: >=3.0.0
  • Supported Platforms: Windows, macOS, Linux
  • Database: MySQL (optional)
  • Cache: Redis (optional)

Core Dependencies #

Khadem uses these key dependencies for optimal performance:

  • args: Command-line argument parsing for CLI tools
  • mysql1: MySQL database connectivity
  • redis: Redis caching and queue support
  • dart_jsonwebtoken: JWT authentication
  • dotenv: Environment variable management
  • watcher: File watching for hot reload
  • yaml: YAML configuration parsing

โšก Quick Start #

Get started with Khadem in minutes:

1. Create New Project Structure #

khadem new --name=my_app
cd my_app
dart pub get

2. Start Development Server #

# Run your Khadem application
dart run bin/server.dart

# Or use CLI for hot reload:
# khadem serve

Your application will be running at http://localhost:3000 with hot reload enabled!


๐Ÿ“ Project Structure #

A typical Khadem project follows this structure:

my_app/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ http/
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/     # HTTP controllers
โ”‚   โ”‚   โ””โ”€โ”€ middleware/      # HTTP middleware
โ”‚   โ”œโ”€โ”€ jobs/               # Background job classes
โ”‚   โ”œโ”€โ”€ listeners/          # Event listeners
โ”‚   โ”œโ”€โ”€ models/             # Data models
โ”‚   โ””โ”€โ”€ providers/          # Service providers
โ”œโ”€โ”€ bin/
โ”‚   โ””โ”€โ”€ server.dart         # Application entry point
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ app.dart           # Application configuration
โ”‚   โ””โ”€โ”€ development/       # Environment-specific configs
โ”œโ”€โ”€ core/
โ”‚   โ””โ”€โ”€ kernel.dart        # Application kernel
โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ migrations/        # Database migrations
โ”‚   โ””โ”€โ”€ seeders/          # Database seeders
โ”œโ”€โ”€ lang/
โ”‚   โ”œโ”€โ”€ ar/               # Arabic translations
โ”‚   โ””โ”€โ”€ en/               # English translations
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ index.html        # Static files
โ”œโ”€โ”€ resources/
โ”‚   โ””โ”€โ”€ views/            # View templates
โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ web.dart          # Web routes
โ”‚   โ””โ”€โ”€ socket.dart       # Socket routes
โ”œโ”€โ”€ storage/              # File storage
โ”œโ”€โ”€ tests/                # Test files
โ”œโ”€โ”€ .env                  # Environment variables
โ””โ”€โ”€ pubspec.yaml

๐Ÿ› ๏ธ CLI Commands #

Khadem features a powerful CLI with automatic command discovery:

๐ŸŽฏ Available Commands #

Project Management #

# Create new project
khadem new --name=project_name

# Start development server with hot reload
khadem serve

# Build for production
khadem build

Code Generation #

khadem make:model --name=User
khadem make:controller --name=UserController
khadem make:middleware --name=AuthMiddleware
khadem make:provider --name=AuthServiceProvider
khadem make:job --name=SendEmailJob
khadem make:listener --name=UserEventListener
khadem make:migration --name=create_users_table

Version Information #

khadem --version                  # Show version information
khadem version --verbose          # Show detailed version info

The version command reads information dynamically from pubspec.yaml, ensuring version information is always up-to-date and synchronized with your package configuration.


๐Ÿ’ก Core Concepts #

Service Providers #

Organize your application logic with service providers:

class AppServiceProvider extends ServiceProvider {
  @override
  void register(container) {}

  @override
  Future<void> boot(container) async {}
}

Dependency Injection #

Use the container for clean dependency management:

class UserController {
  final UserRepository repository;

  UserController(this.repository);

  // Constructor injection
}

Middleware System #

Add cross-cutting concerns with middleware:

class AuthMiddleware implements Middleware {
  @override
  MiddlewareHandler get handler => (req, res, next) async {
        // Check authentication logic here (e.g., verify JWT token)
        await next();
      };

  @override
  String get name => 'Auth';

  @override
  MiddlewarePriority get priority => MiddlewarePriority.global;
}

๐ŸŒŸ Why Choose Khadem? #

  • โšก Performance First: Built with Dart for exceptional speed and efficiency
  • ๐ŸŽฏ Developer Experience: Intuitive API design with excellent tooling and auto-discovery
  • ๐Ÿ”ง Full Control: No magic - complete transparency and control over your application
  • ๐Ÿ“ˆ Scalable: Designed to handle growth from prototype to production scale
  • ๐Ÿ”’ Secure: Security best practices built-in from the ground up
  • ๐ŸŒ Growing Ecosystem: Active development with expanding feature set
  • ๐Ÿค– Smart CLI: Powerful command-line tools with automatic discovery
  • ๐Ÿ”ฅ Modern: Takes advantage of latest Dart features and best practices
  • ๐Ÿ“Š Dynamic Configuration: Version and metadata automatically synchronized

๏ฟฝ License #

Khadem is licensed under the Apache License 2.0. This permissive license allows you to use, modify, and distribute the framework freely, including for commercial purposes, as long as you include the original copyright notice and license text.

For more details, see the LICENSE.md file in this repository.


๏ฟฝ๐Ÿ“ž Support & Community #

  • ๐Ÿ› Bug Reports: GitHub Issues
  • ๐Ÿ’ก Feature Requests: GitHub Discussions
  • ๐Ÿ’ฌ Community: Join our growing community of Dart backend developers

Getting Help #

  1. Check the README - Most common questions are answered here
  2. Browse existing issues - Your question might already be answered
  3. Create a new issue - For bugs, include code examples and error messages
  4. Start a discussion - For feature requests and general questions

Built with โค๏ธ for the Dart community by Khedr Mahmoud

"Empowering developers to build powerful backend applications with the elegance and performance of Dart"


2
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful and modern Dart backend framework for building scalable web applications with built-in CLI tools, code generation, database management, caching, authentication, and production-ready deployment features.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

archive, args, crypto, dart_jsonwebtoken, dotenv, glob, intl, mime, mysql1, package_config, path, recase, redis, timezone, uuid, vm_service, watcher, yaml, yaml_edit

More

Packages that depend on khadem