Shared API contracts, DTO classes, endpoint constants, realtime event names, and domain types for BeeFriends services.
Use this package whenever the mobile app and backend services need the same API shape. This keeps routes, DTOs, and event payloads from drifting between repositories.
Shared Kernel
-> BeeFriends Mobile
-> User Service
-> Match Chat Service
-> Notification Service| Export | Purpose |
|---|---|
@beefriends/shared-kernel |
Root endpoint constants and frontend-safe types |
@beefriends/shared-kernel/types |
User/domain TypeScript types |
@beefriends/shared-kernel/dto |
Nest-friendly DTO classes |
@beefriends/shared-kernel/dto/user |
User DTO classes |
@beefriends/shared-kernel/dto/chat |
Chat, match, presence DTOs and realtime events |
@beefriends/shared-kernel/dto/notification |
Notification DTOs and pub/sub event payloads |
@beefriends/shared-kernel/endpoints |
All endpoint groups |
@beefriends/shared-kernel/endpoints/user |
User service endpoints |
@beefriends/shared-kernel/endpoints/chat |
Match Chat service endpoints |
@beefriends/shared-kernel/endpoints/notification |
Notification service endpoints |
| Constant | Service |
|---|---|
AUTH_ENDPOINTS |
User auth endpoints |
USER_ENDPOINTS |
User profile and upload endpoints |
CAMPUS_ENDPOINTS |
Campus master data |
MAJOR_ENDPOINTS |
Major master data |
HOBBY_ENDPOINTS |
Hobby master data |
MESSAGE_ENDPOINTS |
Chat message endpoints |
CONVERSATION_ENDPOINTS |
Conversation endpoints |
MATCH_ENDPOINTS |
Discover, swipe, match, and unmatch endpoints |
PRESENCE_ENDPOINTS |
Online/offline presence endpoints |
NOTIFICATION_ENDPOINTS |
Notification, settings, and device token endpoints |
DEPARTMENT_ENDPOINTS is kept as a compatibility alias for older code. Prefer MAJOR_ENDPOINTS for new code.
Install:
npm install @beefriends/shared-kernelFrontend endpoint usage:
import { USER_ENDPOINTS } from '@beefriends/shared-kernel';
import type { UserProfileDto } from '@beefriends/shared-kernel/types';
const me = await fetch(USER_ENDPOINTS.ME).then(
(response) => response.json() as Promise<UserProfileDto>,
);Backend DTO usage:
import { CreateMessageDto } from '@beefriends/shared-kernel/dto/chat';
import { CreateNotificationDto } from '@beefriends/shared-kernel/dto/notification';Realtime event usage:
import { CHAT_EVENTS } from '@beefriends/shared-kernel/dto/chat';
socket.emit(CHAT_EVENTS.JOIN_CONVERSATION, { conversationId, userId });npm install
npm run buildWatch mode:
npm run build:watch| Command | Description |
|---|---|
npm run build |
Compile TypeScript to dist |
npm run build:watch |
Compile in watch mode |
npm run prepublishOnly |
Build before publish |
npm run release:patch |
Bump patch version, push commits and tag |
npm run release:minor |
Bump minor version, push commits and tag |
npm run release:major |
Bump major version, push commits and tag |
When a route, DTO, realtime event, or pub/sub payload changes:
- Update the shared-kernel source.
- Bump the package version.
- Publish the package.
- Update each consuming repository to the new version.
Pushing a version tag triggers the publish workflow for npm.