# prajwal100/nepali_movies architecture

> Architecture diagram of the GitHub repository prajwal100/nepali_movies, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prajwal100/nepali_movies
- Repository: https://github.com/prajwal100/nepali_movies

## Overview

##### Main System Components
- Frontend Application (User Panel):
- Located under the “frontend” directory.
- Built using React, Redux; it contains components, actions, reducers, and pages (celebrity, movies, authentication, home, etc.).
- Acts as the client that consumes backend APIs.
- Admin Panel:
- Located under the “admin” directory.
- Also built in React/Redux, with its own set of actions, reducers, and views (dashboard, login, settings, etc.).
- Used for administrative tasks which may include managing movies, celebrities, and settings.
- Backend/API Server:
- Found in the “backend” folder, with an entry point like server.js or app.js.
- Contains Express configuration, routes (celebrityRoute.js, movieRoute.js, userRoute.js), controllers, models for movies, celebrities, users, settings, middleware for authentication, error handling, and utility functions.
- Implements JWT authentication and integrates with MongoDB through Mongoose.
- Database:
- Although not explicitly seen as a directory, the configuration under backend/config and models indicates MongoDB as the data store.
- External Assets and Themes:
- “startbootstrap-sb-admin-2-gh-pages” likely represents a static theme/template that could be used as a reference or for legacy design.
- “demo” folder and several CSS/SCSS, vendor, and public files are utilized to serve static assets.

##### Relationships and Interactions
- The Frontend and Admin panels interact with the backend API via HTTP requests. Data flows from the UI (React components) to Redux actions; these then call the Express endpoints.
- The backend server processes these requests by applying middleware (including JWT authentication) and invokes controllers that modify/read MongoDB data using Mongoose models.
- Static assets such as CSS, JavaScript, and images (found in the “public” directories of both frontend and admin) are served to the clients.
- There is a clear separation between the client-side logic and the server-side API, forming a typical three-tier architecture.

##### Architectural Patterns and Design Principles
- MVC-like Pattern in the Backend:
- Models represent the database schema.
- Controllers encapsulate the logic for handling client requests.
- Routes define the API endpoints.
- Separation of Concerns:
- Client interfaces (frontend and admin) are decoupled from backend business logic.
- Use of Redux for predictable state management on the client-side.
- RESTful API Design:
- Express routes imply a RESTful design, with different endpoints for movies, celebrities, users, etc.
- Security and Middleware:
- Incorporation of JWT authentication, error handling, and asynchronous error capture through middleware.

##### Technologies, Frameworks, and Libraries
- Frontend: React, Redux, JavaScript, CSS/SCSS, possibly additional libraries for charts and UI components.
- Backend: Node.js, Express, Mongoose (MongoDB), JWT for authentication.
- Build and Configuration: npm, package.json for dependencies in each sub-project (frontend, admin, backend).
- Additional: Theme assets from Startbootstrap SB Admin 2.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients subgraph
    subgraph "Clients"
        FC["Frontend Client (User Panel)"]:::client
        AD["Admin Dashboard"]:::client
    end

    %% Backend API Server
    BAPI["Backend API Server"]:::server

    %% Database subgraph with configuration and models
    subgraph "Database"
        DBC["Config (database.js)"]:::database
        DBM["Models"]:::database
    end

    %% Static Assets / Theme Resources
    SA["Static Assets / Theme Resources"]:::assets

    %% Connections
    FC -->|"HTTPRequests"| BAPI
    AD -->|"HTTPRequests"| BAPI
    BAPI -->|"CRUD"| DBC
    BAPI -->|"CRUD"| DBM
    BAPI -->|"Serves"| SA

    %% Click Events
    click FC "https://github.com/prajwal100/nepali_movies/tree/master/frontend/"
    click AD "https://github.com/prajwal100/nepali_movies/tree/master/admin/"
    click BAPI "https://github.com/prajwal100/nepali_movies/tree/master/backend/"
    click DBC "https://github.com/prajwal100/nepali_movies/blob/master/backend/config/database.js"
    click DBM "https://github.com/prajwal100/nepali_movies/tree/master/backend/models/"
    click SA "https://github.com/prajwal100/nepali_movies/tree/master/startbootstrap-sb-admin-2-gh-pages/"

    %% Styles
    classDef client fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef server fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef database fill:#f94144,stroke:#333,stroke-width:2px;
    classDef assets fill:#577590,stroke:#333,stroke-width:2px;
```
