refactor: organize frontend by feature
Some checks failed
Backend CI/CD / build_and_deploy (push) Has been cancelled
Frontend CI/CD / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 01:05:50 -04:00
parent b6eb692c27
commit 121757546a
60 changed files with 107 additions and 183 deletions

View File

@@ -55,11 +55,10 @@ frontend/src/
├─ pages/
├─ plugins/
├─ router/
─ stores/
└─ views/
─ stores/
```
The generated scaffold expects `app/`, `features/`, `pages/`, `router/`, `stores/`, and `api/`. Socialize currently has substantial existing code under `views/`, `stores/`, and `plugins/`. New isolated feature work should prefer `features/<feature>/`; existing screens should be migrated only by explicit task.
Feature-owned frontend code lives under `frontend/src/features/<feature>/`. Feature folders may contain route views, stores, composables, constants, utilities, and local components. Cross-cutting shell code remains in `layouts/`, shared UI remains in `components/`, global plugins remain in `plugins/`, and app-wide stores may remain in `stores/`.
## API Contract

View File

@@ -15,8 +15,8 @@
- Use the shared Axios API client in `frontend/src/plugins/api.js` for current JavaScript flows.
- Preserve auth refresh behavior in `authStore` and the API plugin.
- Route-level authenticated app screens live under `/app/*`.
- New isolated feature slices should prefer `frontend/src/features/<feature>/`.
- Do not move existing views/stores into feature folders unless a task owns that migration.
- Feature-owned views, stores, composables, constants, utilities, and local components belong under `frontend/src/features/<feature>/`.
- Keep only cross-cutting app shell, plugins, shared components, and app-wide stores outside feature folders.
## Docs

View File

@@ -30,7 +30,7 @@ backend/tests/Socialize.Tests
## Frontend
The frontend remains the existing Vue 3 app. The scaffold directories `frontend/src/api`, `frontend/src/features`, `frontend/src/pages`, `frontend/src/layouts`, and `frontend/src/app` are available for incremental migration.
The frontend remains the existing Vue 3 app. Feature-owned route views and stores live under `frontend/src/features/<feature>`, while shared app shell code stays under `frontend/src/layouts`, `frontend/src/components`, `frontend/src/plugins`, and `frontend/src/router`.
## API Contract

View File

@@ -14,8 +14,7 @@ You are implementing a frontend task in this repository.
## Instructions
- Implement only the requested frontend task.
- Existing route-level app screens live under `frontend/src/views/app`.
- New isolated feature slices should prefer `frontend/src/features/<feature>`.
- Feature-owned route views, stores, composables, constants, utilities, and local components belong under `frontend/src/features/<feature>`.
- Use `frontend/src/config.js` for runtime configuration.
- Preserve token refresh behavior in `authStore` and `frontend/src/plugins/api.js`.
- Use generated API types from `frontend/src/api/schema.d.ts` when the endpoint has been generated.

View File

@@ -24,7 +24,7 @@ Implement:
- Do not refactor unrelated code.
- Follow existing backend/frontend structure.
- Backend code currently belongs under `backend/src/Socialize.Api/Modules/<Feature>`.
- New isolated frontend feature code should prefer `frontend/src/features/<feature>`.
- Frontend feature-owned code belongs under `frontend/src/features/<feature>`.
- If backend contracts change, update OpenAPI using `./scripts/update-openapi.sh`.
- Do not manually duplicate generated API types when generated types exist.