Skip to content

pimedad/frontend-framework

Repository files navigation

Front-end Framework

Version Build Status PRs Welcome DotJs

frontend framework

DotJS Framework is a component-based frontend framework for building dynamic single-page applications (SPAs) using vanilla JavaScript. It provides a minimal API, virtual DOM rendering, state management, client-side routing, and task scheduling, all built on standard browser APIs without external dependencies.

This README serves as the entry point to the framework, guiding you through its architecture, features, and setup. Use the table of contents to navigate quickly or explore the sections below for an overview.


Table of Contents

Architecture

DotJS Framework is modular, with each module handling a specific responsibility. Below is an overview of the core modules:

  • index.js (Public API): The entry point, exporting functions like createApp, defineComponent, h, and routing components for building applications.
  • app.js (Application Lifecycle): Manages mounting and unmounting the root component, integrating with the router and virtual DOM.
  • component.js (Components): Defines reusable components with state, props, and lifecycle hooks (onMounted, onUnmounted).
  • h.js (Virtual DOM): Creates virtual DOM nodes (h, hString, hFragment, hSlot) for efficient rendering.
  • router.js (Routing): Implements hash-based client-side routing with HashRouter, supporting dynamic routes and guards.
  • scheduler.js (Task Scheduling): Manages asynchronous tasks, ensuring lifecycle hooks run in order using the microtask queue.
  • Utility Modules (utils/): Helper functions for arrays, objects, props, and strings, used internally by the framework.

Details: For a deeper dive, see the Framework Documentation section, which links to individual module guides.


Design Principles

DotJS is guided by these core ideas:

  1. Simplicity: A minimal and intuitive API. We favor clarity over feature bloat.
  2. Developer Control: Understandable and predictable behavior. No hidden magic, what you see is what you get.
  3. Vanilla First: Built on standard browser APIs, avoiding external framework dependencies.
  4. Inversion of Control: As a framework, DotJS calls your code (like component functions) to construct the application.
  5. Progressive Enhancement: Start with the basics and build up complexity as needed.

Getting Started

Prerequisites

Before installing the DotJS framework, ensure you have the following tools installed:

  • Node.js: Version 18.x or higher (includes npm). Download from nodejs.org.
  • Java Development Kit (JDK): Version 21 or higher (for the backend of the example Todo app). Download from oracle.com or use an OpenJDK distribution.
  • PostgreSQL: Version 13 or higher (for the example Todo app's database). Download from postgresql.org.
  • Git: To clone the repository. Download from git-scm.com.
  • A code editor: Such as Visual Studio Code or IntelliJ IDEA for editing project files.

Ensure these tools are properly installed and accessible from your terminal or command prompt.

See the Installation Instructions for detailed setup steps from the example.

Note: This framework is for educational purposes only and not intended for production use.


Documentation

The framework’s documentation is split into core features and utility helpers, each with detailed guides and examples. Use the links below to explore specific modules.

Core Features

Utility Helpers

Tip: Each Documentation file includes code examples and best practices to help you implement features effectively.


Best Practices

To build applications with DotJS, follow these guidelines:

  1. Modular Components: Create small, reusable components with clear responsibilities.
  2. State Management: Use updateState for state changes to trigger efficient re-renders.
  3. Routing: Define clear routes with HashRouter and use RouterLink for navigation.
  4. Virtual DOM: Leverage h, hFragment, and hSlot for flexible UI composition.
  5. Cleanup: Use onUnmounted to clean up resources like event listeners or subscriptions.
  6. Error Handling: Monitor console logs for scheduler errors and handle unmatched routes.
  7. Performance: Minimize re-renders by updating only necessary state or props.
  8. Project Structure: Organize components, routes, and utilities in separate folders (e.g., components/, routes/).
  9. Testing: Test components in isolation and verify routing behavior with navigateTo.

Details: Each Documentation file includes module-specific best practices.


Installation Instructions

See the example/README.md for detailed setup instructions.

If you want to actually develop the framework, it isn't really different, make changes to the framework files, and run pnpm build to rebuild it.


Built by the Blind Dating App Team. Start building your next web app today!

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •