Skip to content

pin705/headless-sentry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Headless Sentry

Nuxt UI MongoDB TypeScript

πŸ‡»πŸ‡³ TiαΊΏng Việt

Mα»™t hệ thα»‘ng giΓ‘m sΓ‘t uptime vΓ  performance mαΊ‘nh mαΊ½ được xΓ’y dα»±ng vα»›i Nuxt 3, MongoDB Time Series vΓ  AWS S3. Headless Sentry cung cαΊ₯p giαΊ£i phΓ‘p monitoring toΓ n diện cho websites vΓ  APIs cα»§a bαΊ‘n vα»›i khαΊ£ nΔƒng cαΊ£nh bΓ‘o realtime vΓ  status page cΓ΄ng khai.

✨ TΓ­nh nΔƒng chΓ­nh

  • πŸš€ Monitoring Δ‘a dαΊ‘ng: HTTP/HTTPS endpoints, SSL certificates, error rates
  • πŸ“Š Time Series Database: Sα»­ dα»₯ng MongoDB Time Series để lΖ°u trα»― dα»― liệu hiệu quαΊ£
  • πŸ”” CαΊ£nh bΓ‘o realtime: ThΓ΄ng bΓ‘o ngay khi cΓ³ sα»± cα»‘
  • 🌐 Status Page: Trang trαΊ‘ng thΓ‘i cΓ΄ng khai cho khΓ‘ch hΓ ng
  • πŸ‘₯ QuαΊ£n lΓ½ team: Hα»— trợ nhiều thΓ nh viΓͺn vα»›i phΓ’n quyền
  • πŸ“ˆ Dashboard trα»±c quan: Biểu Δ‘α»“ vΓ  metrics chi tiαΊΏt
  • πŸ” BαΊ£o mαΊ­t: Authentication vα»›i nuxt-auth-utils
  • ⚑ Cron Jobs: Tα»± Δ‘α»™ng kiểm tra theo lα»‹ch Δ‘α»‹nh sαΊ΅n

πŸ› οΈ Tech Stack

  • Frontend: Nuxt 3, Vue 3, TypeScript
  • UI Framework: Nuxt UI, TailwindCSS
  • Backend: Nuxt Server API
  • Database: MongoDB vα»›i Time Series collections
  • Authentication: nuxt-auth-utils
  • Storage: AWS S3 (presigned URLs)
  • Cron Jobs: nuxt-cron
  • Charts: Unovis
  • Validation: Zod

πŸ“‹ YΓͺu cαΊ§u hệ thα»‘ng

  • Node.js 18+
  • pnpm (khuyαΊΏn nghα»‹)
  • MongoDB 5.0+ (hα»— trợ Time Series)
  • AWS S3 bucket (cho upload files)

πŸš€ CΓ i Δ‘αΊ·t

1. Clone repository

git clone https://github.com/pin705/headless-sentry.git
cd headless-sentry

2. CΓ i Δ‘αΊ·t dependencies

pnpm install

3. CαΊ₯u hΓ¬nh environment variables

TαΊ‘o file .env tα»« template:

cp .env.example .env

Cập nhật cÑc biến môi trường:

# Database
MONGODB_URI=mongodb://localhost:27017/headless-sentry

# Authentication (generate random strings)
NUXT_SESSION_PASSWORD=your-32-char-session-password
NUXT_OAUTH_GITHUB_CLIENT_ID=your-github-oauth-client-id
NUXT_OAUTH_GITHUB_CLIENT_SECRET=your-github-oauth-client-secret

# AWS S3 (for file uploads)
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_REGION=us-east-1
AWS_S3_BUCKET=your-s3-bucket-name

# Application
NUXT_PUBLIC_APP_URL=http://localhost:3000

4. Khởi tẑo MongoDB Time Series Collection

⚠️ Quan trọng: BαΊ‘n cαΊ§n tαΊ‘o collection results vα»›i Time Series mα»™t lαΊ§n duy nhαΊ₯t.

KαΊΏt nα»‘i vΓ o MongoDB vΓ  chαΊ‘y lệnh sau:

// Chuyển sang database cα»§a bαΊ‘n
use headless-sentry

