A progressive Node.js framework for building efficient and scalable server-side applications.
BuildOps Backend is an enterprise-grade facility maintenance management platform designed to streamline operations in multi-tenant buildings. By providing a centralized system for complaint reporting, task assignment, and real-time tracking, BuildOps eliminates the inefficiencies of manual follow-ups and scattered communication channels. Building owners, office staff, and maintenance workers can collaborate seamlessly to ensure facilities run smoothly.
- Multi-Tenant Architecture: Single database deployment with strict per-tenant data isolation using discriminator columns (tenantId), enabling cost-effective scalability while maintaining data security.
- Role-Based Access Control (RBAC):
- Admins: Full system control including tenant management, user administration, and system configuration.
- Office Staff: Submit maintenance complaints, track request status, and view resolution history.
- Workers: Access assigned tasks, update work progress, and mark completion status.
- Complaint Management: Comprehensive lifecycle tracking from submission through resolution with audit trails and status updates.
- Task Scheduling & Notifications: Intelligent worker assignment with automated email notifications via Resend API for task updates and deadlines.
- RESTful API Architecture: Well-structured endpoints following REST principles for seamless integration with frontend applications.
- Technology Stack:
Ensure you have the following installed and properly configured:
- Node.js (version 16 or later)
- PostgreSQL (version 12 or later, configured and running)
- npm or yarn (Package Manager)
- Clone the repository:
git clone https://github.com/your-repo/buildops-backend.git
cd buildops-backend- Install dependencies:
npm install- Configure environment variables:
Create a
.envfile in the root directory with the following:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/buildops
# Authentication
ACCESS_TOKEN=your_secure_jwt_secret
JWT_EXPIRATION=7d
# Email Service
RESEND_API_KEY=your_resend_api_key
# Application
PORT=3000
NODE_ENV=development- Generate Prisma client:
npx prisma generate- Run database migrations:
npx prisma migrate dev- Seed initial data (optional):
npm run seednpm run start:devnpm run build
npm run start:prodnpm run start:debugThe server runs on port 3000 by default (configurable via .env).
Once the server is running, access the API documentation at:
- Swagger UI:
http://localhost:3000/api/docs
- Authentication:
/auth/login,/auth/register - Tenants:
/tenants(Admin only) - Users:
/users(Tenant-scoped) - Complaints:
/complaints(Create, track, update) - Tasks:
/tasks(Worker assignments and status)
Note: All API requests require:
- Valid JWT token in Authorization header:
Bearer <token> - Valid
tenantIdin request context for proper data isolation
src/
├── auth/ # Authentication module
├── tenants/ # Tenant management
├── users/ # User management with RBAC
├── complaints/ # Complaint lifecycle management
├── tasks/ # Task assignment and tracking
├── common/ # Shared utilities, guards, decorators
├── prisma/ # Database schema and migrations
└── main.ts # Application entry point
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov# Create new migration
npx prisma migrate dev --name migration_name
# Reset database (⚠️ destroys data)
npx prisma migrate reset
# Open Prisma Studio (Database GUI)
npx prisma studio- JWT-based authentication with secure token generation
- Password hashing using bcrypt
- Tenant data isolation at database query level
- Role-based authorization guards
- Input validation using class-validator
- SQL injection prevention via Prisma parameterized queries
We welcome contributions! Follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Commit your changes:
git commit -m 'Add some feature' - Push to your branch:
git push origin feature/your-feature-name - Open a pull request
Please ensure your code:
- Follows the existing code style
- Includes appropriate tests
- Updates documentation as needed
This project is licensed under the MIT License. See the LICENSE file for details.
For issues, questions, or feature requests:
- Open an issue on GitHub
- Contact: your.email@example.com
Built with ❤️ using NestJS