1.0.2 • Published 8 months ago

@zanix/templates v1.0.2

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

ZANIX Framework Templates

npm version License: MIT

Table of Contents

Introduction

This repository contains templates for the ZANIX Framework, designed to accelerate the development of projects using the ZANIX ecosystem. The templates provide a starting point for various types of applications and follow the ZANIX architecture patterns.

Templates

Api Base

A template for creating API-based applications using the @zanix/server library. It can be installed using the command zjs new api [path] of @zanix/Cli, where [path] is the destination path for the new project.

Architecture Overview:

The templates in this repository follow the Adapter pattern, which promotes separation of concerns and flexibility in integrating with external services and APIs. The overall architecture of a ZANIX application is depicted below:

┌───────────────────────┐   ┌───────────────────────┐   ┌───────────────────────┐   ┌───────────────────────┐
│                       │   │                       │   │                       │   │                       │
│ Controllers/Resolvers │───────►    Services      ◄─────►       Adapters      ◄──────►  Clients/Providers  │
│                       │   │                       │   │                       │   │                       │
└───────────────────────┘   └───────────────────────┘   └───────────────────────┘   └───────────────────────┘
             ▲                         |                           |                             |
             │                         └─────────────────────────────────────────────────────────┘
             │                                                     ▼
┌───────────────────────┐   ┌───────────────────────────────────────────────────────────────────────────────┐
│                       │   │                                                                               |
│           API         │───────►                             Dependencies                                  │
│                       │   │                                                                               |
└───────────────────────┘   └───────────────────────────────────────────────────────────────────────────────┘
  • Controllers/Resolvers: Responsible for handling incoming requests and invoking the corresponding service methods or resolving data.
  • Services: Implement the business logic of the application and interact with adapters for data retrieval, manipulation, or external service communication.
  • Adapters: Provide the necessary abstractions and interfaces to interact with external services or data sources. They can also function as "wildcard" classes.
  • Clients/Providers: Act as clients to external services or providers of data. Clients are responsible for making requests and handling responses, while providers offer data access or integration capabilities.

Project Structure:

The project structure for the generated template follows a modular approach to maintain separation of concerns and facilitate maintainability. Here's an overview of the folder structure: root folder

├─ CHANGELOG.md
├─ jest.config.js
├─ package-lock.json
├─ package.json
├─ tsconfig.json
├─ README.md
├─ .eslintrc
├─ .prettierrc
└─ resources (assets, data, statics, scripts, non-modular files)
└─ src
│ ├─ tests
│ ├─ app
│ │ ├─ (gql)
│ │ │ ├─ types
│ │ │ │ ├─ _.graphql
│ │ │ │ └─ _.gql
│ │ │ └─ inputs
│ │ │ │ ├─ _.graphql
│ │ │ │ └─ _.gql
│ │ ├─ (rest)
│ │ │ ├─ rtos
│ │ │ │ └─ _.rto.ts (request transfer object)
│ │ │ └─ _.controller.ts (inject one service)
│ │ ├─ services
│ │ │ └─ _.service.ts (inject adapters or services)
│ │ │ ├─ adapters
│ │ │ │ └─ _.adapter.ts (inject one client, provider, or adapters)
│ │ ├─ types.d.ts
│ │ ├─ commons
│ │ │ ├─ clients
│ │ │ │ └─ _.client.ts
│ │ │ ├─ providers
│ │ │ │ └─ _.provider.ts
│ │ │ ├─ middlewares
│ │ │ │ ├─ _.pipes.ts
│ │ │ │ └─ _.interceptor.ts
│ │ │ ├─ models
│ │ │ └─ utils
│ │ │ └─ ...
│ ├─ config
│ │ ├─ secrets
│ │ │ └─ \*.srt
│ │ └─ zanix.ts (for variable, secret and configuration definition)

This structure is designed to promote modularity, scalability, and maintainability in your ZANIX Framework projects. Feel free to explore each directory to understand the purpose of different files and folders. the resources and src/config folders must not change their name or location for the CLI commands to work correctly.

Support and Contributions

For more information on how to use the templates and get started with ZANIX Templates, please refer to the documentation, to the changelog, or to the individual template's README file, like Zanix Configuration and Zanix Server.

If you have any suggestions, bug reports, or feature requests, please feel free to open an issue or submit a pull request. We welcome contributions from the community to make the ZANIX Framework Templates even better!

License

The ZANIX Framework Templates are open-source software licensed under the MIT License. Feel free to use, modify, and distribute the templates as per the terms of the license.

1.0.3-beta.1

8 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago