Skip to content

helvetiche/niar3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

135 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NIA Productivity Tools

National Irrigation Administration Region 3 productivity tools for automating manual processes into minute-level results.

Next.js TypeScript License

πŸš€ Features

  • IFR Scanner: Scan IFR documents automatically and extract relevant data fields
  • LIPA Summary: Generate concise summaries from LIPA files
  • Merge Files: Merge PDF and Excel files with ordering and structure integrity
  • Accomplishment Report: Generate quincena accomplishment reports
  • Consolidate Land Profiles: Consolidate multiple land profile Excel files
  • IFR Checker: Validate consolidated files against source IFR data
  • Template Manager: Manage shared templates across all tools

πŸ“‹ Prerequisites

  • Node.js 20.x or higher
  • npm, yarn, or pnpm
  • Firebase project with Admin SDK credentials
  • Upstash Redis account (for production rate limiting)
  • Sentry account (optional, for error monitoring)

πŸ› οΈ Installation

  1. Clone the repository:
git clone <repository-url>
cd niatools
  1. Install dependencies:
npm install
# or
yarn install
# or
pnpm install
  1. Set up environment variables:
cp .env.example .env.local
  1. Configure your .env.local file with required credentials:
# Firebase Admin SDK
FIREBASE_ADMIN_PROJECT_ID=your-project-id
FIREBASE_ADMIN_CLIENT_EMAIL=your-client-email
FIREBASE_ADMIN_PRIVATE_KEY="your-private-key"

# Firebase Client SDK
NEXT_PUBLIC_FIREBASE_API_KEY=your-api-key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-auth-domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-storage-bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
NEXT_PUBLIC_FIREBASE_APP_ID=your-app-id

# Upstash Redis (optional, for production rate limiting)
UPSTASH_REDIS_REST_URL=your-redis-url
UPSTASH_REDIS_REST_TOKEN=your-redis-token

# Sentry (optional, for error monitoring)
NEXT_PUBLIC_SENTRY_DSN=your-sentry-dsn
NEXT_PUBLIC_SENTRY_ENVIRONMENT=development

# Gemini API (optional, for AI features)
GEMINI_API_KEY=your-gemini-api-key
  1. Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
  1. Open http://localhost:3000 in your browser.

πŸ—οΈ Architecture

niatools/
β”œβ”€β”€ app/                    # Next.js App Router pages and API routes
β”‚   β”œβ”€β”€ api/v1/            # Versioned API endpoints
β”‚   β”œβ”€β”€ workspace/         # Main workspace application
β”‚   └── layout.tsx         # Root layout with metadata
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ AccountManagement/ # User account management
β”‚   β”œβ”€β”€ ifr-scanner/      # IFR scanning components
β”‚   β”œβ”€β”€ merge-files/      # File merging components
β”‚   └── ui/               # Reusable UI components
β”œβ”€β”€ contexts/             # React Context providers
β”œβ”€β”€ hooks/                # Custom React hooks
β”œβ”€β”€ lib/                  # Core business logic
β”‚   β”œβ”€β”€ api/             # Client-side API functions
β”‚   β”œβ”€β”€ auth/            # Authentication utilities
β”‚   β”œβ”€β”€ firebase-admin/  # Firebase Admin SDK wrappers
β”‚   β”œβ”€β”€ monitoring/      # Logging and monitoring
β”‚   β”œβ”€β”€ rate-limit/      # Rate limiting logic
β”‚   └── services/        # Business services
β”œβ”€β”€ types/               # TypeScript type definitions
β”œβ”€β”€ constants/           # Application constants
└── public/              # Static assets

πŸ” Security

  • Authentication: Firebase session cookies with server-side verification
  • Authorization: Role-based access control (super-admin, admin, user)
  • Rate Limiting: Distributed rate limiting with Upstash Redis
  • Security Headers: Comprehensive CSP, HSTS, X-Frame-Options
  • Audit Trail: Complete logging of all actions to Firebase Realtime DB
  • Input Validation: Zod schemas for all inputs
  • File Security: Filename sanitization, size limits (2GB max)

πŸ§ͺ Testing

# Run unit tests
npm test

# Run tests with coverage
npm run test:coverage

# Run E2E tests
npm run test:e2e

πŸ“¦ Building for Production

# Build the application
npm run build

# Start production server
npm start

πŸš€ Deployment

This application is optimized for deployment on Vercel:

  1. Push your code to GitHub
  2. Import the project in Vercel
  3. Configure environment variables
  4. Deploy

For other platforms, ensure:

  • Node.js 20.x runtime
  • Environment variables are set
  • Build command: npm run build
  • Start command: npm start

πŸ“ Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm start - Start production server
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier
  • npm run set-super-admin - Set user as super admin
  • npm run check-user-role - Check user role and permissions

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • National Irrigation Administration Region 3
  • Built with Next.js, React, and Firebase
  • UI components from Radix UI and Tailwind CSS

πŸ“ž Support

For support, email helvetiche@example.com or open an issue in the repository.

πŸ”— Links

About

A compilation of integrated tools designed to streamline everyday workflows by automating repetitive tasks and organizing data efficiently. It minimizes manual processing, reduces human error, and accelerates output generation. Activities that once consumed hours of effort are transformed into quick, guided actions completed within minutes.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages