diff --git a/documentation/arc42/05_building_block_view.adoc b/documentation/arc42/05_building_block_view.adoc index 83cb36c..646fbcc 100644 --- a/documentation/arc42/05_building_block_view.adoc +++ b/documentation/arc42/05_building_block_view.adoc @@ -26,7 +26,8 @@ Maintain an overview of your source code by making its structure understandable Contained Building Blocks:: -include::./building_blocks/users_api/users_api_short_description.adoc[] +include::./building_blocks/users_api/timelines_api_short.adoc[] +include::./building_blocks/users_api/users_api_short.adoc[] diff --git a/documentation/arc42/building_blocks/timelines_api/timelines_api_details.adoc b/documentation/arc42/building_blocks/timelines_api/timelines_api_details.adoc new file mode 100644 index 0000000..7ca2a65 --- /dev/null +++ b/documentation/arc42/building_blocks/timelines_api/timelines_api_details.adoc @@ -0,0 +1,10 @@ +include::../diagrams/TimelinesAPIContainer.puml[] +include::../diagrams/TimelinesAPIContainer-key.puml[] + +include::users_api_short_description.adoc[] + +===== Fulfilled Requirements +The API implements rate limiting to prevent abuse and ensure fair usage. + +===== Risks +* Risk of slow response times or degraded performance during peak usage periods. diff --git a/documentation/arc42/building_blocks/timelines_api/timelines_api_short.adoc b/documentation/arc42/building_blocks/timelines_api/timelines_api_short.adoc new file mode 100644 index 0000000..ea40bab --- /dev/null +++ b/documentation/arc42/building_blocks/timelines_api/timelines_api_short.adoc @@ -0,0 +1,15 @@ +==== Timelines API + +The Timelines API microservice is responsible for managing user timelines in the image-sharing system. +It retrieves posts from users that the specified user follows, ensuring that they are ordered by recency. + +===== Interface(s) +link:https://editor.swagger.io/?url=https://raw.githubusercontent.com/shcherby/system-design-arc42/refs/heads/main/documentation/arc42/building_blocks/users_api/timelines_api_swagger.yaml[REST API] +link:https://github.com[Messages] + +===== Locations +link:https://github.com[users-api details] +link:https://github.com[users-api repository] +link:https://github.com[users-api CI/CD] +link:https://github.com[users-api database] +link:https://github.com[users-api releases] diff --git a/documentation/arc42/building_blocks/timelines_api/timelines_api_swagger.yaml b/documentation/arc42/building_blocks/timelines_api/timelines_api_swagger.yaml new file mode 100644 index 0000000..98f2c43 --- /dev/null +++ b/documentation/arc42/building_blocks/timelines_api/timelines_api_swagger.yaml @@ -0,0 +1,68 @@ +openapi: 3.0.0 +info: + title: Timelines API + description: API for retrieving timelines of posts from followed users. + version: 1.0.0 +servers: + - url: http://api.example.com/v1 + description: Main API server +paths: + /users/{userId}/timeline: + get: + summary: Get user timeline + description: Retrieve the latest posts from the users that the specified user follows. + parameters: + - name: userId + in: path + required: true + description: The ID of the user whose timeline to retrieve. + schema: + type: string + example: "12345" + - name: limit + in: query + required: false + description: The number of posts to retrieve (default is 20). + schema: + type: integer + example: 20 + - name: page + in: query + required: false + description: The page number for pagination. + schema: + type: integer + example: 1 + responses: + '200': + description: A list of posts for the user's timeline. + content: + application/json: + schema: + type: object + properties: + posts: + type: array + items: + type: object + properties: + postId: + type: string + example: "67890" + author: + type: string + example: "user123" + imageUrl: + type: string + example: "http://cdn.example.com/image.jpg" + caption: + type: string + example: "Enjoying the view!" + timestamp: + type: string + format: date-time + example: "2024-10-24T14:34:00Z" + '400': + description: Invalid request parameters (e.g., missing userId). + '404': + description: User not found or no posts available. diff --git a/documentation/arc42/building_blocks/users_api/users_api_details.adoc b/documentation/arc42/building_blocks/users_api/users_api_details.adoc index fe365ec..0e41e8c 100644 --- a/documentation/arc42/building_blocks/users_api/users_api_details.adoc +++ b/documentation/arc42/building_blocks/users_api/users_api_details.adoc @@ -1,40 +1,33 @@ + + + include::users_api_short_description.adoc[] ===== Quality/Performance Characteristics ====== Performance -* **Response Time**: Aim for responses within 200 milliseconds. -* **Throughput**: Support several thousand requests per second (RPS) during peak times. -* **Latency**: Minimize network latency with efficient API calls and lightweight data formats. +* Aim for responses within 200 milliseconds. +* Support several thousand requests per second (RPS) during peak times. +* Minimize network latency with efficient API calls and lightweight data formats. ====== Scalability -* **Horizontal Scalability**: Design to add more instances as user demand increases. -* **Load Balancing**: Distribute requests evenly across multiple API instances. +* Design to add more instances as user demand increases. +* Distribute requests evenly across multiple API instances. ====== Reliability -* **High Availability**: Target 99.9% uptime with redundancy and failover strategies. -* **Graceful Degradation**: Ensure limited functionality in case of partial failures. - +* Target 99.9% uptime with redundancy and failover strategies. +* Ensure limited functionality in case of partial failures. ===== Fulfilled Requirements -* **User Registration**: Users can create accounts by providing necessary details (username, email, password). -* **User Authentication**: Users can log in using their credentials, receiving an access token for subsequent requests. -* **Profile Management**: Users can view and update their profile information (e.g., username, bio). -* **Password Recovery**: Users can initiate a password reset process via email. -* **User Data Security**: All sensitive user data is encrypted in transit and at rest. -* **Rate Limiting**: The API implements rate limiting to prevent abuse and ensure fair usage. -* **Versioning**: The API supports versioning to maintain backward compatibility. -* **Comprehensive Documentation**: Clear and detailed API documentation is provided for developers. - -===== Open Issues/Problems/Risks -* **Data Privacy Concerns**: Ensuring compliance with data protection regulations (e.g., GDPR) regarding user data handling and storage. -* **Scalability Challenges**: Potential difficulties in scaling the API efficiently to handle sudden increases in user demand. -* **Security Vulnerabilities**: Risks of unauthorized access or data breaches if security measures are not adequately implemented. -* **Dependency Management**: Reliance on third-party authentication providers could lead to outages or service interruptions. -* **User Experience Issues**: Complexity in the registration or authentication process may lead to user drop-off. -* **Performance Bottlenecks**: Risk of slow response times or degraded performance during peak usage periods. -* **Integration Challenges**: Difficulties in integrating with existing systems or services that rely on user data. -* **Documentation Gaps**: Incomplete or unclear API documentation may hinder developer adoption and usage. - +* Users can create accounts by providing necessary details (username, email, password). +* Users can log in using their credentials, receiving an access token for subsequent requests. +* Users can view and update their profile information (e.g., username, bio). +* All sensitive user data is encrypted in transit and at rest. + +===== Risks +* Ensuring compliance with data protection regulations (e.g., GDPR) regarding user data handling and storage. +* Risks of unauthorized access or data breaches if security measures are not adequately implemented. +* Reliance on third-party authentication providers could lead to outages or service interruptions. +* Complexity in the registration or authentication process may lead to user drop-off. === Level 2 diff --git a/documentation/arc42/building_blocks/users_api/users_api_short_description.adoc b/documentation/arc42/building_blocks/users_api/users_api_short.adoc similarity index 71% rename from documentation/arc42/building_blocks/users_api/users_api_short_description.adoc rename to documentation/arc42/building_blocks/users_api/users_api_short.adoc index d09be58..f03a323 100644 --- a/documentation/arc42/building_blocks/users_api/users_api_short_description.adoc +++ b/documentation/arc42/building_blocks/users_api/users_api_short.adoc @@ -5,10 +5,11 @@ It also manages user data, including personal information, preferences, and secu ===== Interface(s) link:https://editor.swagger.io/?url=https://raw.githubusercontent.com/shcherby/system-design-arc42/refs/heads/main/documentation/arc42/building_blocks/users_api/users_api_swagger.yaml[REST API] -link:https://messages.com[Messages] +link:https://github.com[Messages] ===== Locations -link:https://details.com[users-api full description] -link:https://github.com[users-api git hub location] -link:https://github.com[users-api build pipelines] -link:https://github.com[users-api artifacts] +link:https://github.com[users-api details] +link:https://github.com[users-api repository] +link:https://github.com[users-api CI/CD] +link:https://github.com[users-api database] +link:https://github.com[users-api releases] diff --git a/documentation/diagrams-as-code/main.dsl b/documentation/diagrams-as-code/main.dsl index b75d58d..7352b9b 100644 --- a/documentation/diagrams-as-code/main.dsl +++ b/documentation/diagrams-as-code/main.dsl @@ -118,6 +118,12 @@ workspace "highly-scalable-image-sharing-platform" "This is an example workspace autoLayout } + dynamic imageSharingPlatform "TimelinesAPIContainer"{ + title "Timelines API" + timelinesApiApp -> timelinesDatabase + autoLayout lr + } + styles { element "Person" { color #ffffff