This document describes the backend APIs used by shopFlow and how the frontend calls them.
| Key | Development (proxy) | Production (example) |
|---|---|---|
userApp |
/UserApp |
https://api.freeprojectapi.com/api/UserApp |
product |
/products |
https://dummyjson.com/products |
cart |
/carts |
https://dummyjson.com/carts |
api |
/api |
https://stripe-backend-wheat.vercel.app/api |
Development requests are proxied according to src/proxy.conf.json (e.g. /UserApp → freeprojectapi, /products and /carts → dummyjson, /api → localhost:4242 or your Stripe backend).
Base URL: environment.userApp.
| Method | Path | Description |
|---|---|---|
| POST | /CreateNewUser |
Register; body: CreateUserRequest. Response: CreateUserResponse. |
| POST | /login |
Login; body: LoginRequest. Response: LoginResponse (includes data.token, data.refreshToken, data.userId, data.emailId). |
| POST | /send-reset-otp?emailId={email} |
Send OTP for password reset. |
| POST | /verify-otp-reset-password |
Verify OTP and set new password; body: ResetPasswordRequest. Response: plain text. |
Auth flow: Login/register return tokens; the app stores them (e.g. via TokenService) and sends Authorization: Bearer <token> on protected requests (see AuthInterceptor and protected endpoint list in core).
Base URL: environment.userApp.
| Method | Path | Description |
|---|---|---|
| GET | /searchUsers |
Query params: searchText, pageNumber, pageSize. Response: UsersResponse (paginated list of UserResponse). |
Base URL: environment.product (e.g. DummyJSON /products).
| Method | Path | Description |
|---|---|---|
| GET | /search |
Params: q, limit, skip. Response: ProductsApiResponse<ProductApiShape>. |
| GET | /{id} |
Single product. Response: Product. |
| GET | /categories |
Response: Category[]. |
| GET | /category/{slug} |
Params: limit, skip. Response: ProductsApiResponse<ProductApiShape>. |
| GET | `` (root) | Params: sortBy, order, limit, skip. Response: ProductsApiResponse<Product>. |
| POST | /add |
Body: AddProductRequest. Response: same shape. |
| DELETE | /{id} |
Response: ProductDeleteResponse. |
Base URL: environment.cart. The app currently uses cart state in NgRx Signals and persistence via CartStorage; backend cart API (if used) would be called from services using the same base URL and Endpoints pattern.
Base URL: environment.api (Stripe backend).
| Method | Path | Description |
|---|---|---|
| POST | /checkout |
Body: CheckoutRequest (items: array of cart line items). Response: CheckoutResponse (url: Stripe Checkout session URL). Frontend redirects user to url. |
All request/response shapes used by the app are in src/app/types/dto/ and re-exported from @app-types/dto. See src/app/types/dto/README.md for the list and import examples.
- HTTP errors: Caught by
GlobalHttpErrorInterceptor. Status 0 or ≥400 are mapped to a user message viatoErrorMessage()(seecore/http/http-utils.ts) and shown in a toast. Standard messages for 401, 403, 404, 500 are inErrorMessagesenum. - Auth errors: 401 can be used to clear token and redirect to login; the exact behavior is in the auth effect and guards.
- Add or update path constants in
src/app/api/endpoints.ts. - Use them in the appropriate API service (
ProductApi,AuthApiService, etc.) withApiClient.get/post/...and the correct base URL fromapi.baseUrls. - If the contract changes, update or add types in
src/app/types/dto/and use them in the API service and consumers.