Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4642d59
Added env file and .env.example file
ajilkumar Jan 28, 2026
7cb51e5
Implement backend infrastructure
ajilkumar Jan 29, 2026
025f8b3
Merge pull request #1 from ajilkumar/feat/backendInfrastructure
ajilkumar Jan 29, 2026
005767b
Migrations for database
ajilkumar Jan 30, 2026
97bd5e7
Merge pull request #2 from ajilkumar/feat/migrations
ajilkumar Jan 30, 2026
440132f
Authentication and API key management
ajilkumar Jan 31, 2026
b3e8fc8
Merge pull request #3 from ajilkumar/feat/auth
ajilkumar Jan 31, 2026
9216210
API Usage Rate Limiting Implementation
ajilkumar Feb 1, 2026
a894d8f
Merge pull request #4 from ajilkumar/feat/ratelimit
ajilkumar Feb 1, 2026
598aa67
Repository management
ajilkumar Feb 2, 2026
ca5e650
Merge pull request #5 from ajilkumar/feat/repository-management
ajilkumar Feb 2, 2026
5f15513
Metrics Endpoints for Repositories
ajilkumar Feb 2, 2026
c4e67d4
Merge pull request #6 from ajilkumar/feat/metrics
ajilkumar Feb 2, 2026
1d1d020
Usage Statiscs and Quota Endpoints
ajilkumar Feb 3, 2026
4c74f16
Merge pull request #7 from ajilkumar/feat/Usage
ajilkumar Feb 3, 2026
532ad31
Testing
ajilkumar Feb 4, 2026
7566801
Merge pull request #8 from ajilkumar/feat/Tests
ajilkumar Feb 4, 2026
3abd38d
Unit testing
ajilkumar Feb 4, 2026
14581ee
Merge pull request #9 from ajilkumar/feat/unitTests
ajilkumar Feb 4, 2026
e4347a2
Integration Tests
ajilkumar Feb 4, 2026
eb0b874
Merge pull request #10 from ajilkumar/feat/integration-tests
ajilkumar Feb 4, 2026
9caa81b
feat: add CI/CD pipeline with Github actions
ajilkumar Feb 4, 2026
8d0335d
feat: verify CI/CD pipeline
ajilkumar Feb 4, 2026
be0547e
added husky dependency
ajilkumar Feb 4, 2026
f8f7a88
bug fix for eslint errors
ajilkumar Feb 4, 2026
fee6c06
bug fix
ajilkumar Feb 4, 2026
bb100ef
removing unused imports
ajilkumar Feb 4, 2026
7228d16
coverage removed
ajilkumar Feb 4, 2026
87887df
Merge pull request #11 from ajilkumar/feature/test-ci-cd
ajilkumar Feb 4, 2026
487714a
removed test.yml file
ajilkumar Feb 4, 2026
7979b9d
Merge pull request #12 from ajilkumar/feature/test-ci-cd
ajilkumar Feb 4, 2026
7d219e4
feat - minor change
ajilkumar Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# ============================================
# APPLICATION CONFIGURATION
# ============================================
NODE_ENV=development
PORT=3000
API_VERSION=v1
APP_URL=http://localhost:3000

# ============================================
# DATABASE CONFIGURATION (PostgreSQL)
# ============================================
# Option 1: Use connection string (recommended)
DATABASE_URL=postgresql://username:password@hostname:5432/database_name

# Option 2: Use individual parameters
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name

# Connection pool settings
DB_POOL_MIN=2
DB_POOL_MAX=10
DB_IDLE_TIMEOUT_MS=30000
DB_CONNECTION_TIMEOUT_MS=2000

# ============================================
# REDIS CONFIGURATION
# ============================================
# Option 1: Use connection string (recommended)
REDIS_URL=redis://localhost:6379

# Option 2: Use individual parameters
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0

# ============================================
# RATE LIMITING CONFIGURATION
# ============================================
RATE_LIMIT_WINDOW_MS=3600000
RATE_LIMIT_FREE_TIER=100
RATE_LIMIT_PRO_TIER=1000
RATE_LIMIT_ENTERPRISE_TIER=10000

# ============================================
# GITHUB API CONFIGURATION
# ============================================
# Get your token from: https://github.com/settings/tokens
# Permissions needed: public_repo (for public repos)
GITHUB_TOKEN=your_github_personal_access_token_here
GITHUB_API_URL=https://api.github.com
GITHUB_RATE_LIMIT=5000

# ============================================
# SECURITY CONFIGURATION
# ============================================
# Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
API_KEY_SECRET=generate_a_random_secret_key_here

