How shariquenadim/prefix_search_and-rating_system_using_mean_stack_and_elasticsearch works
Project Type & Purpose
• This is a full-stack application using the MEAN (MongoDB, Express.js, Angular, Node.js) stack combined with Elastic Stack for rapid city search, advanced two-step OTP authentication, an intelligent rating system, and containerization via Docker.
• The project integrates several core elements: secure authentication (with OTP using JWT and Bcrypt), a fast prefix search for Indian cities (powered by Elastic Search and visualized by Kibana), user feedback mechanisms for ratings/reviews, and robust testing using Jasmin and Karma.
File Structure
• Backend:
• The root includes files like index.js, router.js and directories such as Controllers (holding controllers for city, email, and user), models (with the user model), and views (for email/OTP templates).
• You also see Dockerfile and configuration files indicating containerization.
• Frontend:
• There’s a full Angular application in the “Frontend” directory with its own Dockerfile, Angular configuration files (angular.json, tsconfig files), and components structured in subdirectories (e.g., dashboard, login, signup, etc.). This shows a clear separation between UI components and business logic.
• Testing & Coverage:
• There are extensive test directories and configuration files (jest.config.js, tests folder, coverage reports) demonstrating a strong emphasis on unit testing and code quality.
• Others:
• Additional directories like “elastic loading delete data” indicate scripts/data used for initializing or managing Elastic Search indices.
Key Components
a. Frontend (Angular Application):
• Angular app as a separate module, highlighting components (dashboard, login, signup, forget-password, reset-password) and Angular Material integration.
• Specify that this layer handles user interactions, routing (from the routing module), and communicates with the backend via REST APIs.
b. Backend (Node.js/Express.js Application):
• This includes Controllers (cityController, emailController, userController), models (user.js), and router (API endpoints defined in router.js).
• Services for OTP authentication, user sign-up/login, and email/OTP handling (using views for email templates).
c. Database & Data Stores:
• MongoDB as the primary database (storing user data, city details, and ratings).
• Redis (as mentioned in the README) for caching or session management.
d. Elastic Stack:
• Elastic Search as the engine powering the fast prefix search for cities.
• Kibana as the visualization/reporting interface for Elastic Search data.
e. Containerization:
• Docker as a containerization platform running both the frontend and backend containers. Note the existence of separate Dockerfiles for the root and the Frontend folder.
f. External Services & Testing:
Relationships & Interactions
• The Angular frontend communicating to the Express API via REST calls.
• The backend interacting with MongoDB for data persistence.
• Backend interactions with Elastic Search for executing prefix search queries.
• Redis’s role (if used for caching or session management) linking with the backend.
• Data flows from user actions on the UI (like login, signup, rating) through the API, resulting in database or Elastic Search operations.
• Secure authentication flow (e.g., user requests OTP → backend validates and sends an email using templates from the views → user completes the OTP process).
Architectural Patterns & Design Principles
• Use separation of concerns: clearly distinguish between client-side (Angular) and server-side (Node.js/Express.js) logic.
• Implement MVC-like patterns in the backend (Controllers, Models, Views) as indicated by file naming.
• Containerized deployment with Docker, indicating how microservices or isolated modules can be scaled independently.
• Integration points with external systems like Elastic Search, MongoDB, and Redis prominently.