Workspace Service
Manages workspace lifecycle, configuration, and member management for multi-tenant workspaces
Overview
The Workspace Service is responsible for managing the complete workspace lifecycle in TaskFlow. It handles workspace creation, configuration, member invitations, and access control.
Key Responsibilities
Workspace Management
- Create new workspaces with default settings
- Configure workspace settings (name, subdomain, branding)
- Manage workspace subscriptions and limits
- Deactivate or delete workspaces
- Track workspace usage and analytics
Member Management
- Send member invitations via email
- Process invitation acceptance
- Manage member roles and permissions
- Remove members from workspaces
- Track member activity and last seen
Access Control
- Validate member permissions for operations
- Enforce role-based access control (RBAC)
- Manage API keys and integration tokens
- Support SSO and SAML authentication
Technical Details
Technology Stack:
- Runtime: Node.js 20
- Framework: Express.js
- Database: PostgreSQL (workspace and member data)
- Cache: Redis (session management)
- Message Broker: Apache Kafka
- Email Service: SendGrid
Database Design:
- Multi-tenant architecture using workspace_id partitioning
- Separate schemas per workspace for larger customers
- Row-level security policies
SLA:
- Availability: 99.9%
- Response Time: < 300ms (p95)
- Invitation Email Delivery: < 30 seconds
API Endpoints
REST API
POST /v1/workspacesGET /v1/workspaces/:idPATCH /v1/workspaces/:idDELETE /v1/workspaces/:id
POST /v1/workspaces/:id/members/inviteGET /v1/workspaces/:id/membersDELETE /v1/workspaces/:id/members/:memberIdGraphQL API
type Workspace { id: ID! name: String! subdomain: String! members: [Member!]! teams: [Team!]! createdAt: DateTime!}
type Mutation { createWorkspace(input: CreateWorkspaceInput!): Workspace! inviteMember(workspaceId: ID!, email: String!, role: Role!): Invitation!}Integration Points
- Authentication Service: Validates user identity and SSO
- Billing Service: Manages subscriptions and seat limits
- Email Service: Sends invitation and notification emails
- Analytics Service: Tracks workspace and member metrics
- Audit Service: Logs all workspace and member changes
Events Published
WorkspaceCreated: When a new workspace is initializedMemberInvited: When a member invitation is sentMemberJoined: When a member accepts an invitationMemberRemoved: When a member leaves or is removed
Events Consumed
PaymentReceived: To upgrade workspace subscriptionSubscriptionExpired: To downgrade or suspend workspace