Skip to content

refactor(api): organize code by feature - #66

Merged
rd-code-23 merged 1 commit into
mainfrom
refactor/api-feature-folders
Aug 25, 2026
Merged

rd-code-23 merged 1 commit into
mainfrom
refactor/api-feature-folders

Conversation

@rd-code-23

Copy link
Copy Markdown
Owner

Summary

Reorganizes the Express backend around product features so its high-level structure matches the frontend's feature-based organization and the architecture already documented for GoForLift.

This is a structure-only refactor. Routes, contracts, database behavior, authentication behavior, and API responses are unchanged.

What changed

  • Moved apps/api/src/auth to apps/api/src/features/auth.
  • Moved apps/api/src/exercises to apps/api/src/features/exercises.
  • Updated imports affected by the additional features directory level.
  • Updated server.ts composition-root imports to use the new feature paths.
  • Kept config, db, and test at the API source root because they support multiple features and are shared infrastructure.

Resulting structure

apps/api/src/
├── features/
│   ├── auth/
│   │   ├── csrf/
│   │   ├── google/
│   │   ├── guards/
│   │   ├── session/
│   │   └── user/
│   └── exercises/
├── config/
├── db/
├── test/
├── app.ts
├── app.test.ts
└── server.ts

Why this structure

auth and exercises represent product capabilities, so grouping them under features makes feature ownership visible at a glance and keeps related routes, services, middleware, and tests together.

config, db, and test remain outside features because they are shared infrastructure. Moving them under a specific feature would imply ownership that they do not have.

This also makes the API consistent with the existing architectural guidance in AGENTS.md and docs/architecture.md. No documentation changes were necessary because both files already prescribe this organization.

Behavioral impact

None. Git recognizes all 18 source-file changes as moves, with only relative import paths adjusted. Endpoint URLs remain:

  • /auth/*
  • /exercises
  • /health

Verification

  • Type-checking passed.
  • ESLint passed.
  • All 74 tests passed.
  • Formatting passed for all moved and modified files.

@rd-code-23
rd-code-23 merged commit 8d2c613 into main Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant