You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/README.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Backend API
2
2
3
-
A minimal Node.js backend for BroCode Spot backed by a persistent SQLite database.
3
+
A minimal Node.js backend for BroCode Spot backed by a persistent JSON file database.
4
4
5
5
## Start
6
6
@@ -14,8 +14,8 @@ Server starts at `http://localhost:4000` by default.
14
14
15
15
### Issue #26: Move from in-memory store to persistent DB
16
16
17
-
- Uses `node:sqlite` with a local database file at `backend/data/brocode.sqlite`.
18
-
- You can override the location with `BROCODE_DB_PATH=/custom/path.sqlite npm run backend`.
17
+
- Uses a local JSON database file at `backend/data/brocode.json`.
18
+
- You can override the location with `BROCODE_DB_PATH=/custom/path.json npm run backend`.
19
19
- On first start, seed data is inserted for users, spots, catalog items, and a sample order.
20
20
- New orders are validated against DB data (known `spotId`, `userId`, `productId`) and item pricing is always derived from catalog prices in the database.
21
21
@@ -24,6 +24,16 @@ Server starts at `http://localhost:4000` by default.
24
24
- Passwords are stored as salted `scrypt` hashes (not plaintext).
25
25
- Legacy plaintext user passwords are auto-migrated to hashed values on successful login.
26
26
27
+
### Issue #29: Protect login endpoint from brute-force attempts
28
+
29
+
- Login is now rate-limited per `IP + username` key.
30
+
- Defaults: 5 failed attempts within 15 minutes triggers a 15 minute temporary block (`429`).
31
+
- Configure via env vars:
32
+
-`LOGIN_RATE_LIMIT_MAX_ATTEMPTS`
33
+
-`LOGIN_RATE_LIMIT_WINDOW_MS`
34
+
-`LOGIN_RATE_LIMIT_BLOCK_MS`
35
+
36
+
27
37
## Available endpoints
28
38
29
39
-`GET /api/health`
@@ -34,6 +44,7 @@ Server starts at `http://localhost:4000` by default.
34
44
-`GET /api/orders?spotId=...&userId=...`
35
45
-`POST /api/orders`
36
46
-`GET /api/bills/:spotId`
47
+
-`DELETE /api/users/:userId` (removes the user and all related records)
0 commit comments