/TAT

Text analyzer tool using Nodejs and ExpressJs

Primary LanguageJavaScriptMIT LicenseMIT

Text Analyzer Tool

Text Analyzer Tool is a Node.js application that provides RESTful APIs for performing various analyses on text files. It is designed to handle large files efficiently, avoiding resource-intensive methods like built-in JavaScript split functions. It employs various technologies for efficient performance like caching, logging, and leveraging MongoDB for persistence

Features

  • Analyze word, character, sentence, and paragraph count.
  • Extract the longest words from each paragraph.
  • Create and manage text files.
  • Efficiently handles large files through streaming-based processing.
  • Uses MongoDB and Mongoose for storing text data and metadata.
  • Implements Node.js MVC pattern for API creation.
  • Leverages server-side Redis cache for improved application performance.
  • Collect logs for visualization using Winston library.
  • Visualizes logs and API performance with Logtail.

API Informations

API Route Description
GET /getfiles Lists all available text files.
POST /createfiles Creates a new text file.
GET /words/:fileId Returns the number of words in a specific file.
GET /characters/:fileId Returns the number of characters in a specific file.
GET /sentences/:fileId Returns the number of sentences in a specific file.
GET /paragraphs/:fileId Returns the number of paragraphs in a specific file.
GET /longest-words/:fileId Returns the longest words in each paragraph of a specific file.
DELETE /file/:fileId Deletes a specific text file.

Dependencies

Additional Configuration:

Make sure to set the following environment variables before running the application:

  • PORT : API connection
  • NODE_ENV : Application running environment for collecting logs
  • MONGODB_UR I: The connection URI for your MongoDB instance.
  • REDIS_HOST : The hostname of your Redis server.
  • REDIS_PORT : The port of your Redis server.
  • REDIS_TIME_EXPIRATION: Redis time expiration
  • SOURCE_TOKEN: Betterstack connection token for log visualizations

Installation & Usage

  1. Clone this repository: git clone https://github.com/mhhabib/TAT.git
  2. Install dependencies: npm install
  3. Set environment variables (database connection details etc.)
  4. Start the server: npm start
  5. Use the provided API routes to analyze your text files.

Fontend set up

A ReactJS frontend that provides interactive single-page applications (SPAs) for analyzing text files. Tailwind-css-based Flowbite-React is used as a UI library.

Installation & Usage

  • Navigate to the frontend directory within the cloned repository.
  • Open a new terminal
  • Install dependencies: npm install
  • Start the development server: npm start (To avoid port conflict check the backend and run different PORT )
Screenshot 2024-02-10 at 5 34 11 PM Screenshot 2024-02-10 at 5 35 00 PM

Technologies

  • Backend: Node.js, ExpressJS
  • Frontend: ReactJS, Axios
  • Styling: Tailwind CSS, Flowbite React UI library
  • Caching: Redis
  • Database: MongoDB, Mongoose
  • Logger: Winston, Logtail

Thank you for reading this long history 🙏