Skip to content

enfyra/documents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

92 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Enfyra Documentation

⚠️ IMPORTANT NOTICE ⚠️
This is the DOCUMENTATION repository only.
Please DO NOT star this repo! ⭐
Star the main project instead: https://github.com/enfyra/enfyra 🌟

License: MIT Nuxt Vue TypeScript

πŸš€ What is Enfyra?

Enfyra is a backend framework that automatically generates APIs from your database. You create tables through a visual interface, and Enfyra instantly provides REST & GraphQL APIs for them - no coding required. It's like having a backend developer that never sleeps.

πŸ”— Live Demo: https://demo.enfyra.io/ - Pre-filled admin credentials, just click login!

What can you build with Enfyra?

  • E-commerce platforms - Products, orders, customers, inventory
  • Content websites - Blogs, news sites, documentation portals
  • Business applications - CRM, project management, internal tools
  • Mobile app backends - User management, data sync, push notifications
  • Any data-driven system - If it needs a database and API, Enfyra can power it

πŸ’ͺ No-Code Simplicity, Full-Code Power

Unlike typical no-code platforms that limit you to predefined features, Enfyra gives you complete control over every aspect of your API lifecycle:

  • Before Hooks: Validate, transform, or enrich data before it hits the database
  • Custom Handlers: Replace default CRUD operations with your own business logic
  • After Hooks: Trigger workflows, send notifications, or sync with external services
  • Dynamic Extensions: Build custom UI components that integrate seamlessly with the admin panel
  • Query Interceptors: Modify queries, add custom filters, or implement complex access rules

The result? Start building in minutes with no-code, but never hit a ceiling when your requirements grow complex. Every API endpoint can be customized, every workflow can be automated, and every business rule can be implemented - all without forking or modifying the core system.

⚑ Key Differentiators

πŸ”₯ Backend-First Architecture

  • API Generation: All REST & GraphQL APIs are automatically generated and served by the backend server (port 1105)
  • Frontend as Client: The frontend app (port 3000) is purely a client that consumes APIs from your backend URL
  • Single Source of Truth: Backend generates APIs from database schema, frontend consumes them via HTTP requests

πŸ”₯ Real-time Everything

  • Live Extension System: Write Vue/JavaScript extensions that compile and load instantly from the database - no server restarts, no deployments
  • Zero-downtime Schema Updates: Change your data structure while your API stays 100% available
  • Instant API Generation: Every table immediately becomes a full REST & GraphQL API with advanced querying

πŸ—οΈ Cluster-Ready Architecture

  • Born for Clustering: Designed from day one to run multiple instances - no configuration, no setup, just scale
  • Automatic Coordination: Schema changes sync instantly across all instances via Redis
  • Zero Additional Work: Deploy 1 instance or 100 instances - the experience is identical
  • Stateless by Design: Any instance handles any request seamlessly - Learn how it works β†’

πŸ›‘οΈ Enterprise-Grade Security

  • Visual Permission Builder: Create complex permission logic with AND/OR conditions and nested rules
  • Dynamic Role System: Permissions that adapt based on data relationships and user context
  • Handler Isolation: Custom code runs in isolated processes for security and stability

πŸš€ Beyond Traditional CMS

  • Meta-Programming Core: The entire API structure is generated from database metadata in real-time
  • Multi-Instance Coordination: Run multiple instances with automatic schema synchronization via Redis
  • Smart Caching: SWR (Stale-While-Revalidate) pattern for optimal performance without sacrificing freshness
  • Flexible Syntax: Choose between traditional $ctx.$property or modern template syntax @TEMPLATE & #table_name
  • Built-in Tables: Leverage system tables like user_definition for immediate user management

⚑ Modern Template Syntax

Choose your coding style - both work seamlessly together:

Traditional Syntax:

const user = await $ctx.$repos.user_definition.create({
  email: $ctx.$body.email,
  password: await $ctx.$helpers.$bcrypt.hash($ctx.$body.password)
});

Template Syntax (Shortened):

const user = await #user_definition.create({
  email: @BODY.email,
  password: await @HELPERS.$bcrypt.hash(@BODY.password)
});

See: Complete Example featuring both syntax styles!

🎯 Core Capabilities

Feature How It Works
Extension System Write custom features that compile and load instantly from the database
Schema Changes Modify your data structure with zero downtime - APIs stay available
Permission System Visual builder for complex access control
API Generation Every table instantly becomes a full REST & GraphQL API
Custom Code Execute business logic in isolated processes with full request context
Multi-Instance Run multiple servers with automatic synchronization
Flexible Syntax Traditional $ctx.$property or modern @TEMPLATE & #table_name patterns
Package Management Install NPM packages directly from UI for use in handlers and hooks
Built-in Auth System tables like user_definition for immediate user management

πŸ’‘ Perfect For

  • Rapid Development: Go from idea to production API in minutes, not days
  • Complex Projects: Handle sophisticated data relationships and business logic without limitations
  • Scale-Ready Applications: Start small and scale to enterprise without architectural changes
  • Team Collaboration: Intuitive interface for non-technical users, powerful tools for developers
  • Custom Solutions: Build exactly what you need without fighting framework limitations

πŸ—οΈ Architecture Overview

Two-Component System:

Database β†’ Backend (API Server) β†’ Frontend (Admin App)
  • Backend (Port 1105): Generates & serves all REST & GraphQL APIs from your database schema
  • Frontend (Port 3000): Pure client application consuming APIs from backend URL
  • All API endpoints: Originate from backend server, frontend makes HTTP requests

πŸ—οΈ Built With Modern Technology

Backend: NestJS + Express.js + Knex + Redis + GraphQL Yoga Frontend: Nuxt 4 + Vue 3 + TypeScript + TailwindCSS Database: MySQL, MariaDB, PostgreSQL, MongoDB (your choice) Extensions: Dynamic Vue SFC compilation via Vite

Technology Stack Details

NestJS + Express.js - Enterprise Node.js framework built on Express with custom high-performance route engine that bypasses Express middleware stack for superior API performance

Knex - SQL query builder with comprehensive support for:

  • MySQL - Recommended for production environments
  • MariaDB - MySQL-compatible with full feature support
  • PostgreSQL - Advanced features and complex data types supported
  • MongoDB - NoSQL document database with full CRUD operations and query support
  • SQLite - Planned for future release (development and testing environments)

Features

πŸ—οΈ Core Infrastructure

  • Dynamic Table Management - Create and modify database tables on the fly
  • Package Management - Install and manage NPM packages directly from the UI for use in handlers and hooks
  • Official SDK - useApi and useEnfyraAuth from @enfyra/sdk-nuxt package with custom error handling
  • TypeScript Support - Full type safety throughout the application

🎨 User Interface

  • Extension System - Extensible architecture with dynamic extension loading
  • Permission System - Comprehensive role-based access control (RBAC)
  • Menu Registry - Dynamic sidebar and menu management
  • Header Actions - Configurable header button system
  • Dynamic Forms - Auto-generated forms with validation and relations
  • Advanced Filtering - Interactive UI filtering with MongoDB-like syntax

βš™οΈ Developer Experience

  • Flexible Code Syntax - Choose between traditional $ctx.$property or modern @TEMPLATE & #table_name
  • Built-in Authentication - System tables like user_definition for immediate user management
  • Hook System - PreHook and AfterHook support for custom business logic
  • Custom Handlers - Override default CRUD operations with your own code
  • Request Context - Full $ctx object with repositories, helpers, packages, and more

πŸ“š Documentation

enfyra-docs/
β”œβ”€β”€ πŸ—οΈ architecture-overview.md  # System architecture diagram and component responsibilities
β”œβ”€β”€ πŸš€ getting-started/
β”‚   β”œβ”€β”€ installation.md          # Setup guide for backend and app
β”‚   β”œβ”€β”€ getting-started.md       # First steps after installation and interface overview
β”‚   β”œβ”€β”€ table-creation.md        # Complete guide to creating tables with all field types
β”‚   └── data-management.md       # Complete guide to managing records in your tables
β”‚
β”œβ”€β”€ πŸ“ examples/
β”‚   └── user-registration-example.md # Complete end-to-end example with template syntax
β”‚
β”œβ”€β”€ 🎨 frontend/
β”‚   β”œβ”€β”€ api-integration.md        # API integration with Enfyra SDK and examples for extensions
β”‚   β”œβ”€β”€ filter-system.md         # Interactive UI filtering for data tables and forms
β”‚   β”œβ”€β”€ relation-picker.md       # Working with related data in forms (powered by Filter System)
β”‚   β”œβ”€β”€ routing-management.md    # UI guide for creating custom API endpoints and route permissions
β”‚   β”œβ”€β”€ custom-handlers.md       # UI guide for creating custom business logic handlers
β”‚   β”œβ”€β”€ hooks.md                 # UI guide for creating lightweight request/response hooks
β”‚   β”œβ”€β”€ package-management.md    # Install and manage NPM packages for handlers and hooks
β”‚   β”œβ”€β”€ menu-management.md       # UI guide for creating custom navigation menus
β”‚   β”œβ”€β”€ extension-system.md      # Create custom pages with Vue.js components (linked to menus)
β”‚   β”œβ”€β”€ header-actions.md        # Inject custom actions into header and sub-header areas
β”‚   β”œβ”€β”€ page-header.md           # Register custom page headers with stats and gradients
β”‚   β”œβ”€β”€ permission-builder.md    # Visual interface for creating complex permission rules
β”‚   β”œβ”€β”€ permission-components.md # PermissionGate and usePermissions for UI control
β”‚   β”œβ”€β”€ storage-management.md    # Upload and manage files, folders, and storage configurations
β”‚   └── form-system.md          # Dynamic form generation with validation and relations
β”‚
└── βš™οΈ server/
    β”œβ”€β”€ api-lifecycle.md         # πŸ”„ Request lifecycle, hook system, and context sharing
    β”œβ”€β”€ api-querying.md          # πŸ”₯ MongoDB-like API querying with powerful operators (for developers)
    β”œβ”€β”€ graphql-api.md           # πŸ“Š GraphQL queries and mutations with auto-generated schema
    β”œβ”€β”€ hook-development.md      # Advanced hook programming with context, examples, and best practices
    β”œβ”€β”€ context-reference.md     # πŸ“– Complete $ctx object reference for hooks and handlers
    β”œβ”€β”€ file-handling.md         # πŸ“ File upload handling and response streaming with Sharp image processing
    β”œβ”€β”€ cluster-architecture.md  # πŸ—οΈ Multi-instance coordination and distributed synchronization
    β”œβ”€β”€ permission-system.md     # πŸ” Role-based access control with allowedUsers bypass
    β”œβ”€β”€ template-syntax.md       # ✨ Modern template syntax for cleaner code
    └── bootstrap-scripts.md     # πŸš€ Startup script execution system with full context access

πŸ—ΊοΈ Learning Path

New to Enfyra? Choose your journey:

⚑ Quick Start (5 mins)

Just want to see what Enfyra can do?

  1. 🌐 Try Live Demo - Pre-filled admin credentials, just click login!
  2. πŸ“– Getting Started Guide - See table creation and data management in action

πŸ“š Full Learning Path

Ready to master Enfyra? Follow this step-by-step path to become proficient:

πŸš€ Phase 1: Setup & Basics (30 mins)

  1. Installation - Set up Enfyra backend and app
  2. Getting Started - First login and interface overview
  3. Table Creation - Create your first table with all field types and relations
  4. Data Management - Learn to manage records and relationships

🎨 Phase 2: Frontend Mastery (2-3 hours)

  1. Form System - Understand how forms work with your data
  2. Filter System - Master data filtering and searching
  3. Permission Builder - Set up access control rules
  4. Menu Management - Customize navigation and user interface
  5. Storage Management - Upload and manage files, folders, and storage configurations

πŸ”§ Phase 3: Customization (3-4 hours)

  1. API Integration - Learn to fetch and manipulate data programmatically
  2. Package Management - Install NPM packages for enhanced handler and hook functionality
  3. Extension System - Build custom pages and functionality
  4. Header Actions - Inject custom buttons and widgets into the app interface
  5. Custom Handlers - Override default API behavior with business logic

βš™οΈ Phase 4: Advanced Development (4-5 hours)

  1. API Querying - Master MongoDB-like querying for complex data retrieval
  2. Context Reference - Complete reference for $ctx object in hooks and handlers
  3. Hook Development - Create sophisticated request/response hooks
  4. API Lifecycle - Understand the complete request processing pipeline

πŸ—οΈ Phase 5: Production & Scale (2-3 hours)

  1. Permission System - Deep dive into role-based access control
  2. Cluster Architecture - Deploy and scale across multiple instances
  3. Bootstrap Scripts - Initialize application state and perform startup tasks

🎯 Goal-Oriented Paths

Have a specific goal? Jump directly to what you need:


Quick Navigation

πŸ—οΈ Architecture Overview

πŸš€ Getting Started

🎨 Frontend (User Interface)

βš™οΈ Backend (Developer Integration)

  • API Lifecycle - πŸ”„ Request lifecycle, hook system, and context sharing
  • API Querying - πŸ”₯ MongoDB-like API querying with powerful operators, relation filtering, aggregation, and deep relations
  • GraphQL API - πŸ“Š GraphQL queries and mutations with auto-generated schema and permission control
  • Swagger API - πŸ“– OpenAPI/Swagger documentation with interactive testing and auto-generation
  • MongoDB Relations - πŸ”— MongoDB relation management, inverse sync, and metadata change behavior
  • Context Reference - πŸ“– Complete $ctx object reference for hooks and handlers with examples
  • File Handling - πŸ“ File upload and streaming with Sharp image processing and memory optimization
  • Hook Development - Advanced hook programming with context, examples, and best practices
  • Cluster Architecture - πŸ—οΈ Multi-instance coordination and distributed synchronization
  • Permission System - πŸ” Role-based access control with allowedUsers bypass
  • Bootstrap Scripts - πŸš€ Startup script execution with full context access and hot reload

πŸ“ Examples & Templates

  • User Registration - Complete end-to-end example featuring template syntax, hooks, handlers, and package management

Installation

Enfyra requires both backend and frontend to work properly. See our complete installation guide:

β†’ Complete Installation Guide

Quick overview:

  1. First install Enfyra Server
  2. Then install Enfyra App
  3. Connect them together

Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/your-username/enfyra.git
  3. Install dependencies: npm install
  4. Create a feature branch: git checkout -b feature/amazing-feature
  5. Make your changes and commit: git commit -m 'Add amazing feature'
  6. Push to your branch: git push origin feature/amazing-feature
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Credits

Built with ❀️ using:

About

Official documentation for Enfyra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published