Skip to content

Commit 5e4c3d9

Browse files
committed
backend docs initial version
1 parent f14dce9 commit 5e4c3d9

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

backend/README.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Backend structure Overview
2+
3+
# 🔐Api Routes
4+
5+
## Authentication
6+
**Base Path:** `/api/v1/auth`
7+
Handles user onboarding and secure session management.
8+
9+
| Endpoint | Method | Description |
10+
|:------------|:-------|:--------------------------------------------------------|
11+
| `/register` | `POST` | Creates a new user account with provided credentials. |
12+
| `/login` | `POST` | Authenticates a user and returns a secure access token. |
13+
14+
## 🧘Posture Events
15+
**Base Path:** `/api/v1/posture`
16+
Tracks and manages physical posture data points.
17+
18+
19+
| Endpoint | Method | Description |
20+
|:----------|:-------|:--------------------------------------------------------------|
21+
| `/events` | `GET` | Retrieves a historical list of all posture data for the user. |
22+
| `/events` | `POST` | Records a new posture event to the database. |
23+
### 👤User Management
24+
**Base Path:** `/api/v1/users`
25+
Manages profile details and account status.
26+
27+
| Endpoint | Method | Description |
28+
|:---------|:---------|:---------------------------------------------------------|
29+
| `/me` | `DELETE` | Permanently removes the current user's profile and data. |
30+
31+
### ⚙️Settings
32+
**Base Path:** `/api/v1/settings`
33+
Manages user preferences and application configurations.
34+
35+
| Endpoint | Method | Description |
36+
|:---------|:-------|:------------------------------------------------------------|
37+
| `/` | `GET` | Fetches the current user’s custom settings and preferences. |
38+
| `/` | `PUT` | Updates existing settings with new configuration data. |
39+
40+
### Analytics
41+
**Base Path:** `/api/v1/analytics`
42+
Manages posture events analytics
43+
44+
| Endpoint | Method | Description |
45+
|:----------|:-------|:-------------------------------------------------------|
46+
| `/weekly` | `GET` | Fetches the current user’s weekly analytics. |
47+
| `/today` | `GET` | Fetches the current user’s analytics for current day. |
48+
49+
50+
51+
-----
52+
## Requests and Responses
53+
## Auth
54+
55+
### POST /api/v1/auth/register
56+
Request Body:
57+
```json
58+
{
59+
"username":"TestUser",
60+
"email":"Test@example.com",
61+
"password":"test123"
62+
}
63+
```
64+
65+
### POST /api/v1/auth/login
66+
Request Body:
67+
```json
68+
{
69+
"username":"TestUser",
70+
"password":"test123"
71+
}
72+
```
73+
74+
## Posture Events
75+
### POST /api/v1/posture/events
76+
Request Body:
77+
```json
78+
{
79+
"postureState":"slouched",
80+
"confidence": "0.95",
81+
"severity": "0.5",
82+
"timestamp" : "2026-03-02T11:20:00Z"
83+
}
84+
85+
```
86+
87+
### GET /api/v1/posture/events
88+
89+
### Query Parameters:
90+
| Parameter | Type | Required | Description |
91+
|:----------|:---------|:---------|:---------------------------------|
92+
| start | ISO-8601 | Yes | The beginning of the time range. |
93+
| end | ISO-8601 | Yes | The end of the time range. |
94+
95+
96+
### Example Request:
97+
GET /api/v1/posture/events?start=2026-03-01T08:00:00&end=2026-03-01T20:00:00
98+
99+
### Example Response
100+
101+
```json
102+
[
103+
{
104+
"id": 101,
105+
"postureState": "GOOD",
106+
"confidence": 0.99,
107+
"severity": 0.1,
108+
"timestamp": "2026-03-01T08:30:00"
109+
}
110+
]
111+
```
112+
113+
## Users Management
114+
115+
### DELETE /api/v1/users/me
116+
Permanently deletes the authenticated user's profile and all associated data from the system.
117+
Authentication: Required (Bearer Token). The user identity is determined by the secure token provided in the header.
118+
119+
## Success Response
120+
| StatusCode | Description |
121+
|:-----------------|:----------------------------------------|
122+
| 204 No-content | The account was successfully deleted |
123+
| 401 Unauthorized | Invalid or missing authentication token |
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+

0 commit comments

Comments
 (0)