Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Align `src/common/` barrel exports and remove duplicate guard implementations

Open
#212 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
nodejs, typescript
Domain
backend, security

Research direction

Start with the guard registrations in src/app.module.ts around lines 306-321, then locate both copies of kyc.guard.ts and roles.decorator.ts under src/. Run the duplicate-filename scan from the issue and check the existing scripts/check-kyc-guard-coverage.js to see how coverage is measured. Done means each guard exists once, the registration order is unchanged, and npm run test:kyc-guard-scan, npx tsc --noEmit and npm test all pass. Choosing the canonical copy and reorganising src/common/ needs maintainer input first.

Written by the indexing model from the issue text.

Description

help wanted intermediate refactor

Problem

src/common/ is the largest directory in the repository at 80 TypeScript files, and it holds more than "common utilities" in the conventional sense: guards, pipes, interceptors, filters, pagination, caching, database helpers, and middleware all live here. There are 12 index.ts barrel files scattered across src/ with no consistent convention, and duplicate filenames across modules include roles.decorator.ts and kyc.guard.ts (each appearing twice).

There is history here: issue #3, "Eliminate Duplicate Guard Implementations Across common/", is closed, and scripts/check-kyc-guard-coverage.js exists specifically to check KYC guard coverage (wired as npm run test:kyc-guard-scan). So the maintainers have already been fighting duplicate guards — this suggests the pattern has partially recurred.

Why it matters

Guards are security-relevant, and two copies of kyc.guard.ts or roles.decorator.ts mean the one that is actually registered is not discoverable by reading a name. src/app.module.ts:306-321 registers four global guards by class, so a maintainer has to trace each import to know which file won.

At 80 files, src/common/ is also hard to navigate, which makes it a frequent source of "where does this go?" questions — the kind of thing that generates low-quality duplicate utilities, compounding the problem.

Suggested Direction

  1. Re-run the duplicate scan and publish the current list, since issue #3 was closed some time ago:

    Get-ChildItem src -Recurse -Filter *.ts | Group-Object Name | Where-Object Count -gt 1
    

    Confirmed duplicates include rebalancing.service.ts, profiling.service.ts, profiling.controller.ts, portfolio.controller.ts, roles.decorator.ts, kyc.guard.ts, email.service.ts, audit-log.entity.ts, and portfolio.module.ts.

  2. Consolidate src/common/ by concern. A structure like src/common/{guards,pipes,filters,interceptors,middleware,pagination,cache,database,utils}/ would make the ownership obvious and prevent the sprawl. Include an index.ts per subdirectory.

  3. For each duplicate guard or decorator, pick the registered one and delete the other, or convert the second into a thin re-export so existing imports keep working. Confirm which is actually registered in app.module.ts before deleting anything.

  4. Keep test:kyc-guard-scan and extend it to cover RolesGuard the same way.

Constraints

  • Guard registration order is load-bearing. app.module.ts:306-321 registers StrategyAuthGuard → DistributedRateLimitGuard → RolesGuard → KycGuard. Preserve that order exactly; changing it changes authorisation behaviour.
  • Do not delete a duplicate that is genuinely used by a different module without checking. Use the compiler (npx tsc --noEmit) as the safety net, then delete imports it flags.
  • Barrel files can introduce circular imports; keep them flat and import from specific files where a cycle would result.

Acceptance Criteria

  • A current duplicate-filename scan is recorded in the issue, with each duplicate resolved or documented.
  • kyc.guard.ts and roles.decorator.ts each exist exactly once, and it is the registered one.
  • src/common/ is organised by concern with an index.ts per subdirectory.
  • Guard registration order in app.module.ts is unchanged.
  • npm run test:kyc-guard-scan, npx tsc --noEmit, and npm test all pass.
Dominant language
TypeScript
Stars
7
Forks
55
Avg merge
1d 17h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SourceXXL/alian_structure-api

All issues in SourceXXL/alian_structure-api

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.