1.3.0 • Published 6 months ago

flexapi-server v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

FlexAPI Server: The Highly Scalable and Configurable API Framework for Node.js

"Build robust, dynamic, and high-performance APIs with effortless OpenGraph metadata configuration."


2. Overview

  • Brief introduction:
    • What it is: A Node.js framework for scalable, configurable API services with advanced features like dynamic OpenGraph metadata handling.
    • Why it matters: Offers seamless configuration via apiConfig.json and enables developers to set up highly flexible and efficient APIs without reinventing the wheel.

3. Features

Current Functionality

  • Dynamic Routing: Define API routes via apiConfig.json for flexibility.
  • Dynamic OpenGraph Configuration: Effortlessly set and manage OpenGraph metadata.
  • Proxy API Support: Create proxy endpoints with caching, query mapping, and response enrichment.
  • GraphQL Integration: Supports dynamic GraphQL schema generation based on API configuration.
  • Middleware System: Includes built-in middleware for authentication, rate limiting, and logging.
  • Caching Support: Redis-based caching for improved API performance.
  • Rate Limiting: Control traffic with built-in rate-limiting middleware.
  • Dynamic Table Initialization: Initialize database tables based on configuration.
  • Machine Learning Analytics: Built-in ML middleware for analytics and scheduled training.

    Upcoming Features

  • Real-time WebSocket support.

  • Enhanced API monitoring and logging.
  • Multi-tenancy capabilities for shared API configurations.
  • Plugin architecture for custom extensions.
  • Comprehensive CLI for scaffolding and management.
  • Advanced OpenGraph templating for richer metadata management.

4. Why FlexAPI Server?

  • Flexible and configurable API server for dynamic use cases.
  • Built-in support for SEO-friendly OpenGraph metadata.
  • Robust middleware and caching solutions for performance and scalability.
  • Open-source and community-driven.

5. Getting Started

Installation

npm install flexapi-server

Basic Usage

  • Example setup:

    const FlexAPIServer = require('flexapi-server');
    
    const app = new FlexAPIServer({
      port: 3000,
      configPath: './config/apiConfig.json',
    });
    
    app.start(() => {
      console.log('FlexAPI Server is running on port 3000');
    });

6. Configuration

API Configuration

  • Define your API endpoints in apiConfig.json:
    [
      {
        "route": "/api/example",
        "method": "GET",
        "type": "proxy",
        "targetUrl": "https://example.com",
        "queryMapping": {
          "localParam": "externalParam"
        },
        "responseMapping": {
          "externalField": "localField"
        },
        "cache": {
          "enabled": true,
          "ttl": 3600
        }
      }
    ]

    OpenGraph Metadata

  • Example configuration for dynamic OpenGraph metadata:
    {
      "route": "/api/metadata",
      "method": "GET",
      "type": "metadata",
      "title": "Dynamic Title",
      "description": "Automatically configured OpenGraph description",
      "url": "https://yourdomain.com"
    }

7. Advanced Features

  • Dynamic Table Initialization: Automatically create database tables using apiConfig.json.
  • Proxy Enrichment: Combine external API responses with internal data.
  • GraphQL API: Automatically generate and expose GraphQL endpoints.

8. Roadmap

  • A transparent list of upcoming features:
    • Enhanced OpenGraph templating.
    • Real-time WebSocket integration.
    • Plugin system for extensibility.
    • API versioning and multi-tenancy.

9. Contribution Guidelines

  • How to contribute:
    • Fork the repository, make changes, and submit pull requests.
    • Report bugs or suggest features via GitHub Issues.

10. License

  • Open source under the MIT license.

11. Support

  • Links to documentation and community forums.
  • How to get help via email or chat.