# alen-kuriakose/profanity-check-ui architecture

> Architecture diagram of the GitHub repository alen-kuriakose/profanity-check-ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alen-kuriakose/profanity-check-ui
- Repository: https://github.com/alen-kuriakose/profanity-check-ui

## Overview

##### Project type and purpose
- This is a full-stack React/Node web application built with Next.js (using the “app” router).
- Its primary feature is a “profanity check” UI that lets users submit text and receive a pass/fail or cleaned‐up version back from a serverless API route.

##### File structure
- app/
- layout.tsx – root layout (HTML shell, global CSS import)
- globals.css – global Tailwind/css resets
- page.tsx – home page
- profanity-checker.tsx – UI page for the profanity checker
- api/profanity-check/route.ts – Next.js serverless API handler
- components/ui/… – reusable UI primitives (Button, Card, Input, Toggle, Tabs, Dropdown, etc.)
- lib/
- api.ts – client‐side helper for calling the profanity-check endpoint
- utils.ts – core profanity detection or text-processing logic
- public/ – static assets (images, favicon, etc.)
- root configs – next.config.(js|ts), tailwind.config.mjs, postcss.config.*, tsconfig.json, Dockerfile, eslint.config.mjs

##### README for additional insights
- Confirms a Next.js app bootstrapped with create-next-app
- Uses next/font, Tailwind CSS, can be deployed to Vercel

a. Main components
- User’s browser (React UI)
- Next.js frontend server (SSR/SSG)
- Next.js serverless API function (“profanity-check”)
- Internal Profanity Detection Module (lib/utils.ts)
b. Relationships & data flows
1. User types text in the React UI →
2. UI calls lib/api.ts → issues HTTP POST to /api/profanity-check →
3. Next.js serverless handler (route.ts) invokes lib/utils.checkProfanity() →
4. Returns JSON result →
5. UI displays “clean” text or warning.
c. Architectural patterns & principles
- Component-based UI
- “Separation of concerns” between UI (components/ui), business logic (lib/utils), and transport/API layer (app/api route)
- Serverless functions for backend logic
- CSS-in-JS + Tailwind for styling
d. Key technologies/frameworks
- Next.js App Router (React, SSR/SSG, API routes)
- React components under app/ and components/ui/
- Tailwind CSS (via tailwind.config.mjs)
- Node.js runtime for serverless functions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Browser / React UI)"
        direction TB
        Browser["User Browser (React UI)"]:::ui
        RootLayout["Root Layout"]:::ui
        Globals["Global Styles"]:::ui
        HomePage["Home Page UI"]:::ui
        ProfUI["Profanity Checker UI"]:::ui
        UIPrimitives["UI Primitives"]:::ui
    end

    %% Backend Layer
    subgraph "Backend (Next.js Serverless Runtime)"
        direction TB
        APICLient["Client-Side API Helper"]:::api
        APIFunc["API: /api/profanity-check"]:::api
        Logic["Profanity Detection Module"]:::logic
    end

    %% Static and Config
    Static["Static Assets"]:::static
    Configs["Configs & Build"]:::config

    %% Connections
    Browser --> RootLayout
    Browser --> Globals
    Browser --> HomePage
    Browser --> ProfUI
    Browser --> UIPrimitives

    ProfUI -->|"calls lib/api.ts"| APICLient
    APICLient -->|"POST /api/profanity-check"| APIFunc
    APIFunc -->|"invokes checkProfanity()"| Logic
    Logic -->|"returns result"| APIFunc
    APIFunc -->|"JSON {cleanText, flagged}"| ProfUI

    %% Side details
    Browser --> Static
    Browser --> Configs

    %% Click Events
    click RootLayout "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/app/layout.tsx"
    click Globals "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/app/globals.css"
    click HomePage "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/app/page.tsx"
    click ProfUI "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/app/profanity-checker.tsx"
    click APIFunc "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/app/api/profanity-check/route.ts"
    click UIPrimitives "https://github.com/alen-kuriakose/profanity-check-ui/tree/main/components/ui/"
    click APICLient "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/lib/api.ts"
    click Logic "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/lib/utils.ts"
    click Static "https://github.com/alen-kuriakose/profanity-check-ui/tree/main/public/"
    click Configs "https://github.com/alen-kuriakose/profanity-check-ui/blob/main/next.config.js"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,color:#000
    classDef api fill:#90EE90,stroke:#000,color:#000
    classDef logic fill:#FFA500,stroke:#000,color:#000
    classDef static fill:#D3D3D3,stroke:#000,color:#000
    classDef config fill:#F0E68C,stroke:#000,color:#000
```
