Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
55ba6f5
feat: Add leaderboard routes and scheduling for sync jobs
TanyaMushonga Sep 7, 2025
8463669
feat: Create leaderboard index file to export leaderboardController
TanyaMushonga Sep 7, 2025
4a0a93c
feat: Implement leaderboard controller with data fetching and populat…
TanyaMushonga Sep 7, 2025
e1012f7
feat: Add cleanupOldData endpoint for manual cleanup of old commits
TanyaMushonga Sep 7, 2025
bf6b67e
feat: Implement leaderboard sync job for updating leaderboard data
TanyaMushonga Sep 7, 2025
9db6bf3
feat: Enhance syncJob to include cleanup of old commits and leaderboa…
TanyaMushonga Sep 7, 2025
f90678c
feat: Add leaderboard routes for data retrieval and synchronization
TanyaMushonga Sep 7, 2025
8c96f66
feat: Add manual cleanup endpoint for old user data
TanyaMushonga Sep 7, 2025
afb3be7
feat: Implement GitHub GraphQL API integration for developer search a…
TanyaMushonga Sep 7, 2025
6790cfd
feat: Update fetchRepositoryCommits and fetchAllRepositoryCommits to …
TanyaMushonga Sep 7, 2025
1534698
feat: Implement LeaderboardService for fetching and populating develo…
TanyaMushonga Sep 7, 2025
ce61bc8
feat: Add DeveloperScoringEngine for calculating developer scores bas…
TanyaMushonga Sep 7, 2025
efff46c
feat: Refactor syncRepositoryCommits to include userId and improve lo…
TanyaMushonga Sep 7, 2025
186f298
feat: Re-export leaderboard types from leaderboard module
TanyaMushonga Sep 7, 2025
16188a0
feat: Add leaderboard and developer profile types for enhanced data s…
TanyaMushonga Sep 7, 2025
6664477
refactor: Improve code formatting and readability in leaderboardContr…
TanyaMushonga Sep 8, 2025
f1d4a81
feat: Add user contribution heatmap, activity, and streak endpoints w…
TanyaMushonga Sep 8, 2025
591d5e3
style: Improve code formatting and readability in leaderboardSyncJob
TanyaMushonga Sep 8, 2025
a94fc63
style: Remove unnecessary blank lines in syncJob function for improve…
TanyaMushonga Sep 8, 2025
7a9674f
style: Consolidate import statements for improved readability in lead…
TanyaMushonga Sep 8, 2025
9a441c6
feat: Add routes for user contribution heatmap, activity, and streak
TanyaMushonga Sep 8, 2025
b4828ca
style: Improve code formatting and readability in GitHub search funct…
TanyaMushonga Sep 8, 2025
7091b18
style: Improve code formatting and readability in leaderboard service
TanyaMushonga Sep 8, 2025
920fb05
style: Refactor scoring weights and improve code formatting in scorin…
TanyaMushonga Sep 8, 2025
3d140da
style: Enhance code formatting and add database annotations in Prisma…
TanyaMushonga Sep 9, 2025
aa034d3
style: Remove unused migration files for database schema cleanup
TanyaMushonga Sep 9, 2025
bc70225
style: Refactor location handling in leaderboard controller for impro…
TanyaMushonga Sep 9, 2025
b5e778b
style: Refactor location normalization and enhance leaderboard servic…
TanyaMushonga Sep 9, 2025
57356ee
style: Add .dockerignore file to exclude unnecessary files from Docke…
TanyaMushonga Oct 7, 2025
2f55cc7
style: Add .env.example file for environment variable configuration
TanyaMushonga Oct 7, 2025
90426a9
style: Add buildspec.yml for AWS CodeBuild configuration
TanyaMushonga Oct 7, 2025
9ec9034
style: Add Docker setup documentation for DevMetrics Server
TanyaMushonga Oct 7, 2025
924706d
style: Add docker-compose configuration for development environment
TanyaMushonga Oct 7, 2025
4175d94
style: Add docker-compose configuration for PostgreSQL and applicatio…
TanyaMushonga Oct 7, 2025
58ec1f5
style: Add multi-stage Dockerfile for Node.js TypeScript application
TanyaMushonga Oct 7, 2025
ff060f7
style: Add development Dockerfile with hot reload configuration
TanyaMushonga Oct 7, 2025
07e6802
style: Update dependencies in package-lock.json for Prisma and TypeSc…
TanyaMushonga Oct 7, 2025
ce1bcf5
style: Update package.json with additional Docker and Prisma scripts
TanyaMushonga Oct 7, 2025
f55216e
refactor: Replace dbPrisma with PrismaClient for improved database ha…
TanyaMushonga Oct 7, 2025
4829e26
feat: Remove PostgreSQL service from docker-compose files and externa…
TanyaMushonga Dec 28, 2025
2296647
feat: remove embedded PostgreSQL service and externalize application …
TanyaMushonga Dec 28, 2025
28a11f4
refactor: Remove local PostgreSQL service and externalize app configu…
TanyaMushonga Dec 28, 2025
fa6cb41
docs: Add contribution guidelines and MIT license, and update README …
TanyaMushonga Dec 28, 2025
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
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.git
.gitignore
README.md
.env
.env.local
.env.production
.env.test
coverage
.nyc_output
dist
build
*.tsbuildinfo
.DS_Store
.vscode
.idea
*.swp
*.swo
logs
*.log
# Don't ignore .npmrc as it's needed for GitHub packages
# .npmrc
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Database Configuration
DATABASE_URL="postgresql://tanya:tanya100@localhost:5432/devmetrics_db"

