MwalaJS - Complete Documentation

Welcome to MwalaJS! This guide will help you install, configure, and use MwalaJS efficiently.

1. Installation

You can install MwalaJS in multiple ways:

Using GitHub Repository

Clone the repository from GitHub:

git clone https://github.com/mwala400/mwalajs.git

from github https://github.com/mwala400/mwalajs v1.0.0

Using a ZIP, EXE, or RAR File

Download and extract the files from the available compressed format:


1. VERSION RELEASE

Click below to download the installer For Mwalajs framework:


Download MwalaJS COMMAND SHELL (CLS) download .exe file here

Click below to download zip file mwalajs framework:


Download MwalaJS mwalajs.zip v1.0.0

Click below to download rar file mwalajs framework :


Download MwalaJS mwalajs.rar v1.0.0

2. Setting Up MwalaJS

Initialize MwalaJS

mwala init

Creating a New Project

mwala create-project

3. Running the Application

mwala serve

4. Database Operations

Creating a Database

mwala create-db

Creating a Table

mwala create-table <table_name>

Dropping a Table

mwala drop-table <table_name>

5. Code Generation

            mwala generate model <name>
            mwala generate controller <name>
            mwala generate route <name>
            mwala generate view <name>
            mwala generate midware <name>
        

6. Additional Information

For more details, visit: GitHub Repository

MwalaJS Framework Documentation

MwalaJS Framework Documentation

A lightweight, easy-to-use Node.js framework to create scalable web applications with MVC architecture and powerful built-in features.

GitHub Repository: https://github.com/mwala400/mwalajs

1. Overview

MwalaJS is a lightweight, easy-to-use Node.js framework designed to help you create scalable and organized MVC-based web applications. It comes with built-in features for handling routing, models, views, middleware, and database operations.

Download Documentation

1. VERSION RELEASE

Click below to download the installer For Mwalajs framework:


Download MwalaJS COMMAND SHELL (CLS) download .exe file here

Click below to download zip file mwalajs framework:


Download MwalaJS mwalajs.zip v1.0.0

Click below to download rar file mwalajs framework :


Download MwalaJS mwalajs.rar v1.0.0
git clone https://github.com/mwala400/mwalajs.git

Clone from github https://github.com/mwala400/mwalajs v1.0.0

Key Features:

  • MVC Architecture: Automatically generates models, controllers, routes, and views.
  • Database Management: Includes commands to create and drop tables, run migrations, and manage the database.
  • Middleware Support: Add custom middleware to handle requests.
  • EJS Template Engine: Integrated for view rendering.
  • Static File Support: Easily serve static assets like CSS, JavaScript, and images.
MwalaJS Documentation

. Example Application

app.mjs

Here is an example of the default app.mjs file for starting the server:


    import mwalajs from 'mwalajs';
    import { homeRoutes } from './routes/homeRoutes.mjs';
    import { fileURLToPath } from 'url';
    import path from 'path';
    
    const __filename = fileURLToPath(import.meta.url);
    const __dirname = path.dirname(__filename);
    
    mwalajs.set('view engine', 'ejs');
    mwalajs.set('views', path.join(__dirname, 'views'));
    
    mwalajs.static(path.join(__dirname, 'public'));
    
    mwalajs.use('/', homeRoutes);
    
    const port = process.env.PORT || 3000;
    mwalajs.listen(port, () => {
      console.log(`Server running on http://localhost:${port}`);
    });
            

homeRoutes.mjs

Here is an example of the default homeRoutes.mjs file:


    import mwalajs from 'mwalajs';
    import { homeController, Steps, welcome, about } from '../controllers/homeController.mjs';
    
    const router = mwalajs.constructor.Router();
    
    router.get('/', homeController.getHomePage);
    router.get('/steps', Steps.getSteps);
    router.get('/welcome', welcome.getwelcome);
    router.get('/about', about.getabout);
    
    export { router as homeRoutes };
            

homeController.mjs

Here is an example of the homeController.mjs file:


    export const homeController = {
      getHomePage: (req, res) => {
        res.render('index', { title: 'Welcome to MwalaJS MVC' });
      }
    };
    
    export const Steps = {
      getSteps: (req, res) => {
        res.render('steps', { title: 'Steps in MwalaJS MVC' });
      }
    };
    
    export const welcome = {
      getwelcome: (req, res) => {
        res.render('welcome', { title: 'Welcome to MwalaJS MVC' });
      }
    };
    
    export const about = {
      getabout: (req, res) => {
        res.render('about', { title: 'About MwalaJS MVC' });
      }
    };
            

6. Conclusion

MwalaJS is designed to streamline the development of MVC-based applications with its easy-to-use commands for setting up projects, generating components, and managing the database.

For full documentation and to contribute, visit the GitHub repository.

Summary of MwalaJS Commands


    πŸ”Ή General Commands:
      - mwala -v | mwala --version β†’ Show MwalaJS version.
      - mwala help | mwala h β†’ Show help message.
    
    πŸ”Ή Project Management:
      - mwala create-project β†’ Create a new project.
      - mwala init β†’ Initialize MwalaJS.
    
    πŸ”Ή Running the Application:
      - mwala serve | mwala app.mjs β†’ Start MwalaJS app.
    
    πŸ”Ή Database Operations:
      - mwala create-db β†’ Create database from .env file.
      - mwala migrate all β†’ Run all pending migrations.
      - mwala rollback all β†’ Undo migration.
    
    πŸ”Ή Code Generation:
      - mwala generate model  β†’ Create a model.
      - mwala generate controller  β†’ Create a controller.
      - mwala generate route  β†’ Create a route.
      - mwala generate view  β†’ Create a view.
    
    πŸ”Ή To execute a command, use:
      mwala 
            

mwalajsm/ # Root directory

      mwalajsm/               # Root directory
      │── app.mjs             # Main application file
      │── runMigrations.mjs   # Handles database migrations
      │── createProject.mjs   # Script for creating new projects
      │── setupMwalajs.mjs    # Setup script for MwalaJS
      │── start.bat           # Batch script to start the server
      │── setup.bat           # Batch script for installation
      │── setup.bash          # Bash script for installation (Linux/macOS)
      │── setup.sh            # Another installation script
      │── package.json        # Dependencies and project metadata
      │── package-lock.json   # Dependency lock file
      │── README.md           # Documentation for MwalaJS
      │── migrations/         # Database migration files
      │── models/             # Database models
      │── controllers/        # Handles application logic
      │── routes/             # Defines API routes
      │── middlewares/        # Custom middleware for authentication, logging, etc.
      │── config/             # Configuration files (e.g., database, app settings)
      │── public/             # Static assets like CSS, JavaScript, and images
      │── views/              # Template views (if using server-side rendering)
      │── mwalajs/            # Core framework files
      │── dist/               # Compiled or built files
      │── node_modules/       # Dependencies installed via npm
      │── YOUR CREATED PROJECT/       # When run mwala create-project will request project name related files (clarify purpose) 
      │── installer/          # Installation-related files
      │── installerimg.png    # Image used during installation
      │── mwalajs5.png        # Framework branding/image
      │── mwalajs4_RXv_icon.ico # Framework icons
      │── mwalajs4_lyh_icon.ico # Another framework icon
      │── mwalajsm.iss        # Installer script for Windows
      │── background.bmp      # Background image (possibly for setup UI)
      │── background.png      # Another background image
      │── bin/                # Executable files or scripts
      This structure makes MwalaJS a well-organized and scalable framework. To make it even more convincing, you could add:
      
      A "tests/" folder – To show built-in support for unit and integration tests.
      A "docs/" folder – Dedicated to documentation with detailed guides.
      A "scripts/" folder – For automation scripts instead of having them in the root directory.
      A "logs/" folder – To store logs instead of scattering them.
      

```
## Getting Started
### Installation
1. **Install MwalaJS globally:**
   ```sh
   npm install -g mwalajs
   ```
   OR Run
   mwala init
2. **Create a new project:**
   ```sh
   mwalajs create-project
   will request project name example myApp
   cd myApp
   npm install
   ```
   mwala init

3. **Run the development server:**
   ```sh
   mwala serve
   OR
   mwala app.mjs
   OR
   pm2 start app.mjs
   OR
   node app.mjs
   OR RUN
   npm start
   ```

## Sample Code
A simple MwalaJS route example:
Your MwalaJS file structure is well-organized, but to make it more convincing for developers to switch, consider:

1. Clean File Structure Explanation
HereÒ€ℒs a structured breakdown:

FOLDERS


  πŸ“‚ mwalajsm/              # Root directory  
  │── πŸ“œ app.mjs           # Main application entry point  
  │── πŸ“‚ ATTENDANCE/       # Attendance-related files (clarify purpose)  
  │── πŸ“‚ bin/              # Executable scripts  
  │── πŸ“‚ config/           # Configuration files  
  │── πŸ“‚ controllers/      # Business logic controllers  
  │── πŸ“‚ middlewares/      # Request middlewares  
  │── πŸ“‚ migrations/       # Database migrations  
  │── πŸ“‚ models/           # Database models  
  │── πŸ“‚ mwalajs/          # Core framework code  
  │── πŸ“‚ public/           # Static assets (CSS, JS, Images)  
  │── πŸ“‚ routes/           # API & web routes  
  │── πŸ“‚ views/            # Frontend templates (if using templating)  
  │── πŸ“‚ dist/             # Compiled or bundled output  
  │── πŸ“œ package.json      # Dependencies & scripts  
  │── πŸ“œ README.md         # Project documentation  
  │── πŸ“œ start.bat         # Windows startup script  
  │── πŸ“œ setup.sh          # Unix-based setup script  
  │── πŸ“œ createProject.mjs # Automates project creation  
  │── πŸ“œ runMigrations.mjs # Database migration script  
  │── πŸ“‚ installer/        # Installer-related files  
  │── πŸ“‚ node_modules/     # Dependencies  
  2. Why Developers Should Switch to MwalaJS
  MwalaJS should highlight:
  βœ… Better modular structure (prevents spaghetti code)
  βœ… Built-in migrations & models (reduces DB setup time)
  βœ… Simplified setup scripts (automates installation)
  βœ… Performance optimizations (mention key tech choices)
  βœ… Security-first approach (middleware for authentication, validation)
  
3. Preventing Module Repetition
Are there duplicate functionalities in middlewares/, controllers/, or mwalajs/?
If mwalajs/ is the core framework, maybe avoid repeating similar logic inside controllers/

## Future of Web Development
MwalaJS is designed to replace traditional frameworks by offering a modern, easy-to-use,
and high-performance alternative. Whether you are building a simple website or a complex web application,
MwalaJS provides the tools you need for success.
## Contribute
We welcome contributors! Feel free to fork the repository, submit issues, and make pull requests.

## License
MwalaJS is open-source and licensed under the MIT License.