# CORS allowed origins (comma-separated)
CORS_ORIGIN=http://localhost:3000,http://localhost:3001

# ============================================
# LOGGING CONFIGURATION
# ============================================
# Options: error, warn, info, http, debug
LOG_LEVEL=info
LOG_TO_FILE=true

# ============================================
# CACHE CONFIGURATION
# ============================================
CACHE_TTL_SHORT=300
CACHE_TTL_MEDIUM=900
CACHE_TTL_LONG=3600
CACHE_TTL_VERY_LONG=86400

# ============================================
# JOB QUEUE CONFIGURATION
# ============================================
JOB_TIMEOUT_MS=300000
JOB_MAX_RETRIES=3
JOB_RETRY_DELAY_MS=5000

# ============================================
# PAGINATION DEFAULTS
# ============================================
PAGINATION_DEFAULT_PAGE=1
PAGINATION_DEFAULT_LIMIT=20
PAGINATION_MAX_LIMIT=100

# ============================================
# REPOSITORY ANALYSIS CONFIGURATION
# ============================================
MAX_COMMITS_TO_ANALYZE=1000
MAX_FILE_SIZE_BYTES=1048576
GIT_OPERATION_TIMEOUT_MS=60000

# ============================================
# EMAIL CONFIGURATION (Future feature)
# ============================================
# SMTP_HOST=smtp.gmail.com
# SMTP_PORT=587
# SMTP_USER=your-email@gmail.com
# SMTP_PASSWORD=your-app-password
# SMTP_FROM=noreply@devmetrics.com

# ============================================
# MONITORING & OBSERVABILITY (Future feature)
# ============================================
# SENTRY_DSN=your_sentry_dsn_here
# ENABLE_APM=false

# ============================================
# FEATURE FLAGS
# ============================================
ENABLE_WEBHOOKS=false
ENABLE_EMAIL_NOTIFICATIONS=false
ENABLE_COMPLEXITY_ANALYSIS=true
ENABLE_HEALTH_SCORE=true
25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

164 changes: 164 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: CI/CD Pipeline

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
# Job 1: Code Quality Checks
quality:
name: Code Quality
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

# - name: Run ESLint
# run: npm run lint
# continue-on-error: true

- name: TypeScript type check
run: npm run typecheck

# Job 2: Run Tests
test:
name: Tests
runs-on: ubuntu-latest
needs: quality

services:
# PostgreSQL test database
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: devmetrics
POSTGRES_PASSWORD: test_password
POSTGRES_DB: devmetrics_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5433:5432

# Redis test instance
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6380:6379

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage
env:
NODE_ENV: test
TEST_DATABASE_URL: postgresql://devmetrics:test_password@localhost:5433/devmetrics_test
DATABASE_URL: postgresql://devmetrics:test_password@localhost:5433/devmetrics_test
TEST_REDIS_URL: redis://localhost:6380
REDIS_URL: redis://localhost:6380
API_KEY_SECRET: test-secret-key-for-ci-only-minimum-32-chars
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_API_URL: https://api.github.com
CACHE_TTL_SHORT: 300
CACHE_TTL_MEDIUM: 900
CACHE_TTL_LONG: 3600

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: ./coverage/lcov.info
# flags: unittests
# name: codecov-umbrella
# fail_ci_if_error: false
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# - name: Comment coverage on PR
# if: github.event_name == 'pull_request'
# uses: romeovs/lcov-reporter-action@v0.3.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# lcov-file: ./coverage/lcov.info

# Job 3: Build Check
build:
name: Build
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build TypeScript
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7

# Job 4: Security Audit
security:
name: Security Audit
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Run npm audit
run: npm audit --audit-level=moderate
continue-on-error: true

- name: Check for vulnerable dependencies
run: |
npm install -g npm-check-updates
ncu --doctor --doctorTest "npm test"
continue-on-error: true
67 changes: 67 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Pull Request Checks

on:
pull_request:
branches: [main, develop]

jobs:
# PR Title Check
pr-title:
name: PR Title Check
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
style
refactor
perf
test
chore
requireScope: false

# Changed files check
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
tests: ${{ steps.filter.outputs.tests }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'src/**'
tests:
- 'tests/**'
docs:
- 'docs/**'
- '*.md'

# Size label
pr-size:
name: PR Size Label
runs-on: ubuntu-latest
steps:
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_label: 'size/xs'
xs_max_size: 10
s_label: 'size/s'
s_max_size: 100
m_label: 'size/m'
m_max_size: 500
l_label: 'size/l'
l_max_size: 1000
xl_label: 'size/xl'
Loading
Loading