# Application Configuration
NODE_ENV="development"
PORT=4000

# GitHub API Configuration (add your token here)
# GITHUB_TOKEN="your_github_token_here"

# JWT Configuration (add your secret here)
# JWT_SECRET="your_jwt_secret_here"

# Logging Configuration
LOG_LEVEL="info"
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing to DevMetrics Server

First off, thanks for taking the time to contribute! 🎉

The following is a set of guidelines for contributing to DevMetrics Server. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

## How Can I Contribute?

### Reporting Bugs

This section guides you through submitting a bug report. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.

- **Check existing issues** to see if the bug has already been reported.
- **Use a clear and descriptive title** for the issue to identify the problem.
- **Describe the reproduction steps** in as much detail as possible.

### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion, including completely new features and minor improvements to existing functionality.

- **Use a clear and descriptive title** for the issue to identify the suggestion.
- **Provide a step-by-step description of the suggested enhancement** in as much detail as possible.
- **Explain why this enhancement would be useful** to most users.

### Pull Requests

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.

## Styleguides

### Git Commit Messages

- Use the specific tense ("Fixed bug" instead of "Fixing bug")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line

### TypeScript Styleguide

- Use `Prettier` and `ESLint` for code formatting.
- Prefer interfaces over types.
- Avoid `any` - define strict types.
92 changes: 92 additions & 0 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# DevMetrics Server - Docker Setup

## Quick Start

### 1. Environment Setup

```bash
# Copy environment template
cp .env.example .env

# Edit .env with your configuration (optional for basic setup)
nano .env
```

### 2. Production Build

```bash
# Build and run with PostgreSQL
docker-compose up --build

# Or run in background
docker-compose up -d --build
```

### 3. Development with Hot Reload

```bash
# Run development environment with file watching
docker-compose -f docker-compose.dev.yml up --build
```

## Available Services

- **Application**: http://localhost:4000
- **Health Check**: http://localhost:4000/api/health
- **PostgreSQL**: localhost:5432 (user: postgres, password: postgres, database: devmetrics)

## Useful Commands

```bash
# Production environment
npm run docker:up # Start production stack
npm run docker:down # Stop production stack

# Development environment
npm run docker:up:dev # Start dev stack with hot reload
npm run docker:down:dev # Stop dev stack

# Database only
npm run docker:db # Start only PostgreSQL

# View logs
npm run docker:logs # View application logs
docker-compose logs postgres # View database logs

# Database operations
npm run prisma:generate # Generate Prisma client
npm run prisma:migrate # Run migrations (development)
npm run prisma:deploy # Deploy migrations (production)
npm run prisma:studio # Open Prisma Studio
```

## Database Persistence

- Production data: `postgres_data` volume
- Development data: `postgres_data_dev` volume

To reset the database:

```bash
# Stop containers
docker-compose down

# Remove volumes (WARNING: This deletes all data)
docker-compose down -v

# Or remove specific volume
docker volume rm devmetrics-server_postgres_data
```

## Health Checks

The application includes health checks for:

- Application server (checks /api/health endpoint)
- PostgreSQL database (pg_isready)

Check container health:

```bash
docker-compose ps
```
60 changes: 60 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Multi-stage Dockerfile for Node.js TypeScript application

# Stage 1: Build stage
FROM node:18-alpine AS builder

WORKDIR /app

# Copy package files
COPY package*.json ./

# Install all dependencies
RUN npm ci

# Copy source code
COPY . .

# Generate Prisma client
RUN npx prisma generate

# Build TypeScript
RUN npm run build

# Stage 2: Production stage
FROM node:18-alpine AS production

# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init

# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001

WORKDIR /app

# Copy package files
COPY package*.json ./

# Install only production dependencies
RUN npm ci --only=production && npm cache clean --force

# Copy built application from builder stage
COPY --from=builder --chown=nextjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma

# Switch to non-root user
USER nextjs

# Expose port
EXPOSE 4000

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:4000/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"

# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]

# Start the application
CMD ["npm", "start"]
38 changes: 38 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Development Dockerfile with hot reload
FROM node:18-alpine

# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init

# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001

WORKDIR /app

# Copy package files
COPY package*.json ./

# Install all dependencies (including dev dependencies)
RUN npm ci

# Copy prisma schema
COPY prisma ./prisma

# Generate Prisma client
RUN npx prisma generate

# Change ownership of the app directory
RUN chown -R nextjs:nodejs /app

# Switch to non-root user
USER nextjs

# Expose port
EXPOSE 4000

# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]

# Start the development server (this will be overridden by docker-compose)
CMD ["npm", "run", "dev"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 TanyaMushonga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading