Giter Site home page Giter Site logo

userusagecycle's Introduction

UserCycleRecords

Microservice application consisting of User Service, Cycle Service &

Getting Started

To get the Cycle Service up and running, follow these steps:

Prerequisites

  • Docker (will use docker-compose up --build to run the services)

Installation

Using Docker Compose

To quickly get all the services up and running together, you can use Docker Compose. Make sure you have Docker Compose installed on your system.

  1. Clone the repository:

    git clone <repository-url>
  2. Navigate to the project directory:

    cd <project-directory>
  3. Build and start the services using Docker Compose:

    docker-compose up --build

This command will build Docker images for each service (if not already built) and start containers for all services defined in the docker-compose.yml file. Once the services are up and running, you can access them using the respective endpoints.

Swagger Endpoints

The Cycle Service provides the following Swagger endpoints for API documentation:

Service Design

The API Gateway serves as a centralized entry point for all client requests within a microservices architecture, providing a unified interface to interact with multiple backend services. It acts as a reverse proxy, routing requests to the appropriate microservice based on predefined routing rules.

Eureka Server, on the other hand, plays a crucial role in service discovery and registration within the microservices ecosystem. It maintains a registry of available services and their instances, allowing services to dynamically locate and communicate with each other.

Feign Client simplifies the process of making HTTP requests between microservices by providing a declarative interface for defining RESTful clients. It abstracts away the complexity of low-level HTTP communication and integrates seamlessly with service discovery mechanisms like Eureka Server, facilitating communication between microservices in a transparent and efficient manner.

API Design

Get the current cycle daily usage for a given customer

  • GET /dailyUsage/current: Retrieves the current cycle daily usage for a given customer.
    • Input Parameters: userId, mdn
    • Output: List of {date, daily usage}

Get the cycle history of a given mdn

  • GET /cycle/history: Retrieves the cycle history of a given mobile number.
    • Input Parameters: userId, mdn
    • Output: List of {cycleId, startDate, endDate}

Create a new user

  • POST /user/: Creates a new user with the provided details.
    • Input Parameters: firstName, lastName, email, password
    • Output: {id, firstName, lastName, email}

Update existing user profile

  • PUT /user/{userId}: Updates an existing user's profile information.
    • Input Parameters: firstName, lastName, email
    • Output: {id, firstName, lastName, email}

Future Improvements:

Caching Strategies:

Implement caching mechanisms (e.g., Redis or Memcached) at the API layer to cache frequently accessed data and reduce the load on the database. Cache invalidation strategies should be carefully designed to ensure data consistency.

Rate Limiting and Throttling:

Introduce rate limiting and throttling mechanisms in the API gateway to prevent abuse and protect against denial-of-service (DoS) attacks. Rate limiting can help maintain system stability by limiting the number of requests allowed per user or client.

Asynchronous Processing:

Evaluate the possibility of implementing asynchronous processing for long-running or resource-intensive operations. Asynchronous processing can improve system responsiveness and scalability by offloading tasks to background workers or message queues.

Replication and Sharding DB:

Replication ensures high availability and data redundancy by maintaining multiple copies of data across different servers. Sharding enhances scalability and performance by distributing large datasets across multiple servers, allowing the system to handle higher throughput and larger data volumes.

Command Query Responsibility Segregation (CQRS)

Separate read and write operations into distinct services to improve performance, scalability, and security(DailyUsage Query Service, DailyUsage Command Service). This separation allows for optimized handling of queries and commands, leading to more efficient and maintainable systems.

Improve other services

Add additional functionalities like authentication, authorization, logging, extra validation, extra custom error handling, Monitoring and metrics, Circuit Breaker, Additional end to end Testing and CI/CD.

userusagecycle's People

Contributors

zsahil avatar sahilz678 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.