@zanix/templates

1.0.2 • Public • Published

ZANIX Framework Templates

npm version License: MIT

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

Currently, the repository includes the following template:

  • 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)
│ │ ├─ adapters
│ │ │ └─ _.adapter.ts (inject one client, provider, or adapters)
│ │ ├─ services
│ │ │ └─ _.service.ts (inject adapters or services)
│ │ ├─ 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.

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

Contributing

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @zanix/templates

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

24 kB

Total Files

39

Last publish

Collaborators

  • iscam2216
  • zanix-io