admin-service is a microservice responsible for privileged user management and administrative operations for the AIOutlet platform. It provides secure endpoints for admin users to manage user accounts, roles, and statuses across the platform.
Architecture Pattern: Publisher-only service (following Amazon's admin portal pattern)
- Admins take actions through API endpoints
- Publishes events for audit/notification (e.g.,
admin.user.updated,admin.user.deleted) - Does NOT consume events - it's an action center, not an event responder
- List all users (admin only)
- View user details by ID
- Update user profile, roles, and status (activate/deactivate)
- Change user password (admin-initiated)
- Delete user accounts
- Publishes admin action events to message broker
- Robust input validation and error handling
- Structured logging for audit and traceability
- Forwards admin JWT to user-service for all privileged actions
This service is built with Node.js and Express, using Mongoose for MongoDB object modeling and Axios for inter-service communication with the user-service.
Event-Driven Design:
- Publisher Only: Emits events when admins perform actions
- No Consumer: Does not react to events from other services
- Event Notifications: Handled by notification-service and audit-service
The microservice is designed to be deployed independently and can run locally, via Docker, or in Kubernetes (AKS).
- Node.js v16+
- MongoDB instance (local, Docker, or cloud)
- A running user-service instance (for user management APIs)
Create a .env file in the root with the following variables:
# .env.example for admin-service
USER_SERVICE_URL=http://localhost:5000/users
USER_SERVICE_SECRET=your-shared-secret
GET /admin/users— List all usersGET /admin/users/:id— Get user by IDPATCH /admin/users/:id— Update user profile/roles/statusPOST /admin/users/:id/password/change— Change user passwordDELETE /admin/users/:id— Delete user account
All endpoints require a valid admin JWT in the Authorization header.
Contributions are welcome! Please open issues or submit pull requests.
MIT License
For questions or support, reach out to the AIOutlet dev team.