Subscription Manager is a subscription management application built using Next.js and React, following the SOLID principles to ensure scalable and maintainable code. The app allows users to add, list, and manage subscriptions with a modern, responsive interface.
The application adheres to the SOLID principles, which are:
Single Responsibility Principle (SRP): Each class and module in the codebase has a single responsibility. For example, the SubscriptionService
handles subscription-related business logic, while the PersistenceService
is responsible for data storage.
Open/Closed Principle (OCP): The code is designed to be open for extension but closed for modification. This is achieved by using interfaces and abstract classes, allowing new features or changes without altering existing code.
Liskov Substitution Principle (LSP): Derived classes can be substituted for their base classes without affecting the correctness of the program. This ensures that extending functionality does not break existing code.
Interface Segregation Principle (ISP): Interfaces are designed to be specific to the needs of the clients. For instance, ISubscriptionService
and IPersistenceService
provide specific methods for subscription management and data persistence, respectively, avoiding the pitfalls of a large, monolithic interface.
Dependency Inversion Principle (DIP): High-level modules are not dependent on low-level modules but rather on abstractions. The SubscriptionService
depends on the IPersistenceService
interface rather than a concrete implementation, promoting flexibility and easier testing.
The project includes tests written with Jest and Testing Library to ensure functionality and reliability.
To run the tests, use the following command:
npm test