openapi: 3.1.0 info: title: "{{PROJECT_NAME}} REST API" description: "REST endpoints for {{PROJECT_NAME}}. Real-time events use WebSocket (see ws-events.json)." version: 0.1.0 servers: - url: http://localhost:3000/api description: Local development tags: - name: Health description: Service health - name: Auth description: Authentication - name: Rooms description: Room/channel management - name: Messages description: Message history (REST) paths: /health: get: tags: [Health] summary: Health check operationId: getHealth responses: "200": description: OK content: application/json: schema: type: object properties: status: type: string wsConnections: type: integer redisConnected: type: boolean /auth/register: post: tags: [Auth] summary: Register user operationId: register requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/login: post: tags: [Auth] summary: Login operationId: login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/logout: post: tags: [Auth] summary: Logout operationId: logout security: - bearerAuth: [] responses: "204": description: OK /rooms: get: tags: [Rooms] summary: List rooms operationId: listRooms security: - bearerAuth: [] responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Room" post: tags: [Rooms] summary: Create room operationId: createRoom security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateRoomRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Room" /rooms/{roomId}/messages: get: tags: [Messages] summary: Get message history operationId: getMessages security: - bearerAuth: [] parameters: - name: roomId in: path required: true schema: type: string format: uuid - name: before in: query description: Cursor for pagination (message ID) schema: type: string - name: limit in: query schema: type: integer default: 50 maximum: 100 responses: "200": description: OK content: application/json: schema: type: object properties: messages: type: array items: $ref: "#/components/schemas/Message" hasMore: type: boolean components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: RegisterRequest: type: object required: [email, password, name] properties: email: type: string format: email password: type: string minLength: 8 name: type: string LoginRequest: type: object required: [email, password] properties: email: type: string password: type: string AuthResponse: type: object properties: accessToken: type: string refreshToken: type: string expiresIn: type: integer CreateRoomRequest: type: object required: [name] properties: name: type: string description: type: string isPrivate: type: boolean default: false Room: type: object properties: id: type: string format: uuid name: type: string description: type: string isPrivate: type: boolean createdBy: type: string format: uuid memberCount: type: integer createdAt: type: string format: date-time Message: type: object properties: id: type: string format: uuid roomId: type: string format: uuid userId: type: string format: uuid userName: type: string content: type: string type: type: string enum: [text, system, image] createdAt: type: string format: date-time Error: type: object properties: statusCode: type: integer error: type: string message: type: string