-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guide
dev-mondoshawan edited this page Apr 16, 2026
·
1 revision
**Referenced Files in This Document**
- [agentid_build_plan.md](https://github.com/RunTimeAdmin/AgentID/blob/main/agentid_build_plan.md)
- [backend/package.json](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/package.json)
- [frontend/package.json](https://github.com/RunTimeAdmin/AgentID/blob/main/frontend/package.json)
- [backend/src/services/bagsAuthVerifier.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/services/bagsAuthVerifier.js)
- [backend/src/services/pkiChallenge.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/services/pkiChallenge.js)
- [backend/src/services/saidBinding.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/services/saidBinding.js)
- [backend/src/services/bagsReputation.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/services/bagsReputation.js)
- [backend/src/services/badgeBuilder.js](https://github.com/RunTimeAdmin/AgentID/blob/main/backend/src/services/badgeBuilder.js)
- Introduction
- Getting Started
- Project Structure
- Development Workflow
- Key Services
- Integration Patterns
- Testing
- Deployment
This guide provides developers with the information needed to understand, extend, and contribute to the AgentID project. It covers the architecture, key components, development workflows, and best practices.
- Node.js 18+
- PostgreSQL 14+
- Redis 7+
- Git
- Clone the repository
- Install dependencies:
npm installin bothbackendandfrontenddirectories - Set up environment variables (copy
.env.exampleto.env) - Run database migrations:
npm run migrate - Start the backend:
npm run dev - Start the frontend:
npm run dev
AgentID/
├── backend/
│ ├── src/
│ │ ├── config/ # Environment configuration
│ │ ├── middleware/ # Express middleware
│ │ ├── models/ # Database models and queries
│ │ ├── routes/ # API route handlers
│ │ ├── services/ # Business logic services
│ │ └── utils/ # Utility functions
│ ├── package.json
│ └── server.js # Application entry point
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── lib/ # API client and utilities
│ │ ├── pages/ # Page components
│ │ └── widget/ # Embeddable widget
│ ├── package.json
│ └── vite.config.js
└── docs/ # Documentation
-
main: Production-ready code -
develop: Integration branch - Feature branches:
feature/description - Bug fix branches:
fix/description
- ESLint configuration in both backend and frontend
- Prettier for code formatting
- Follow existing patterns for consistency
Use conventional commits:
-
feat:New feature -
fix:Bug fix -
docs:Documentation changes -
refactor:Code refactoring -
test:Test changes
Wraps the Bags Ed25519 authentication flow:
-
initBagsAuth(pubkey): Initialize authentication -
verifyBagsSignature(message, signature, pubkey): Verify signatures -
completeBagsAuth(pubkey, signature): Complete authentication
Manages challenge-response verification:
-
issueChallenge(pubkey): Create new challenge -
verifyChallenge(pubkey, nonce, signature): Verify response
Integrates with SAID Identity Gateway:
-
registerWithSAID(params): Register agent -
getSAIDTrustScore(pubkey): Retrieve trust score -
discoverSAIDAgents(capability): Discover agents
Computes reputation scores:
-
computeBagsScore(pubkey): Calculate score -
refreshAndStoreScore(pubkey): Update stored score
Generates trust badges:
-
getBadgeJSON(pubkey): JSON badge data -
getBadgeSVG(pubkey): SVG badge image -
getWidgetHTML(pubkey): HTML widget
- Create route file in
backend/src/routes/ - Implement handlers with proper validation
- Add rate limiting if needed
- Register in
server.js - Add tests
- Create service file in
backend/src/services/ - Export functions with clear interfaces
- Document with JSDoc comments
- Add unit tests
- Update relevant documentation
- Create component in
frontend/src/components/ - Use TailwindCSS for styling
- Follow existing component patterns
- Add PropTypes for type checking
- Document props and usage
cd backend
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportcd frontend
npm test # Run all tests
npm run test:ui # UI component tests- Unit tests for services and utilities
- Integration tests for routes
- Component tests for React components
- E2E tests for critical user flows
docker-compose up -d- Build frontend:
cd frontend && npm run build - Set production environment variables
- Start backend:
cd backend && npm start - Configure reverse proxy (Nginx)
- Development: Hot reload, debug logging
- Staging: Production-like, test data
- Production: Optimized, monitored, SSL