National Irrigation Administration Region 3 productivity tools for automating manual processes into minute-level results.
- 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
- 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)
- Clone the repository:
git clone <repository-url>
cd niatools- Install dependencies:
npm install
# or
yarn install
# or
pnpm install- Set up environment variables:
cp .env.example .env.local- Configure your
.env.localfile 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- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev- Open http://localhost:3000 in your browser.
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
- 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)
# Run unit tests
npm test
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e# Build the application
npm run build
# Start production server
npm startThis application is optimized for deployment on Vercel:
- Push your code to GitHub
- Import the project in Vercel
- Configure environment variables
- Deploy
For other platforms, ensure:
- Node.js 20.x runtime
- Environment variables are set
- Build command:
npm run build - Start command:
npm start
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run set-super-admin- Set user as super adminnpm run check-user-role- Check user role and permissions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- National Irrigation Administration Region 3
- Built with Next.js, React, and Firebase
- UI components from Radix UI and Tailwind CSS
For support, email helvetiche@example.com or open an issue in the repository.