Skip to content

incrementallab/moez

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Report Generator

A comprehensive SQL-based report generation and scheduling platform with a modern React frontend and NestJS backend.

πŸš€ Features

  • Database Connections: Connect to PostgreSQL, MySQL, SQL Server, Oracle, SQLite
  • SQL Query Editor: Write and test SQL queries with syntax highlighting
  • Report Scheduling: Cron-based scheduling with timezone support
  • Multiple Output Formats: CSV, Excel (XLS/XLSX), PDF, JSON, XML
  • Report Routing: Automatic email and FTP delivery
  • User Management: Role-based access control (Admin, Report Manager, Viewer)
  • Execution History: Track all report executions with detailed logs
  • AI Assistant: Optional AI-powered query generation and debugging

πŸ“‹ Prerequisites

  • Node.js 18+
  • npm 8+
  • Docker & Docker Compose (recommended for database services)
  • PostgreSQL 15+ (if not using Docker)
  • Redis 7+ (if not using Docker)

πŸ›  Quick Installation

Option 1: Automated Setup (Recommended)

# Clone the repository
git clone <repository-url>
cd Moez

# Run the installation script
./install.sh

Option 2: Manual Setup

1. Install Dependencies

# Install all dependencies
npm install
cd backend && npm install
cd ../frontend && npm install
cd ..

2. Start Database Services

# Using Docker
docker compose up -d postgres redis

# Or manually install PostgreSQL and Redis

3. Configure Environment

Create backend/.env:

DATABASE_URL="postgresql://postgres:postgres@localhost:5433/report_gen?schema=public"
JWT_SECRET="your-super-secret-jwt-key-change-in-production"
JWT_EXPIRATION="7d"
REDIS_HOST="localhost"
REDIS_PORT="6379"
STORAGE_PATH="./storage"
FRONTEND_URL="http://localhost:5173"
ENCRYPTION_KEY="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"

4. Setup Database

cd backend
npx prisma generate
npx prisma db push
mkdir -p storage

5. Start Development Servers

# Terminal 1 - Backend
cd backend
npm run start:dev

# Terminal 2 - Frontend
cd frontend
npm run dev

🐳 Docker Deployment

Development with Docker

# Start all services
docker compose up

# Or start specific services
docker compose up -d postgres redis
docker compose up backend frontend

Production Deployment

# Build and start production containers
docker compose -f docker-compose.prod.yml up -d

πŸ“ Project Structure

Moez/
β”œβ”€β”€ backend/                 # NestJS Backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ auth/           # Authentication (JWT)
β”‚   β”‚   β”œβ”€β”€ connections/    # Database connections
β”‚   β”‚   β”œβ”€β”€ reports/        # Report management
β”‚   β”‚   β”œβ”€β”€ schedules/      # Scheduling (Cron)
β”‚   β”‚   β”œβ”€β”€ executions/     # Execution history
β”‚   β”‚   β”œβ”€β”€ output/         # File generation (CSV, Excel, etc.)
β”‚   β”‚   β”œβ”€β”€ routing/        # Email/FTP delivery
β”‚   β”‚   β”œβ”€β”€ users/          # User management
β”‚   β”‚   β”œβ”€β”€ groups/         # Group management
β”‚   β”‚   └── bot/            # AI assistant
β”‚   └── prisma/             # Database schema
β”œβ”€β”€ frontend/               # React Frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ contexts/       # React contexts
β”‚   β”‚   └── lib/            # Utilities & API
β”‚   └── public/
β”œβ”€β”€ docker-compose.yml      # Docker configuration
β”œβ”€β”€ install.sh              # Installation script
└── README.md

πŸ”‘ Default Ports

Service Port
Frontend 5173
Backend 3000
PostgreSQL 5433
Redis 6379

πŸ“š API Documentation

Swagger documentation is available at:

http://localhost:3000/api/docs

🎯 Usage

1. Create a Database Connection

Navigate to Connections β†’ New Connection and configure:

  • Connection name
  • Database type (PostgreSQL, MySQL, etc.)
  • Host, port, username, password, database

2. Create a Report

Navigate to Reports β†’ New Report:

  • Select a connection
  • Write your SQL query
  • Test the query
  • Choose output format (CSV, Excel, PDF, etc.)

3. Execute Report

  • Manual: Click the ▢️ Play button on the Reports page
  • Scheduled: Create a schedule with cron expression

4. Download Results

Navigate to Executions and click Download on successful executions.

πŸ” User Roles

Role Permissions
ADMIN Full access to all features
REPORT_MANAGER Create/edit reports, connections, schedules
VIEWER View and execute reports only

πŸ›‘ Security

  • JWT-based authentication
  • Password hashing with bcrypt
  • Database credentials encryption
  • Role-based access control
  • SQL injection prevention through parameterized queries

πŸ“§ Email Configuration (Optional)

To enable email delivery, configure SMTP in the routing settings:

  • SMTP Host
  • Port (25, 465, 587)
  • Username/Password
  • TLS/SSL options

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ†˜ Support

For issues and feature requests, please create an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors