Now.js Framework Documentation

Now.js Framework Documentation

Now.js Framework

EN 22 Nov 2025 02:24

Now.js Framework

Modern JavaScript Framework that Minimizes Code Writing
Write Less JavaScript, Achieve More with the Power of Data Attributes

Overview

Now.js is a JavaScript Framework designed to minimize JavaScript coding by using Data Attributes to control web page behavior and automatically invoke pre-installed features.

Core Philosophy

<!-- Instead of writing JavaScript like this... -->
<script>
  document.querySelector('#myForm').addEventListener('submit', async (e) => {
    e.preventDefault();
    const data = new FormData(e.target);
    await fetch('/api/submit', { method: 'POST', body: data });
  });
</script>

<!-- Just use Data Attributes! -->
<form data-form data-action="/api/submit" data-method="POST">
  <!-- Your form content -->
</form>

No additional JavaScript needed! The framework handles everything automatically.

Key Features

Zero JavaScript Writing

  • No JavaScript required for common tasks
  • Control everything through HTML Data Attributes
  • Automatic initialization on page load

Component-Based Architecture

  • Powerful Component System
  • Two-Way Reactive Data Binding
  • Built-in Template Engine
  • Automatic State Management

Rich UI Components

  • Form Management - Automatic form handling
  • DataTable - Data tables with sorting, filtering, pagination
  • Animation System - Easy-to-use animation system
  • Modal & Dialog - Ready-to-use popups and dialogs
  • Autocomplete - Automatic search system
  • Calendar - Calendar and date picker
  • File Upload - File upload with preview
  • Tags Input - Easy-to-use tag system

Advanced Features

  • Router System - Single Page Application (SPA) Routing
  • HTTP Client - Automatic API request handling
  • Authentication - Auth system with Token Management
  • i18n Support - Multi-language support
  • Service Worker - PWA Support
  • Error Handling - Automatic error management
  • Event System - Powerful event system

Framework Goals

Now.js aims to:

  1. Minimize JavaScript writing as much as possible
  2. Increase development efficiency using Data Attributes
  3. Work automatically without additional code
  4. Simplify complexity for developers
  5. Support all use cases from simple websites to large SPAs

Getting Started

Installation

<!-- Method 1: Use CDN -->
<script src="https://cdn.example.com/now.js"></script>

<!-- Method 2: Download and use locally -->
<script src="/path/to/Now.js"></script>

Basic Usage Examples

1. Form Management

<form data-form data-action="/api/users" data-method="POST">
  <input type="text" name="name" data-required>
  <input type="email" name="email" data-required data-validate="email">
  <button type="submit">Save</button>
</form>

Automatic features:

  • ✅ Validation
  • ✅ AJAX Submission
  • ✅ Error Handling
  • ✅ Loading States

2. DataTable

<table data-table
       data-source="/api/users"
       data-pagination="true"
       data-search="true">
  <thead>
    <tr>
      <th data-sort="name">Name</th>
      <th data-sort="email">Email</th>
      <th data-field="actions">Actions</th>
    </tr>
  </thead>
</table>

Automatic features:

  • ✅ Data Loading
  • ✅ Sorting
  • ✅ Filtering
  • ✅ Pagination
  • ✅ Search

3. Animation

<div data-show="fadeIn" data-hide="fadeOut">
  Animated content
</div>

<button data-on-click="toggle" data-target="#myElement">
  Toggle Display
</button>

4. Component System

<div data-component="UserProfile" data-user-id="123">
  <h2 data-bind="user.name"></h2>
  <p data-bind="user.email"></p>

  <ul data-for="post in user.posts">
    <li data-bind="post.title"></li>
  </ul>
</div>

Documentation

Core Modules

Form & Input

Data & API

Table & Data Display

Routing & Navigation

Authentication

Events & Interactions

Internationalization

Progressive Web App

Guides

Real-World Examples

Example 1: CRUD Form

<form data-form
      data-action="/api/products"
      data-method="POST"
      data-on-success="redirect:/products">

  <input type="text"
         name="name"
         data-required
         data-min-length="3"
         placeholder="Product Name">

  <input type="number"
         name="price"
         data-required
         data-min="0"
         placeholder="Price">

  <select name="category" data-required>
    <option value="">Select Category</option>
    <option value="1">Electronics</option>
    <option value="2">Clothing</option>
  </select>

  <textarea name="description"
            data-required
            placeholder="Description"></textarea>

  <button type="submit">Save</button>
</form>

Example 2: Interactive DataTable

