chore(backend): finalize Express/TS foundation — security, structure,…#87
Open
Ndifreke000 wants to merge 1 commit into
Open
Conversation
… tests Closes Web3Novalabs#74 Security fixes: - jwt: add exp (24h TTL) to every token; caller-supplied exp wins for tests - jwt: replace string equality with crypto.timingSafeEqual for sig verification - index: enforce 50kb JSON body limit - index: throw at startup if CORS_ORIGIN is unset in production Code quality: - Extract isValidStellarAddress to src/utils/stellar.ts - Extract validateMembers (with positive/finite pct guard) to src/utils/validateMembers.ts - Extract serializeGroup to src/utils/serializeGroup.ts - Move GroupMember/Group/GroupsService interfaces to src/types/index.ts - Remove dead requireAuth re-guards from every route handler - Fix PUT /:id optional chaining on post-guard non-null value - Replace parseInt with Number() + floor; default negative/NaN params Scaffold: - Add src/db/, src/errors/, src/types/ with .gitkeep Tests (40 pass, 0 fail): - New: src/__tests__/app.test.ts — health, headers, CORS block, GET / - New: expired token 401 test - New: negative member percentage 400 test - New: NaN and negative pagination param edge cases - New: InMemoryGroupsService unit tests (create, getById, list, update, clear) Config: - tsconfig: module+moduleResolution aligned to Node16 - package.json: test script uses find instead of fragile shell globs - .env.example: add CORS_ORIGIN, DATABASE_URL, JWT_SECRET, HORIZON_URL, STELLAR_NETWORK - README: document folder structure, /health response shape, security notes
martinvibes
requested changes
Jun 17, 2026
martinvibes
left a comment
There was a problem hiding this comment.
Please delete this package-lock.json file not needed in this implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… tests
Closes #74
Security fixes:
Code quality:
Scaffold:
Tests (40 pass, 0 fail):
Config: