Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 13 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ module.exports = {
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
root: true,
env: {
node: true,
Expand All @@ -35,24 +32,27 @@ module.exports = {
'prefer-arrow-callback': 'error',
'arrow-spacing': 'error',
'comma-dangle': ['error', 'always-multiline'],
'semi': ['error', 'always'],
'quotes': 'off',
'indent': 'off',
semi: ['error', 'always'],
quotes: 'off',
indent: 'off',
'@typescript-eslint/indent': 'off',
'max-len': 'off',
'eol-last': 'error',
'no-trailing-spaces': 'error',
'padded-blocks': ['error', 'never'],
'space-before-function-paren': ['error', {
'anonymous': 'always',
'named': 'never',
'asyncArrow': 'always'
}],
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],
'keyword-spacing': 'error',
'space-infix-ops': 'error',
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'brace-style': ['error', '1tbs'],
'curly': 'error'
curly: 'error',
},
};
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
test:
name: Test and Quality Checks
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
Expand All @@ -29,7 +29,7 @@ jobs:
--health-retries 5
ports:
- 5432:5432

redis:
image: redis:7
options: >-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/comprehensive-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Comprehensive Testing Pipeline

on:
push:
branches: [ main, develop, 'feature/*' ]
branches: [main, develop, 'feature/*']
pull_request:
branches: [ main, develop ]
branches: [main, develop]

env:
NODE_VERSION: '18'
Expand Down
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ We welcome contributions from the community! This guide will help you get starte
### Prerequisites

Before contributing, ensure you have:

- **Node.js** v18+ (LTS recommended)
- **PostgreSQL** v14+
- **Redis** (for caching)
Expand All @@ -20,23 +21,27 @@ Before contributing, ensure you have:
### Development Setup

1. **Fork and Clone**

```bash
git clone https://github.com/MettaChain/PropChain-BackEnd.git
cd PropChain-BackEnd
```

2. **Install Dependencies**

```bash
npm install
```

3. **Environment Setup**

```bash
cp .env.example .env
# Configure your local environment variables
```

4. **Database Setup**

```bash
createdb propchain_dev
npm run migrate
Expand Down Expand Up @@ -67,11 +72,13 @@ Before contributing, ensure you have:
### 🔧 Code Contributions

#### 1. Create an Issue

- Search existing issues to avoid duplicates
- Create a new issue describing your proposed changes
- Wait for maintainer approval before starting work

#### 2. Set Up Your Branch

```bash
git checkout -b feature/your-feature-name
# or
Expand All @@ -81,12 +88,14 @@ git checkout -b fix/your-bug-fix
#### 3. Development Guidelines

##### Code Style

- Follow **ESLint** and **Prettier** configurations
- Use **TypeScript** strict mode
- Write **descriptive commit messages**
- Keep functions small and focused

##### Code Structure

```
src/
├── controllers/ # API route handlers
Expand All @@ -99,6 +108,7 @@ src/
```

##### Best Practices

- **Error Handling**: Use proper HTTP status codes and error responses
- **Validation**: Validate all input data using DTOs
- **Security**: Sanitize inputs and implement proper authentication
Expand All @@ -121,6 +131,7 @@ npm run test:coverage
```

**Testing Requirements:**

- Unit tests for all new functions
- Integration tests for API endpoints
- E2E tests for critical user flows
Expand All @@ -129,6 +140,7 @@ npm run test:coverage
#### 5. Smart Contract Contributions

For smart contract changes:

```bash
# Compile contracts
npm run compile:contracts
Expand All @@ -141,6 +153,7 @@ npm run deploy:testnet
```

**Contract Guidelines:**

- Follow **Solidity** or **Rust** best practices
- Include comprehensive test coverage
- Add inline documentation
Expand All @@ -160,6 +173,7 @@ test(contracts): add ERC721 tokenization tests
```

**Types:**

- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
Expand All @@ -176,6 +190,7 @@ test(contracts): add ERC721 tokenization tests
- Code comments for complex logic

2. **Run Full Test Suite**

```bash
npm run test:all
npm run lint
Expand All @@ -189,22 +204,27 @@ test(contracts): add ERC721 tokenization tests
- Add testing instructions

4. **PR Template**

```markdown
## Description

Brief description of changes

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing

- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed

## Checklist

- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
Expand Down Expand Up @@ -243,12 +263,14 @@ test(contracts): add ERC721 tokenization tests
## 📚 Development Resources

### Documentation

- [API Documentation](./docs/api.md)
- [Architecture Guide](./docs/architecture.md)
- [Smart Contract Docs](./docs/contracts.md)
- [Deployment Guide](./docs/deployment.md)

### Tools & Extensions

- **VS Code Extensions**:
- TypeScript Hero
- ESLint
Expand All @@ -257,6 +279,7 @@ test(contracts): add ERC721 tokenization tests
- Thunder Client (API testing)

### Learning Resources

- [NestJS Documentation](https://docs.nestjs.com/)
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
- [Ethereum Development Guide](https://ethereum.org/en/developers/)
Expand Down Expand Up @@ -285,6 +308,7 @@ We are committed to providing a welcoming and inclusive environment. Please read
### Contributors

We value all contributions! Contributors will be:

- Listed in our README
- Mentioned in release notes
- Invited to our contributor Discord channel
Expand All @@ -303,6 +327,7 @@ We value all contributions! Contributors will be:
### Version Management

We follow [Semantic Versioning](https://semver.org/):

- **MAJOR**: Breaking changes
- **MINOR**: New features (backward compatible)
- **PATCH**: Bug fixes (backward compatible)
Expand Down Expand Up @@ -331,6 +356,7 @@ We follow [Semantic Versioning](https://semver.org/):
### Common Issues

**Database Connection Errors**

```bash
# Check PostgreSQL status
pg_ctl status
Expand All @@ -340,13 +366,15 @@ npm run db:reset
```

**Smart Contract Compilation**

```bash
# Clear cache
npm run clean
npm run compile:contracts
```

**Test Failures**

```bash
# Clear Jest cache
npm run test:clear
Expand Down
30 changes: 30 additions & 0 deletions OBSERVABILITY_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Observability & Monitoring System

This module introduces advanced monitoring and observability for the PropChain-BackEnd, supporting production-grade operations and troubleshooting.

## Features

- **Distributed Tracing:** OpenTelemetry-based tracing with correlation ID propagation.
- **Metrics Collection:** Prometheus metrics for HTTP requests (latency, count, status).
- **Centralized Logging:** Winston-based structured logging, ready for aggregation.
- **Performance Monitoring:** Request duration histograms and counters.
- **Health Checks:** Existing endpoints for liveness, readiness, and dependency checks.
- **Extensible:** Ready for integration with Sentry (error tracking), Grafana/Kibana (dashboards), and anomaly detection tools.

## Usage

- All HTTP requests are traced and measured automatically.
- Metrics are exposed at `/metrics` (Prometheus scrape endpoint).
- Logs are structured and can be forwarded to ELK, Azure Monitor, or similar.
- Health endpoints remain at `/health`, `/health/detailed`, `/health/liveness`, `/health/readiness`.

## Next Steps

- Configure Winston transports for log aggregation.
- Integrate Sentry or similar for error tracking.
- Add Grafana/Kibana dashboard templates.
- Integrate anomaly detection and predictive monitoring as needed.

---

For questions or further enhancements, see the ObservabilityModule and related files in `src/observability/`.
Loading
Loading