Overview
SIGEAC is organized into modules representing different business domains (Almacén, Mantenimiento, SMS, etc.). This guide shows you how to add a new module.Module Structure
Each module typically includes:Routes
Pages in
/app/[company]/module-name/Components
UI components in
/components/module-name/Hooks
Data fetching hooks in
/hooks/module-name/Actions
Mutations in
/actions/module-name/Step-by-Step Guide
Plan your module structure
Decide on:
- Module name and slug (e.g.,
recursos-humanosorrrhh) - Main features (list views, detail views, forms)
- Data models and types
- API endpoints
Create data fetching hooks
Create hooks in
/hooks/capacitacion/:hooks/capacitacion/useGetTrainings.ts
hooks/capacitacion/useGetTrainingById.ts
Create mutation actions
Create actions in
/actions/capacitacion/actions.ts:actions/capacitacion/actions.ts
Module Checklist
Use this checklist when creating a new module:Types & Interfaces
Types & Interfaces
- Add TypeScript types to
types/index.ts - Include all entity relationships
- Export all types properly
Data Layer
Data Layer
- Create hooks directory
/hooks/module-name/ - Create query hooks for fetching data
- Create mutation hooks in
/actions/module-name/ - Include proper error handling
- Set appropriate cache times
Routes & Pages
Routes & Pages
- Create route directory
/app/[company]/module-name/ - Create list page
- Create detail page with
[id]route - Create form pages (new, edit)
- Add loading.tsx files
- Add error.tsx files
Components
Components
- Create reusable form components
- Create table/list components
- Create card components
- Add proper TypeScript props
- Include loading states
Navigation
Navigation
Testing
Testing
- Test CRUD operations
- Test error handling
- Test loading states
- Test with different user roles
Module Templates
Simple CRUD Module
For basic create, read, update, delete operations:Complex Module with Sub-resources
For modules with nested resources:Best Practices
Consistent Naming
Use consistent naming across files:
useGet{Entity}for queriesuseCreate{Entity}for mutations{Entity}Formfor forms
Type Safety
Always type your components and hooks:
- Use TypeScript interfaces
- Type all props
- Type API responses
Error Handling
Handle errors gracefully:
- Show error messages to users
- Log errors for debugging
- Provide retry options
Loading States
Always show loading states:
- Use skeletons for lists
- Disable buttons during mutations
- Show progress indicators
Next Steps
Custom Hooks
Learn advanced hook patterns
API Integration
Connect to backend APIs
