# arjuniyyappan/techzconnect architecture

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

- Interactive diagram: https://gitdiagram.com/arjuniyyappan/techzconnect
- Repository: https://github.com/arjuniyyappan/techzconnect

## Overview

##### Project type and purpose
- This is a full-stack HR Consultancy Web App (“TechzConnect”).
- Frontend is a React single-page application for public pages (jobs, blogs, services) and an admin dashboard.
- Backend is a Node.js/Express REST API that handles authentication, job postings, blog content, and user data.
- PostgreSQL is the primary persistent store.

##### File structure
Backend directory:
- config/db.js – Postgres connection setup
- middleWare/authMiddleware.js – JWT or session check
- controllers/*Controller.js – business logic for auth, jobs, blogs
- models/*.js – ORM/schema definitions for User and Job
- routes/*.js – Express routers for auth, jobs, blogs, admin
- server.js / index.js – API entry point
Frontend directory:
- src/api/*.js – API-wrapper modules (jobsApi, newsApi)
- src/components – reusable UI components (forms, cards, carousel)
- src/pages – route-mapped pages, including public pages and admin subfolder
- src/components/PrivateRoute.jsx – route guard for protected admin routes
- public/index.html + .env – app metadata and client configuration

##### README
- Confirms tech stack: React.js, Node.js/Express, PostgreSQL
- Focus is on full-stack HR consultancy use cases (job listings, applications, blogs, admin management)

a. Main components
- Browser / Client (React SPA)
- API Server (Node.js + Express)
- Database (PostgreSQL)
- External Services (e.g., news API)
- (Optional) Authentication Provider (JWT or OAuth flow)
b. Relationships and data flows
- Client → HTTP over REST → API Server
- API Server → SQL queries → PostgreSQL
- API Server ↔ External news API (for news feed)
- API Server uses auth middleware for protected routes
c. Architectural patterns & design principles
- Backend: MVC-style layering (routes → controllers → models)
- RESTful API design, separation of concerns
- Frontend: Component-based architecture, client-side routing
- Role-based access control via PrivateRoute and auth middleware
- Environment-driven configuration (dotenv in both front & back)
d. Key technologies
- React, React Router, Axios/fetch (frontend)
- Express, middleware, JWT/auth libs (backend)
- pg or an ORM (models)
- CSS modules or global CSS for styling

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Title
    subgraph "TechzConnect System Architecture"
    end

    %% Frontend Layer
    subgraph "Frontend (React SPA)"
        direction TB
        ReactIndex["Entry Point: src/index.js"]:::frontend
        AppJS["Main App: src/App.js"]:::frontend
        Pages["Pages: src/pages/*.jsx"]:::frontend
        AdminPages["Admin Pages: src/pages/admin/*.jsx"]:::frontend
        PrivateRoute["PrivateRoute: src/components/PrivateRoute.js"]:::frontend
        JobsApi["Jobs API Wrapper: src/api/jobsApi.js"]:::frontend
        NewsApi["News API Wrapper: src/api/newsApi.js"]:::frontend
        PublicHTML["public/index.html"]:::frontend
        UIComponents["UI Components: src/components/*"]:::frontend
        StylingAssets["Styles: src/styles/* & src/components/*.css"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Node.js/Express)"
        direction TB
        APIServer["API Server: server.js / index.js"]:::backend

        subgraph "API Layer"
            direction TB
            AuthRoutes["Auth Routes: backend/routes/auth.js"]:::backend
            JobsRoutes["Jobs Routes: backend/routes/jobs.js"]:::backend
            BlogsRoutes["Blogs Routes: backend/routes/blogs.js"]:::backend
            AdminRoutes["Admin Routes: backend/routes/admin.js"]:::backend
        end

        subgraph "Business Logic Layer"
            direction TB
            AuthMiddleware["Auth Middleware: backend/middleWare/authMiddleware.js"]:::backend
            AuthController["Auth Controller: backend/controllers/authController.js"]:::backend
            JobsController["Jobs Controller: backend/controllers/jobsController.js"]:::backend
            BlogsController["Blog Controller: backend/controllers/blogsController.js"]:::backend
        end

        subgraph "Data Layer"
            direction TB
            DBConfig["DB Config: backend/config/db.js"]:::backend
            UserModel["User Model: backend/models/User.js"]:::backend
            JobModel["Job Model: backend/models/Job.js"]:::backend
        end

        PostgresDB[(PostgreSQL Database)]:::db
    end

    %% External Services
    ExternalNewsAPI["News API Service"]:::external

    %% Connections
    ReactIndex -->|initializes| AppJS
    AppJS -->|renders routes| Pages
    AppJS -->|renders admin routes| AdminPages
    AppJS -->|uses guard| PrivateRoute
    Pages -->|calls| JobsApi
    Pages -->|calls| NewsApi
    AdminPages -->|calls| JobsApi

    Pages -->|loads template| PublicHTML
    AppJS -->|imports| UIComponents
    UIComponents -->|styled by| StylingAssets

    AppJS -->|HTTPS JSON| APIServer

    APIServer -->|routes to| AuthRoutes
    APIServer -->|routes to| JobsRoutes
    APIServer -->|routes to| BlogsRoutes
    APIServer -->|routes to| AdminRoutes

    AuthRoutes -->|uses| AuthController
    JobsRoutes -->|uses| JobsController
    BlogsRoutes -->|uses| BlogsController
    AdminRoutes -->|protected by| AuthMiddleware
    AdminRoutes -->|uses| AuthController

    AuthController -->|CRUD| UserModel
    JobsController -->|CRUD| JobModel
    BlogsController -->|CRUD| UserModel

    AuthController -->|reads config| DBConfig
    JobsController -->|reads config| DBConfig
    BlogsController -->|reads config| DBConfig

    UserModel -->|queries| PostgresDB
    JobModel -->|queries| PostgresDB
    DBConfig -->|connects| PostgresDB

    JobsController -->|fetch news| ExternalNewsAPI
    BlogsController -->|fetch news| ExternalNewsAPI
    APIServer -->|forwards| ExternalNewsAPI

    %% Click Events
    click DBConfig "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/config/db.js"
    click AuthMiddleware "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/middleWare/authMiddleware.js"
    click AuthController "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/controllers/authController.js"
    click JobsController "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/controllers/jobsController.js"
    click BlogsController "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/controllers/blogsController.js"
    click UserModel "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/models/User.js"
    click JobModel "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/models/Job.js"
    click AuthRoutes "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/routes/auth.js"
    click JobsRoutes "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/routes/jobs.js"
    click BlogsRoutes "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/routes/blogs.js"
    click AdminRoutes "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/routes/admin.js"
    click APIServer "https://github.com/arjuniyyappan/techzconnect/blob/main/backend/server.js"
    click ReactIndex "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/src/index.js"
    click AppJS "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/src/App.js"
    click Pages "https://github.com/arjuniyyappan/techzconnect/tree/main/frontend/src/pages/"
    click AdminPages "https://github.com/arjuniyyappan/techzconnect/tree/main/frontend/src/pages/admin/"
    click PrivateRoute "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/src/components/PrivateRoute.js"
    click JobsApi "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/src/api/jobsApi.js"
    click NewsApi "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/src/api/newsApi.js"
    click PublicHTML "https://github.com/arjuniyyappan/techzconnect/blob/main/frontend/public/index.html"
    click UIComponents "https://github.com/arjuniyyappan/techzconnect/tree/main/frontend/src/components/"
    click StylingAssets "https://github.com/arjuniyyappan/techzconnect/tree/main/frontend/src/styles/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#000
    classDef backend fill:#d4edda,stroke:#28a745,color:#000
    classDef db fill:#fff3cd,stroke:#ffcc00,color:#000
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000
```
