- Getting Started
- Development Environment
- Code Style Guidelines
- Git Workflow
- Testing Guidelines
- Documentation
- Code Review Process
- Security Guidelines
BudgetChain Backend is a NestJS-based TypeScript project providing scalable infrastructure for BudgetChain’s core services, including authentication, treasury, budget management, AI, blockchain interactions, reporting, and user management.
- Node.js (v14 or above)
- npm or yarn
- NestJS CLI (optional but recommended)
- Clone the repository:
git clone https://github.com/BudgetChain/BudgetChain-Backend.git
cd BudgetChain-Backend
- Install dependencies:
npm install
-
Configure environment variables by creating a
.envfile based on.env.example -
Start the development server:
npm run start:dev
- The application runs at http://localhost:3000.
src/
├── config/ # Configuration files and services
├── modules/ # Application modules
│ ├── auth/ # Authentication module
│ ├── treasury/ # Treasury management
│ ├── budget/ # Budget management
│ ├── ai/ # AI integrations
│ ├── blockchain/ # Blockchain interactions
│ ├── reporting/ # Reporting and analytics
│ └── user/ # User management
└── shared/ # Shared utilities and helpers
- PostgreSQL Database
- Swagger for API Documentation
- Use TypeScript features extensively.
- Follow NestJS’s modular architecture.
- Use Prettier and ESLint for code formatting.
- Maintain consistency in naming conventions and folder structure.
Branching Strategy:
main: Production-ready code.develop: Staging branch for testing new features.feature/*: New feature development.bugfix/*: Bug fixes.
Commit Messages: Use conventional commits:
feat: Add new treasury management feature
fix: Resolve budget calculation bug
chore: Update dependencies
Pull Requests:
- Ensure code builds without errors.
- Add unit tests for new features.
- Link related issues in the PR description.
Testing Framework: Jest Test Types:
-
Unit Tests: Test individual functions.
-
Integration Tests: Test interactions between modules.
Running Tests:
npm run test
- Use Swagger for API documentation.
- Add module-level documentation in src/modules/{module}/README.md.
- Keep the README up-to-date.
- Ensure code adheres to style guidelines.
- Check for security vulnerabilities.
- Review performance and optimization.
- Use environment variables for sensitive data.
- Implement JWT-based authentication.
- Validate input using
class-validator. - Use
helmetandcompressionfor security and performance.