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
- 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 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. |
-
Redis: This application requires a running Redis instance for caching functionalities. Please refer to the official Redis documentation for installation and configuration instructions: https://redis.io/download/
-
MongoDB: The application persists data in MongoDB using Mongoose. You can either set up a local MongoDB instance or register for a MongoDB cloud service like MongoDB Atlas and configure the connection URI in your environment variables. Refer to the Mongoose documentation for more information: https://www.mongodb.com/developer/languages/javascript/getting-started-with-mongodb-and-mongoose/
Make sure to set the following environment variables before running the application:
PORT
: API connectionNODE_ENV
: Application running environment for collecting logsMONGODB_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 expirationSOURCE_TOKEN
: Betterstack connection token for log visualizations
- Clone this repository:
git clone https://github.com/mhhabib/TAT.git
- Install dependencies:
npm install
- Set environment variables (database connection details etc.)
- Start the server:
npm start
- Use the provided API routes to analyze your text files.
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.
- 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 )
- 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 🙏