Skip to content

omnidyon/insightful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tech Stack

Frontend

Angular 19

Angular Material - UI components

Chart.js with ng2-charts - Data visualization

RxJS - Reactive programming

Backend

Node.js with TypeScript and Express

ts-node 10.9 - TypeScript execution environment

MongoDB - Primary data storage for raw error events

Elasticsearch - Indexed search and analytics

Redis - Query caching and performance optimization

Prerequisites

Before running this project, ensure you have the following installed:

Node.js (v20.19.0 or newer)

MongoDB (v6.2 or higher)

Elasticsearch (v16.7.3)

Redis (v6 or higher)

Installation & Setup

1.Database & Service Setup

MongoDB Installation

Windows 11:

Download MongoDB Community Server from MongoDB Download Center

Run the installer and follow the setup wizard

Download MongoDB Compass from MongoDB Compass Download

Install Compass and connect to mongodb://localhost:27017

Ubuntu Linux:

# Import MongoDB public GPG key
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -

# Create list file for MongoDB
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

# Update package database
sudo apt-get update

# Install MongoDB
sudo apt-get install -y mongodb-org

# Start MongoDB
sudo systemctl start mongod
sudo systemctl enable mongod

# Install MongoDB Compass
wget https://downloads.mongodb.com/compass/mongodb-compass_1.40.4_amd64.deb
sudo dpkg -i mongodb-compass_1.40.4_amd64.deb

Redis Installation

Windows 11:

# Enable WSL2 (run as Administrator in PowerShell)
wsl --install

# Install Redis on Ubuntu WSL
wsl
sudo apt update
sudo apt install redis-server
sudo service redis-server start

Ubuntu Linux:

# Update package index
sudo apt update

# Install Redis
sudo apt install redis-server

# Configure Redis to start on boot
sudo systemctl enable redis-server

# Start Redis service
sudo systemctl start redis-server

# Test Redis connection
redis-cli ping
# Should return: PONG

Project Setup

Clone and Install Dependencies

# Clone the repository
git clone git@github.com:omnidyon/insightful.git
cd insightful

# Backend setup
cd backend
npm install

# Frontend setup  
cd ../frontend
npm install

Environment Verification

Check MongoDB:

mongosh --eval "db.adminCommand('ping')"
# Should return: { "ok" : 1 }

Check Redis:

redis-cli ping
# Should return: PONG

Running the Project

Start Backend Server

For Local:

cd backend
npm run local

Expected result:

Alt Text

For Local in Debug mode (logging calls):

cd backend
npm run local-debug

Expected result: Alt Text Alt Text

Other fully usabel enviroment is dev.

Start Frontend Development Server

cd frontend
ng serve

Frontend application will be available at http://localhost:4200

Expected result: Alt Text

Testing

Backend Tests

cd backend
npm run test

Expected result:

Alt Text

Frontend Tests

cd frontend
ng run test

Expected result:

Alt Text

API Endpoints

GET /events/search - Search error events with filters

GET /events/stats - Get error statistics and aggregations

GET /health - Health check endpoint
    
GET /events/event/:id- Get a single event by id from MongoDB

GET /diagnostics/elasticsearch - Retrives Elasticsearch connection information

PUT /events/event/:id - Updates an event on Elasticsearch
    
POST /events/event - Creates a new event on Elasticsearch

POST /events/new-event- Creates a new event on MongoDB

DELETE /events/event/:id - Deletes an event from MongoDB

Postman collections is also provided in the porstman-collection folder.

Troubleshooting

Common Issues

MongoDB Connection Failed:

Ensure MongoDB service is running: sudo systemctl status mongod

Check connection string in configuration

Verify MongoDB Compass can connect to localhost:27017

Redis Connection Issues:

Confirm Redis server is running: sudo systemctl status redis-server

Check Redis configuration: sudo nano /etc/redis/redis.conf

Verify no firewall blocking port 6379

Angular Build Errors:

Clear node_modules and reinstall: rm -rf node_modules && npm install

Ensure using Node.js v20.19.0 or newer: node --version

Check Angular CLI version: ng version

Port Already in Use:

Backend (3000): lsof -ti:3000 | xargs kill -9

Frontend (4200): lsof -ti:4200 | xargs kill -9

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors