Skip to main content

Overview

SIGEAC is built with modern web technologies focused on performance, developer experience, and maintainability.

Core Technologies

Next.js 14

React framework with App Router

React 18

UI library with hooks and concurrent features

TypeScript 5

Type-safe JavaScript

Framework & Runtime

Next.js 14.2.14

SIGEAC uses Next.js 14 with the App Router for:
  • Server Components - Improved performance with server-side rendering
  • File-based Routing - Intuitive route structure in /app directory
  • Layouts - Shared UI across routes
  • Dynamic Routes - [company] parameter for multi-tenancy
  • Middleware - Route protection and authentication
  • API Routes - Backend-for-frontend patterns
// Example: Dynamic company route
// app/[company]/dashboard/page.tsx
export default function DashboardPage() {
  const { selectedCompany } = useCompanyStore()
  return <div>Dashboard for {selectedCompany?.name}</div>
}

React 18

Utilizing React 18 features:
  • Hooks - useState, useEffect, useContext, custom hooks
  • Suspense - Loading states and code splitting
  • Concurrent Rendering - Better performance for complex UIs
  • Client Components - Interactive components with 'use client'
See: app/[company]/dashboard/page.tsx:1

TypeScript 5

Full type safety across the application:
  • Strict Mode - Enabled for maximum type safety
  • Type Definitions - Comprehensive types in types/index.ts
  • Path Aliases - @/* for clean imports
  • IntelliSense - Better IDE support
See: types/index.ts:1

State Management

@tanstack/react-query ^5.51.9Server state management and data fetching:
import { useQuery } from "@tanstack/react-query"

export const useGetClients = (company: string | undefined) => {
  return useQuery<Client[]>({
    queryKey: ["clients", company],
    queryFn: () => fetchClients(company),
    staleTime: 1000 * 60 * 2,
    enabled: !!company,
  })
}
See: hooks/general/clientes/useGetClients.ts:12Features:
  • Automatic caching and background updates
  • Optimistic updates
  • Infinite queries and pagination
  • Request deduplication

UI & Styling

Tailwind CSS 3.4.1

Utility-first CSS framework:
<div className="flex items-center justify-between p-4 bg-background text-foreground">
  <h1 className="text-2xl font-bold">Title</h1>
  <Button className="bg-primary hover:bg-primary/90">Action</Button>
</div>
Additional Packages:
  • tailwindcss-animate - Pre-built animations
  • tailwind-merge - Merge Tailwind classes efficiently
  • class-variance-authority - Variant-based component styling

shadcn/ui Components

Built on Radix UI primitives:

@radix-ui/react-dialog

Accessible modals and dialogs

@radix-ui/react-dropdown-menu

Dropdown menus and context menus

@radix-ui/react-select

Custom select components

@radix-ui/react-toast

Toast notifications
All Radix components provide:
  • Full keyboard navigation
  • ARIA attributes
  • Focus management
  • Unstyled by default (styled with Tailwind)

Additional UI Libraries

package.json
{
  "dependencies": {
    "framer-motion": "^11.3.19",      // Animations
    "lucide-react": "^0.408.0",       // Icons
    "react-icons": "^5.5.0",          // Additional icons
    "sonner": "^1.5.0",               // Toast notifications
    "next-themes": "^0.3.0"           // Dark mode support
  }
}

Data Visualization

recharts ^2.15.1Chart library built on D3:
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts'

export function FlightHoursChart({ data }) {
  return (
    <LineChart width={600} height={300} data={data}>
      <CartesianGrid strokeDasharray="3 3" />
      <XAxis dataKey="month" />
      <YAxis />
      <Tooltip />
      <Line type="monotone" dataKey="hours" stroke="#8884d8" />
    </LineChart>
  )
}
Features:
  • Line, Bar, Pie, Area charts
  • Responsive design
  • Animations
  • Tooltips and legends

Forms & Validation

React Hook Form 7.52.1

Performant form handling:
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import * as z from "zod"

const clientSchema = z.object({
  name: z.string().min(1, "Name is required"),
  email: z.string().email("Invalid email"),
  phone: z.string().optional(),
})

export function ClientForm() {
  const form = useForm<z.infer<typeof clientSchema>>({
    resolver: zodResolver(clientSchema),
  })
  
  const onSubmit = (data: z.infer<typeof clientSchema>) => {
    // Handle form submission
  }
  
  return <form onSubmit={form.handleSubmit(onSubmit)}>...</form>
}
Features:
  • Minimal re-renders
  • Easy validation integration
  • TypeScript support
  • Field arrays and dynamic forms

Zod 3.23.8

Schema validation:
import { z } from "zod"

const createClientSchema = z.object({
  name: z.string().min(1),
  email: z.string().email().optional(),
  dni: z.string().min(1),
  dni_type: z.enum(["V", "E", "J", "G"]),
  authorizing: z.enum(["PROPIETARIO", "EXPLOTADOR"]),
})

type CreateClientInput = z.infer<typeof createClientSchema>

HTTP Client

Axios 1.7.2

Configured HTTP client:
import axios from 'axios'
import Cookies from 'js-cookie'

const axiosInstance = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_BASE_URL,
  withCredentials: true,
})

// Request interceptor - Add auth token
axiosInstance.interceptors.request.use((config) => {
  const token = Cookies.get('auth_token')
  if (token) {
    config.headers.Authorization = token.startsWith('Bearer ') 
      ? token 
      : `Bearer ${token}`
  }
  return config
})

// Response interceptor - Handle 401
axiosInstance.interceptors.response.use(
  (response) => response,
  (error) => {
    if (error.response?.status === 401) {
      Cookies.remove('auth_token')
      window.location.href = '/login?session=expired'
    }
    return Promise.reject(error)
  }
)
See: lib/axios.ts:1

Date & Time

date-fns

date-fns ^3.6.0Modern date utility library:
import { format, addDays, subDays } from 'date-fns'
import { es } from 'date-fns/locale'

const formatted = format(new Date(), 'PPP', { locale: es })

moment

moment ^2.30.1Legacy date handling (being phased out):
import moment from 'moment'

const date = moment().format('YYYY-MM-DD')

Authentication & Security

jose ^5.6.3JWT handling:
import { SignJWT, jwtVerify } from 'jose'

const secret = new TextEncoder().encode(process.env.JWT_SECRET)
const token = await new SignJWT({ userId })
  .setProtectedHeader({ alg: 'HS256' })
  .setExpirationTime('24h')
  .sign(secret)

Real-time Communication

Laravel Echo & Pusher

{
  "laravel-echo": "^1.16.1",
  "pusher-js": "^8.4.0-rc2"
}
WebSocket integration for real-time features:
import Echo from 'laravel-echo'
import Pusher from 'pusher-js'

const echo = new Echo({
  broadcaster: 'pusher',
  key: process.env.NEXT_PUBLIC_PUSHER_KEY,
  cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
  forceTLS: true,
})

echo.channel('notifications')
  .listen('NotificationSent', (data) => {
    toast.info(data.message)
  })

PDF Generation

@react-pdf/renderer ^4.1.5React components to PDF:
import { Document, Page, Text, View, PDFViewer } from '@react-pdf/renderer'

const InvoicePDF = ({ data }) => (
  <Document>
    <Page size="A4">
      <View>
        <Text>Invoice #{data.number}</Text>
        <Text>Total: ${data.total}</Text>
      </View>
    </Page>
  </Document>
)

Additional Libraries

  • qrcode.react ^4.2.0 - QR code generation
  • react-confetti ^6.4.0 - Confetti animations
  • input-otp ^1.4.2 - OTP input component
  • cmdk ^1.0.0 - Command palette
  • vaul ^0.9.1 - Drawer component
  • query-string ^9.1.1 - URL query string parsing
  • react-currency-input-field ^3.8.0 - Currency input
  • react-day-picker ^8.10.1 - Date picker
  • sharp ^0.33.5 - High-performance image processing
  • next-images ^1.8.5 - Image imports

Development Tools

devDependencies
{
  "@types/node": "^20",
  "@types/react": "^18",
  "@types/react-dom": "^18",
  "eslint": "^8",
  "eslint-config-next": "14.2.5",
  "prettier": "^3.5.3",
  "postcss": "^8",
  "tailwindcss": "^3.4.1",
  "typescript": "^5"
}

Version Matrix

TechnologyVersionPurpose
Next.js14.2.14Framework
React18UI Library
TypeScript5Type Safety
Tailwind CSS3.4.1Styling
React Query5.51.9Data Fetching
Zustand4.5.4State Management
Axios1.7.2HTTP Client
React Hook Form7.52.1Forms
Zod3.23.8Validation

Next Steps

State Management

Learn how to manage state in SIGEAC

Data Fetching

Understand data fetching patterns

Build docs developers (and LLMs) love