<table data-table
       data-source="/api/products"
       data-pagination="true"
       data-page-size="10"
       data-search="true"
       data-row-actions="edit,delete">
  <thead>
    <tr>
      <th data-sort="name" data-field="name">Product Name</th>
      <th data-sort="price" data-field="price">Price</th>
      <th data-field="category">Category</th>
      <th data-field="actions">Actions</th>
    </tr>
  </thead>
</table>

Example 3: Reactive Component

<div data-component="ProductList" data-source="/api/products">
  <!-- Search -->
  <input type="text"
         data-model="search"
         placeholder="Search products">

  <!-- Product List -->
  <div data-for="product in filteredProducts">
    <div class="product-card">
      <h3 data-bind="product.name"></h3>
      <p data-bind="product.price" data-format="currency"></p>
      <button data-on-click="addToCart(product.id)">
        Add to Cart
      </button>
    </div>
  </div>

  <!-- Empty State -->
  <div data-if="filteredProducts.length === 0">
    <p>No products found</p>
  </div>
</div>

Architecture

Framework Workflow

graph TD
    A[HTML with Data Attributes] --> B[Now.js Core]
    B --> C[Auto-Initialize Components]
    C --> D[Form Manager]
    C --> E[Table Manager]
    C --> F[Component Manager]
    C --> G[Router Manager]
    C --> H[Event Manager]

    D --> I[Automatic Validation]
    D --> J[AJAX Submission]

    E --> K[Data Loading]
    E --> L[Sorting & Filtering]

    F --> M[Reactive Binding]
    F --> N[State Management]

    G --> O[SPA Navigation]

    H --> P[Event Handling]

Execution Steps

  1. Load Now.js - Framework loads and becomes ready
  2. Scan DOM - Find elements with Data Attributes
  3. Auto-Initialize - Create Components and Managers automatically
  4. Bind Events - Attach Event Handlers based on Attributes
  5. Ready - Ready to use without additional code

Core Concepts

1. Declarative Programming

Use HTML Attributes to declare what you want instead of coding how to do it

2. Convention over Configuration

Use sensible defaults, reduce complex configuration

3. Progressive Enhancement

Start with basics, add features as needed

4. Zero Configuration

Works immediately without setup

Important Data Attributes

Form Attributes

  • data-form - Define as managed form
  • data-action - URL for data submission
  • data-method - HTTP Method (GET, POST, PUT, DELETE)
  • data-required - Required field
  • data-validate - Validation rules
  • data-on-success - Action on success
  • data-on-error - Action on error

Table Attributes

  • data-table - Define as managed table
  • data-source - URL for data loading
  • data-pagination - Enable/disable pagination
  • data-search - Enable/disable search
  • data-sort - Sortable column
  • data-row-actions - Actions for each row

Component Attributes

  • data-component - Component name
  • data-bind - Data binding
  • data-model - Two-way data binding
  • data-for - Loop template
  • data-if - Conditional rendering
  • data-show - Show animation
  • data-hide - Hide animation

Event Attributes

  • data-on-click - Click event
  • data-on-change - Change event
  • data-on-submit - Submit event
  • data-target - Target element

Advantages of Now.js

For Developers

  • Write less code - Reduce development time
  • Easy to read - Code is easy to understand and maintain
  • No build required - No Webpack, Babel, etc.
  • Easy to learn - Low learning curve
  • Flexible - Works with other libraries

For Projects

  • Performance - Fast loading, fast execution
  • Maintainable - Easy to maintain
  • Scalable - Scales as needed
  • SEO Friendly - SEO support
  • Accessible - Accessibility support

When to Use Now.js

Ideal For

  • ✅ General web applications
  • ✅ Admin Panels / Dashboards
  • ✅ CRUD Applications
  • ✅ Forms-heavy Applications
  • ✅ Data-intensive Applications
  • ✅ Single Page Applications (SPA)
  • ✅ Progressive Web Apps (PWA)

May Not Be Ideal For

  • ❌ Games requiring very high performance
  • ❌ Very complex real-time applications
  • ❌ 3D Graphics Applications

Learning Path

  1. Start with Basics

    • Read FormManager to learn form management
    • Try creating a simple form
  2. Understand Data Attributes

    • Study commonly used attributes
    • Try them in a small project
  3. Learn Components

  4. Study Advanced Features

  5. Build Real Projects

    • Apply knowledge to real projects
    • Experiment with different features

License

Now.js is released under the MIT License.

Ready to Get Started?

Start using Now.js today and experience web development where you write less code and achieve more!

<!-- That's all you need! -->
<script src="Now.js"></script>