A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ pnpm install# development
$ pnpm run start
# watch mode
$ pnpm run start:dev
# production mode
$ pnpm run start:prod# unit tests
$ pnpm run test
# e2e tests
$ pnpm run test:e2e
# test coverage
$ pnpm run test:covWhen you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the deployment documentation for more information.
If you are looking for a cloud-based platform to deploy your NestJS application, check out Mau, our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
$ pnpm install -g @nestjs/mau
$ mau deployWith Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
Check out a few resources that may come in handy when working with NestJS:
- Visit the NestJS Documentation to learn more about the framework.
- For questions and support, please visit our Discord channel.
- To dive deeper and get more hands-on experience, check out our official video courses.
- Deploy your application to AWS with the help of NestJS Mau in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.
- Need help with your project (part-time to full-time)? Check out our official enterprise support.
- To stay in the loop and get updates, follow us on X and LinkedIn.
- Looking for a job, or have a job to offer? Check out our official Jobs board.
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.
A NestJS data processing application that fetches activity data from multiple APIs (GitLab, Slack, Teams, Jira) and generates daily summary reports. The application runs as a command-line tool rather than a web server.
- Multi-API Integration: Fetch activities from GitLab, Slack, Microsoft Teams, and Jira
- Unified Service Architecture: All services inherit from
BaseActivityServicefor consistent patterns - Standardized Activity Creation:
ActivityFactoryensures consistent activity data structure - User-Specific Filtering: Only fetches activities from the designated user for privacy and accuracy
- Configurable Integrations: Enable/disable individual APIs via environment variables
- Flexible Date Ranges: Generate summaries for today, week, month, or custom date ranges
- Comprehensive Logging: Detailed logging for debugging and monitoring
- Error Handling: Graceful error handling with fallback mechanisms
- TypeScript: Full TypeScript support with strict typing
The application uses a unified service architecture where all activity services inherit from BaseActivityService:
BaseActivityService (Abstract)
├── GitLabService
├── SlackService
├── TeamsService
└── JiraService
Key Benefits:
- Consistent Interface: All services implement the same
fetchActivities()method - Shared Error Handling: Common error handling and logging patterns
- Unified Configuration: Standardized configuration checking across all services
- Reduced Duplication: Common patterns shared in the base class
The ActivityFactory provides standardized methods for creating activity objects:
// GitLab activities
ActivityFactory.createCommitActivity(commit)
ActivityFactory.createMergeRequestActivity(mr)
ActivityFactory.createIssueActivity(issue)
ActivityFactory.createCommentActivity(comment)
// Teams activities
ActivityFactory.createTeamsMessageActivity(message)
ActivityFactory.createTeamsCalendarActivity(event)
// Jira activities
ActivityFactory.createJiraIssueActivity(issue, action)
ActivityFactory.createJiraCommentActivity(issue, comment)
ActivityFactory.createJiraWorklogActivity(issue, worklog)
ActivityFactory.createJiraChangelogActivity(issue, changelog)This ensures consistent activity data structure across all services and simplifies maintenance.
The application supports preloading data for date ranges to optimize performance:
// Services can override preloadForDateRange for optimization
protected async preloadForDateRange(startDate: Date, endDate: Date): Promise<void> {
// Service-specific preload logic
}
// Public preload method for external use
await service.preload(startDate, endDate);Benefits:
- Performance: Services can fetch data for entire date ranges upfront
- Caching: Subsequent day-by-day requests can use preloaded data
- Flexibility: Each service can implement its own optimization strategy
- Backward Compatibility: Services without preload work normally
The application implements comprehensive user filtering to ensure only activities from the designated user are processed:
All services filter activities by the current user to maintain privacy and accuracy:
- GitLab: Uses API-level filtering with
author_id/author_usernameparameters and post-fetch filtering by email - Slack: Post-fetch filtering by user email (requires
SLACK_USER_EMAILconfiguration) - Teams: Post-fetch filtering by user email for messages, user-specific calendar events
- Jira: Uses JQL with user email filtering for issues, post-fetch filtering for comments/worklogs/changelog
To enable user filtering, configure the following environment variables:
# GitLab (uses token user automatically)
GITLAB_ACCESS_TOKEN=your_token
# Slack (NEW - for user filtering)
SLACK_BOT_TOKEN=your_token
[email protected]
# Teams (already configured)
[email protected]
# Jira (already configured)
[email protected]If user email is not configured for a service:
- The service will fetch all activities (with warning logs)
- This maintains backward compatibility
- Recommended to configure user emails for privacy
- Privacy: Only processes user's own activities
- Performance: Reduces data transfer and processing
- Accuracy: Ensures summaries contain only relevant activities
- Compliance: Respects data privacy requirements
$ pnpm installCopy the example environment file and configure your API credentials:
$ cp env.example .env.localEdit .env.local with your actual API credentials. See SETUP.md for detailed configuration instructions.
# Generate summary for today
$ pnpm run generate:today
# Generate summary for the last week
$ pnpm run generate:week
# Generate summary for the last month
$ pnpm run generate:month
# Generate summary for custom date range
$ pnpm run generate --start-date 2024-01-01 --end-date 2024-01-31
# Generate and save to file
$ pnpm run generate --start-date 2024-01-01 --end-date 2024-01-31 --output ./summary.json
# Using the new --period option (recommended)
$ pnpm run generate --period today
$ pnpm run generate --period week --output ./summary.json
$ pnpm run generate --period monthThe application supports two ways to specify date ranges:
# Quick options for common time periods
$ node dist/main --period today
$ node dist/main --period week
$ node dist/main --period month# Custom date ranges
$ node dist/main --start-date 2024-01-01 --end-date 2024-01-31# Save output to file
$ node dist/main --period today --output ./summary.json# Run in development mode
$ pnpm run generate:dev --period today
# Build the application
$ pnpm run build
# Format code
$ pnpm run format
# Lint code
$ pnpm run lintThis project includes comprehensive VS Code debugging configurations. Open the project in VS Code and use the debug panel to:
- Debug Activity Summary (Today) - Debug with today's date range
- Debug Activity Summary (Week) - Debug with last 7 days
- Debug Activity Summary (Month) - Debug with last 30 days
- Debug Activity Summary (Custom Range) - Debug with custom date range
- Debug Activity Summary (With Output) - Debug and save output to file
- Debug Tests - Debug all tests
- Debug Specific Test - Debug specific test patterns
- Set breakpoints in your TypeScript files
- Select a debug configuration from the Run and Debug panel
- Press F5 or click the green play button
- Use the debug console to inspect variables and step through code
- Source Maps: Full TypeScript debugging with source maps
- Variable Inspection: Inspect all variables and objects
- Call Stack: Navigate through the call stack
- Watch Expressions: Monitor specific expressions
- Conditional Breakpoints: Set breakpoints with conditions
- Logpoints: Add logging without code changes
# Run all tests
$ pnpm run test
# Run tests in watch mode
$ pnpm run test:watch
# Run tests with coverage
$ pnpm run test:cov
# Run e2e tests
$ pnpm run test:e2e- Commits, merge requests, issues, and comments
- Configurable project IDs
- Supports both GitLab.com and self-hosted instances
- Uses
ActivityFactoryfor standardized activity creation - User Filtering: API-level filtering with
author_id/author_usernameparameters - Performance Optimization: Preloads data for entire date ranges with caching
- Channel messages and reactions
- Configurable channels
- Bot token authentication
- Unified service pattern with
BaseActivityService - User Filtering: Post-fetch filtering by user email (requires
SLACK_USER_EMAIL)
- Channel messages, calls, and calendar events
- User-specific filtering by email
- Microsoft Graph API integration
- Standardized activity creation via
ActivityFactory - User Filtering: Post-fetch filtering for messages, user-specific calendar events
- Issues, comments, and work logs
- Configurable project keys and issue types
- Basic authentication
- Consistent error handling through base class
- User Filtering: JQL-level filtering for issues, post-fetch filtering for comments/worklogs/changelog
The application supports multiple AI providers for generating human-readable summaries:
- GPT-4, GPT-3.5, and other OpenAI models
- Requires OpenAI API key
- High-quality, professional summaries
- Claude 3 Haiku, Sonnet, and Opus models
- Requires Anthropic API key
- Excellent for detailed analysis
- Gemini 1.5 Flash and other Gemini models
- Requires Google API key
- Fast and cost-effective
- Local LLM models (Llama2, Mistral, etc.)
- No API key required
- Privacy-focused, runs locally
- Various open-source models
- Requires Hugging Face API key
- Customizable model selection
- Local or remote Open WebUI instances
- OpenAI-compatible API endpoint
- Supports any model available in Open WebUI
- Optional API key for authentication
The application automatically selects the first available provider, or you can specify one:
# Use specific provider
pnpm run ai-summary:today --provider openai
pnpm run ai-summary:today --provider openwebui
# List available providers
pnpm run ai-summary --list-providersControl which APIs to use via environment variables:
# Enable only GitLab and Slack
GITLAB_ENABLED=true
SLACK_ENABLED=true
TEAMS_ENABLED=false
JIRA_ENABLED=false.env.local(highest priority) - Your local secrets.env(medium priority) - Default configuration- System environment variables (lowest priority) - Runtime overrides
The application uses separate directories for different types of output:
- Activity Data: Raw activity data from APIs (default:
activities/) - AI Summaries: Generated AI-powered summaries (default:
ai-summaries/)
You can customize these directories using environment variables:
# Customize output directories
ACTIVITIES_OUTPUT_DIR=my-activities
AI_SUMMARIES_OUTPUT_DIR=my-ai-summariesactivities/ # Raw activity data
├── 2024-01-15.activity.json # Single day summary
├── 2024-01-01_2024-01-31.activity.json # Date range summary
└── all.activity.json # Combined summary file
ai-summaries/ # AI-generated summaries
├── ai-summary-20240115.txt # Text format
├── ai-summary-20240115.md # Markdown format
└── ai-summary-20240115.json # JSON format
The application generates JSON summaries with the following structure:
[
{
"date": "2024-01-01",
"activities": [
{
"id": "unique-id",
"type": "gitlab|slack|teams|jira",
"timestamp": "2024-01-01T10:00:00.000Z",
"title": "Activity title",
"description": "Activity description",
"author": "Author name",
"url": "Activity URL",
"metadata": {}
}
],
"summary": {
"totalActivities": 10,
"byType": {
"gitlab": 5,
"slack": 3,
"teams": 1,
"jira": 1
},
"byAuthor": {
"john.doe": 3,
"jane.smith": 7
}
}
}
]To add a new activity service:
- Extend BaseActivityService:
@Injectable()
export class NewService extends BaseActivityService {
protected readonly serviceName = 'NewService';
protected readonly logger = new Logger(NewService.name);
protected isConfigured(): boolean {
// Check configuration
return true;
}
protected async fetchActivitiesForDate(date: Date): Promise<ActivityData[]> {
// Implement service-specific logic
return [];
}
// Optional: Override for performance optimization
protected async preloadForDateRange(startDate: Date, endDate: Date): Promise<void> {
// Preload data for the entire date range
// This is called before day-by-day iteration begins
}
}- Add ActivityFactory Methods:
// In ActivityFactory
static createNewServiceActivity(data: any): ActivityData {
return this.createActivity('newservice', id, timestamp, title, description, author, url, metadata);
}- Register in AppModule and update
AppServiceto include the new service.
All services inherit common error handling patterns from BaseActivityService:
- Automatic configuration validation
- Standardized error logging
- Graceful fallback mechanisms
- Consistent error context
- Setup Guide - Detailed setup and configuration instructions
- API Documentation - API integration setup
- Environment Configuration - Environment variable reference
This project is MIT licensed.
To use the Teams integration, you must register an Azure AD application and grant the correct Microsoft Graph API permissions. See SETUP.md for a full step-by-step guide.
Required Microsoft Graph API Application Permissions:
- ChannelMessage.Read.All
- Chat.Read.All
- CallRecords.Read.All
- OnlineMeetings.Read.All
- Calendars.Read
- User.Read.All
- Team.ReadBasic.All
- Group.Read.All
After adding these permissions, click Grant admin consent in the Azure Portal. Then configure your .env.local with the app's client ID, secret, and tenant ID.