GROWI main application (apps/app) architecture, directory structure, and design patterns. Auto-invoked when working in apps/app.
The main GROWI application is a full-stack Next.js application with Express.js backend and MongoDB database.
For technology stack details, see the global tech-stack skill.
apps/app/src/
āāā pages/ # Next.js Pages Router (*.page.tsx)
āāā features/ # Feature modules (recommended for new code)
ā āāā {feature-name}/
ā āāā index.ts # Public exports
ā āāā interfaces/ # TypeScript types
ā āāā server/ # models/, routes/, services/
ā āāā client/ # components/, states/, hooks/
āāā server/ # Express server (legacy)
ā āāā models/ # Mongoose models
ā āāā routes/apiv3/ # RESTful API v3
ā āāā services/ # Business logic
āāā components/ # React components (legacy)
āāā states/ # Jotai atoms
āāā stores-universal/ # SWR hooks
Organize code by business feature rather than by technical layer:
ā Layer-based (old): ā
Feature-based (new):
āāā models/User.ts āāā features/user/
āāā routes/user.ts ā āāā server/models/User.ts
āāā components/UserList.tsx ā āāā server/routes/user.ts
ā āāā client/components/UserList.tsx
features/{feature-name}/interfaces/server/ (models, routes, services)client/ (components, hooks, states)index.tsserver/app.ts - Express + Next.js initializationpages/_app.page.tsx - Jotai + SWR providerspages/[[...path]]/index.page.tsx - Catch-all route (SSR)Routes in server/routes/apiv3/ with OpenAPI specs:
/**
* @openapi
* /api/v3/pages/{id}:
* get:
* summary: Get page by ID
*/
router.get('/pages/:id', async (req, res) => {
const page = await PageService.findById(req.params.id);
res.json(page);
});
states/stores-universal/For detailed patterns, see app-specific-patterns skill.
features/features/Legacy directories (components/, server/models/, client/) should be gradually migrated to features/:
features/features/features/{feature-name}/ structure