Skip to content

Latest commit

 

History

History

readme.md

Infinity Logo

Infinity Data Service

Node TypeScript Yarn Express Clean Architecture ESLint

📑 Table of Contents

💡 About the Project

Backend microservice implementing Clean Architecture and SOLID principles in TypeScript, providing data services for the Infinity ecosystem. This service is optimized for high availability and scalability.

Key Features

  • 🏗️ Clean and modular architecture
  • 🔐 Secure API endpoints
  • 💬 Ethereum and Loyalty services
  • 🚀 Performance optimized with compression
  • 📊 Structured logging with Winston

🛠 Tech Stack

Core

  • Runtime: Node.js 22.11.0
  • Language: TypeScript 5.7.2
  • Framework: Express 4.21.1

Infrastructure

  • Logger: Winston
  • Security: Helmet, HPP, Rate Limiting
  • API: Express with compression
  • File Handling: Multer

Development Tools

  • Linting: ESLint + Prettier
  • Type Checking: TypeScript
  • Development: ts-node-dev
  • Build: tsc with path aliases

Infrastructure

  • Environment: Cross-env
  • Date Handling: Day.js
  • Logging: Winston with daily rotation

🏗 Architecture

Clean Architecture

📦 src
├── 🎯 domain/
│   ├── adapters/       # Interface adapters
│   ├── aggregates/     # Domain aggregates
│   ├── dto/           # Data transfer objects
│   ├── entity/        # Domain entities
│   ├── enums/         # Enumerations
│   ├── errors/        # Custom error definitions
│   ├── events/        # Domain events
│   ├── facades/       # Facade patterns
│   ├── factories/     # Factory patterns
│   └── observers/     # Observer patterns
│
├── 🏗️ infraestructure/
│   ├── databases/     # Database implementations
│   │   ├── firestore/
│   │   ├── mongodb/
│   │   ├── postgresql/
│   │   └── redis/
│   └── services/      # Infrastructure services
│
├── 🎨 presentation/
│   ├── Bootstrap/     # Application bootstrap
│   │   ├── controllers/
│   │   ├── middlewares/
│   │   ├── routes/
│   │   └── services/
│   └── Infinity/      # Infinity module
│       ├── controllers/
│       ├── repositories/
│       ├── routes/
│       └── services/
│
└── 🛠️ utils/
    ├── environment/   # Environment configuration
    ├── exceptions/    # Exception handling
    ├── loggerConfig/  # Logging configuration
    ├── readFile/     # File reading utilities
    ├── system/       # System utilities
    └── times/        # Time handling utilities

🚀 Getting Started

Prerequisites

node -v # >= 22.10.0
yarn -v # >= 1.22.20

Installation

  1. Clone the repository
git clone https://github.com/infinity/data-service.git
cd data-service
  1. Install dependencies
yarn install
  1. Configure environment variables
cp .env.example .env

⚙️ Configuration

Environment Variables

# Server Configuration
PORT=9000
NODE_ENV=development
API_PREFIX=/api/v1

# SSL Configuration (Optional)
SSL_KEY_PATH=./ssl/key.pem
SSL_CERT_PATH=./ssl/cert.pem

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100

# Logging
LOG_LEVEL=info
LOG_FORMAT=combined

📜 Available Scripts

# Development
yarn local           # Start development server with hot-reload
yarn build           # Build for production
yarn start           # Start production server
yarn clean           # Clean build directory

# Code Quality
yarn lint            # Run ESLint
yarn lint:fix        # Fix ESLint issues
yarn format          # Format code with Prettier
yarn deps:check      # Check for dependency updates

📚 API Documentation

The API is organized into two main modules:

Ethereum Module

Handles Ethereum-related functionality through EthereumController:

  • Authentication
  • Transaction management
  • Smart contract interactions

Loyalty Module

Manages loyalty program features through LoyaltyController:

  • Points tracking
  • Rewards management
  • User loyalty status

🤝 Contributing

Contribution Process

  1. Fork the repository
  2. Create your feature branch
    git checkout -b feature/AmazingFeature
  3. Commit your changes
    git commit -m 'feat: Add some AmazingFeature'
  4. Push to the branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Commit Conventions

We follow Conventional Commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation
  • style: Style changes
  • refactor: Code refactoring
  • test: Add or modify tests
  • chore: Maintenance tasks

Pull Request Process

  1. Update README.md with details of changes if applicable
  2. Update version numbers in relevant files
  3. Ensure all tests pass
  4. Get approval from at least one developer
  5. Merge only after QA approval

📄 License

This project is under INFINITY License - see the LICENSE.md file for details.


Developed by the Infinity Team

GitHub Team