mORMot Framework

repository·master·Indexed 21 days ago

https://github.com/synopse/mormot

A framework for FPC/Lazarus and Delphi providing ORM (Object-Relational Mapping), SOA (Service Oriented Architecture), and MVC (Model-View-Controller) features. It includes mormot_base for core functionality supporting SQLite3 and MongoDB, and mormot_cross for client-side targets. The framework features a high-performance VFS wrapper for SQLite3 encryption using AES-CTR/AES-OFB and PBKDF2 with SHA-3, as well as integration capabilities for the SpiderMonkey JavaScript engine.

Tokens
12.8K
Snippets
29
Records
75
Agent score
73%

What's inside mORMot

  1. Overview of the Synopse SQLite Demo

    master
    The Synopse SQLite Demo is a practical, real-world example designed to demonstrate the capabilities of the mORMot Framework. It implements a trivial application managing a relationship between TCustomer and TTasks using a 'HAS MANY AND BELONGS TO MANY' relationship type (where a TCustomer publishes a list of TTasks). This demo serves as a starting point for developers looking to understand how to model data and relationships within the mORMot ecosystem.
  2. Overview of SyNode JavaScript Execution

    master

    SyNode provides server-side JavaScript execution using the SpiderMonkey library with support for Node.js modules. It is designed for win32/64 (FPC 3.1.1, Delphi) and Linux 64 (FPC 3.1.1) targets.

    Key features include:

    • ES6 Support: Based on SpiderMonkey 52, providing almost full ES6 support.
    • Remote Debugging: Supports a remote debugger protocol that can be used with Firefox.
    • Module Support: Compatible with CommonJS and NPM modules.
    • Native Modules: Allows implementing native modules using Delphi/FPC as a DLL or SO.
    • RTTI Integration: JavaScript prototype definitions are based on Delphi RTTI (supporting both 'new' and old styles).
  3. Overview of mORMot 1 Framework

    master

    mORMot 1 is an Open Source Client-Server ORM/SOA/MVC framework designed for Delphi and Free Pascal (FPC). It targets Windows and Linux for servers, and supports any platform for clients (including mobile or AJAX).

    Core Capabilities:

    • ORM/ODM: Object persistence for SQL (Oracle, MS SQL, PostgreSQL, MySQL, SQLite3, etc.) and NoSQL (MongoDB) databases.
    • SOA (Service Oriented Architecture): Organize business logic into REST services using JSON over protocols like HTTP/1.1.
    • Web MVC: Publish ORM/SOA processes as responsive Web Applications using Mustache templates.
    • Client Support: Consume data/services from any platform via ORM/SOA APIs. Clients require no database drivers or third-party runtimes, as they can connect via standard HTTP.

    Architecture Layers:

    • Presentation: MVC UI generation (Delphi clients, Web clients, or AJAX clients).
    • Application: Interface-based services (similar to WCF) and Client-Server ORM.
    • Domain Model: Business logic in plain Delphi objects (Entities, Aggregates, Value Objects).
    • Data Persistence: Infrastructure for ORM operations on direct database access or TDataSet providers (FireDAC, UniDAC, etc.).
  4. Overview of mORMot REST capabilities

    master
    mORMot.REST is a project designed to test and demonstrate the REST capabilities of the mORMot framework. It provides a way to implement REST services using interfaces, which is intended to be a developer-friendly approach. The project includes both server and client implementations and supports heavy load simulation using Apache JMeter via .jmx files.
  5. Overview of mORMot Packages

    master

    mORMot provides two primary packages for FPC/Lazarus environments:

    • mormot_base: The core package containing ORM (Object-Relational Mapping), SOA (Service Oriented Architecture), and MVC (Model-View-Controller) features. It supports ORM via static-linked SQLite3, as well as ORM over external SQL databases and MongoDB. It also includes high-level Domain-Driven-Design units.
    • mormot_cross: A stand-alone, client-side only package designed to run on all FPC targets.
  6. Explore the Practical DDD Progressive Samples

    master

    The 35 - Practical DDD sample folder provides a progressive walkthrough of implementing a conference booking system using Domain-Driven Design (DDD) and Test-Driven Development (TDD). The project is organized into iterations (01, 02, 03, etc.) that build upon each other, moving from core domain logic to full ORM persistence.

    Key learning objectives include:

    • Implementing 'Clean Architecture' patterns.
    • Using mORMot's registration for interface TypeInfo().
    • Transitioning from a DB-centric approach to a Domain-centric approach.
    • Implementing Repository dependency contracts.
    • Adding ORM persistence to a service.

    For visual context, refer to the associated slides at: https://synopse.info/files/ekon21

  7. Understand the AngularJS client implementation for mORMot servers

    master

    The DigDiver/AngularJS sample provides source code for an AngularJS client interacting with a mORMot server. It is intended as a reference for implementation ideas rather than a production-ready demo.

    Key features include:

    • Full authentication via a pure JavaScript/AngularJS client.
    • Login workflows designed for mORMot server integration.

    To see a complete, working application using these patterns, refer to the G-Lock EasyMail software mentioned in the project forum.

  8. Use TSynJSONTreeView to manage mORMot JSON documents

    master

    The TSynJSONTreeView component is a specialized treeview designed to work with mORMot's JSON document format. It provides a visual interface for interacting with JSON data structures.

    Key capabilities include:

    • Node Management: Edit, delete, or add nodes directly within the tree structure.
    • Persistence: Load JSON documents from files and save changes back to files.
    • Serialization: Generate a JSON string from the current tree state.
    • Customization: Implement custom input controls for editing or inserting nodes.
  9. Understand the Practical DDD Sample Structure

    master

    The Practical DDD sample demonstrates a progressive implementation of Domain-Driven Design (DDD) using Test-Driven Development (TDD) to model a conference booking system. The project is organized into iterations that evolve from core domain logic to full ORM persistence:

    • Iteration 01: Establishes core units following 'Clean Architecture' patterns. Includes TestAll.dpr for regression testing and ServBook.dpr for the Booking service.
    • Iteration 02: Introduces Domain objects and a basic booking service. It establishes a Repository dependency contract, which is implemented using TSynStub during testing to decouple the domain from the database.
    • Iteration 03: Refactors the code to use mORMot's registration for interface TypeInfo() and refines the IConferenceBooking interface for more realistic parameter usage.
    • Iteration 04: Adds ORM persistence (as seen in the ServBook process) and integrates it with the booking service unit tests.