// TαΊ‘o Time Series collection
db.createCollection("results", {
   timeseries: {
      timeField: "timestamp",
      metaField: "meta", 
      granularity: "minutes"
   }
})

Chi tiαΊΏt xem trong file NOTES.md.

πŸ”§ Development

Khởi Δ‘α»™ng development server

pnpm dev

Server sαΊ½ chαΊ‘y tαΊ‘i http://localhost:3000

CΓ‘c lệnh hα»―u Γ­ch

# Lint code
pnpm lint

# Type checking
pnpm typecheck

# Build production
pnpm build

# Preview production build
pnpm preview

πŸ“ CαΊ₯u trΓΊc dα»± Γ‘n

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ components/          # Vue components
β”‚   β”œβ”€β”€ pages/              # Nuxt pages & routing
β”‚   β”œβ”€β”€ composables/        # Vue composables
β”‚   β”œβ”€β”€ middleware/         # Route middleware
β”‚   └── layouts/            # Layout components
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ api/                # Server API endpoints
β”‚   β”œβ”€β”€ cron/               # Cron job definitions
β”‚   β”œβ”€β”€ models/             # MongoDB models
β”‚   └── utils/              # Server utilities
β”œβ”€β”€ public/                 # Static assets
└── ecosystem.config.cjs    # PM2 configuration

πŸ”„ Cron Jobs

Hệ thα»‘ng sα»­ dα»₯ng cΓ‘c cron job để monitoring tα»± Δ‘α»™ng:

  • monitorCheck.cron.ts: Kiểm tra uptime endpoints
  • sslCheck.cron.ts: Kiểm tra SSL certificates
  • errorRateCheck.cron.ts: GiΓ‘m sΓ‘t error rates

Cron jobs chαΊ‘y theo timezone Asia/Ho_Chi_Minh vΓ  cΓ³ thể cαΊ₯u hΓ¬nh trong nuxt.config.ts.

πŸš€ Production Deployment

Sα»­ dα»₯ng PM2

# Build application
pnpm build

# Start vα»›i PM2
pm2 start ecosystem.config.cjs

# Monitor
pm2 monit

# Stop
pm2 stop headless-sentry

Docker (tùy chọn)

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY .output .output
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]

🌐 Status Page

Mα»—i project cΓ³ thể tαΊ‘o status page cΓ΄ng khai vα»›i:

  • Custom slug (vd: /status/my-service)
  • Custom domain support
  • Logo vΓ  branding tΓΉy chỉnh
  • Hiển thα»‹ uptime realtime

πŸ” Authentication

Hα»— trợ nhiều phΖ°Ζ‘ng thα»©c Δ‘Δƒng nhαΊ­p:

  • GitHub OAuth
  • Email/Password (tΓΉy chọn)
  • Session management vα»›i nuxt-auth-utils

🀝 Contributing

  1. Fork repository
  2. TαΊ‘o feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. TαΊ‘o Pull Request

πŸ“ License

Dα»± Γ‘n nΓ y được phΓ’n phα»‘i dΖ°α»›i MIT License.

πŸ› Bug Reports & Feature Requests

Vui lΓ²ng tαΊ‘o GitHub Issue để bΓ‘o cΓ‘o lα»—i hoαΊ·c đề xuαΊ₯t tΓ­nh nΔƒng mα»›i.

πŸ“ž Support


⭐ NαΊΏu dα»± Γ‘n hα»―u Γ­ch, hΓ£y cho chΓΊng tΓ΄i mα»™t star trΓͺn GitHub!

πŸ‡ΊπŸ‡Έ English

A powerful uptime and performance monitoring system built with Nuxt 3, MongoDB Time Series, and AWS S3. Headless Sentry provides comprehensive monitoring solutions for your websites and APIs with real-time alerts and public status pages.

✨ Key Features

  • πŸš€ Multi-type Monitoring: HTTP/HTTPS endpoints, SSL certificates, error rates
  • πŸ“Š Time Series Database: Uses MongoDB Time Series for efficient data storage
  • πŸ”” Real-time Alerts: Instant notifications when issues occur
  • 🌐 Status Pages: Public status pages for your customers
  • πŸ‘₯ Team Management: Multi-member support with role-based permissions
  • πŸ“ˆ Visual Dashboard: Detailed charts and metrics
  • πŸ” Security: Authentication with nuxt-auth-utils
  • ⚑ Cron Jobs: Automated scheduled monitoring

πŸ› οΈ Tech Stack

  • Frontend: Nuxt 3, Vue 3, TypeScript
  • UI Framework: Nuxt UI, TailwindCSS
  • Backend: Nuxt Server API
  • Database: MongoDB with Time Series collections
  • Authentication: nuxt-auth-utils
  • Storage: AWS S3 (presigned URLs)
  • Cron Jobs: nuxt-cron
  • Charts: Unovis
  • Validation: Zod

πŸ“‹ System Requirements

  • Node.js 18+
  • pnpm (recommended)
  • MongoDB 5.0+ (Time Series support)
  • AWS S3 bucket (for file uploads)

πŸš€ Installation

1. Clone repository

git clone https://github.com/pin705/headless-sentry.git
cd headless-sentry

2. Install dependencies

pnpm install

3. Configure environment variables

Create .env file from template:

cp .env.example .env

Update environment variables:

# Database
MONGODB_URI=mongodb://localhost:27017/headless-sentry

# Authentication (generate random strings)
NUXT_SESSION_PASSWORD=your-32-char-session-password
NUXT_OAUTH_GITHUB_CLIENT_ID=your-github-oauth-client-id
NUXT_OAUTH_GITHUB_CLIENT_SECRET=your-github-oauth-client-secret

# AWS S3 (for file uploads)
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_REGION=us-east-1
AWS_S3_BUCKET=your-s3-bucket-name

# Application
NUXT_PUBLIC_APP_URL=http://localhost:3000

4. Initialize MongoDB Time Series Collection

⚠️ Important: You need to create the results collection with Time Series once.

Connect to MongoDB and run:

// Switch to your database
use headless-sentry

// Create Time Series collection
db.createCollection("results", {
   timeseries: {
      timeField: "timestamp",
      metaField: "meta", 
      granularity: "minutes"
   }
})

See NOTES.md for details.

πŸ”§ Development

Start development server

pnpm dev

Server will run at http://localhost:3000

Useful commands

# Lint code
pnpm lint

# Type checking
pnpm typecheck

# Build production
pnpm build

# Preview production build
pnpm preview

πŸ“ Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ components/          # Vue components
β”‚   β”œβ”€β”€ pages/              # Nuxt pages & routing
β”‚   β”œβ”€β”€ composables/        # Vue composables
β”‚   β”œβ”€β”€ middleware/         # Route middleware
β”‚   └── layouts/            # Layout components
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ api/                # Server API endpoints
β”‚   β”œβ”€β”€ cron/               # Cron job definitions
β”‚   β”œβ”€β”€ models/             # MongoDB models
β”‚   └── utils/              # Server utilities
β”œβ”€β”€ public/                 # Static assets
└── ecosystem.config.cjs    # PM2 configuration

πŸ”„ Cron Jobs

The system uses cron jobs for automated monitoring:

  • monitorCheck.cron.ts: Check endpoint uptime
  • sslCheck.cron.ts: Check SSL certificates
  • errorRateCheck.cron.ts: Monitor error rates

Cron jobs run in Asia/Ho_Chi_Minh timezone and can be configured in nuxt.config.ts.

πŸš€ Production Deployment

Using PM2

# Build application
pnpm build

# Start with PM2
pm2 start ecosystem.config.cjs

# Monitor
pm2 monit

# Stop
pm2 stop headless-sentry

Docker (optional)

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY .output .output
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]

🌐 Status Page

Each project can create public status pages with:

  • Custom slug (e.g., /status/my-service)
  • Custom domain support
  • Logo and custom branding
  • Real-time uptime display

πŸ” Authentication

Supports multiple login methods:

  • GitHub OAuth
  • Email/Password (optional)
  • Session management with nuxt-auth-utils

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Create Pull Request

πŸ“ License

This project is distributed under MIT License.

πŸ› Bug Reports & Feature Requests

Please create GitHub Issues to report bugs or request new features.

πŸ“ž Support


⭐ If this project is helpful, please give us a star on GitHub!

About

πŸš€ A lightweight, headless Sentry client for server-side applications - minimal overhead, maximum performance

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages