A comprehensive digital platform for identifying, understanding, and managing agricultural pests and weeds.
Built for agronomists, staff, and administrators with role-based access control and a growing guide library.
Share Project Repository
Tech Stack:
Important
This project is a modern full-stack biosecurity information system built with Next.js 16, React 19, Better Auth, Drizzle ORM, and Neon PostgreSQL. It provides role-based dashboards for administrators, staff, and agronomists to manage and browse pest and weed identification guides with detailed scientific data, images, and control methods.
Table of Contents
|
The Biosecurity Guide is a comprehensive digital platform designed to support agricultural professionals in identifying, understanding, and managing pests and weeds. The system provides a centralized guide library with detailed information on pest and weed characteristics, biology, impacts, and control methods — all backed by visual references. The platform supports three distinct user roles — Administrator, Staff, and Agronomist — each with tailored dashboards and capabilities, ensuring the right level of access for every user. Agricultural biosecurity is critical for protecting crops, ecosystems, and food supply chains. Agronomists and field workers need quick, reliable access to pest and weed identification data to make timely decisions. This platform consolidates that information into a searchable, managed, and role-protected system — replacing scattered documents and outdated references with a modern, responsive web application.
|
Note
- Node.js >= 18.0 required
- Neon PostgreSQL account required for database
- Better Auth secret required for authentication
Detailed guides on agricultural pests including common and scientific names, key characteristics, biology, impacts, and control methods — all with visual image references to aid field identification.
Key capabilities:
- Comprehensive pest profiles with scientific data
- Multiple image support per guide entry
- Structured control method recommendations
- Impact assessment information
Comprehensive weed identification and control guides to protect agricultural productivity and biodiversity. Each entry includes lifecycle data, distinguishing characteristics, and recommended management strategies.
Three distinct user roles with tailored dashboards and permissions:
| Role | Capabilities |
|---|---|
| Administrator | Full platform access — manage guides, staff, agronomists, and all system settings |
| Staff | Create, edit, and delete guides; view agronomist profiles; manage own profile |
| Agronomist | Browse and search the guide library; manage own profile |
Browse and search through the guide library with powerful filtering capabilities:
- Field-specific filtering (common name, scientific name, characteristics, biology, impacts, control)
- Case-insensitive search matching
- Pagination for large datasets
- Filter by type (pest or weed)
- Secure authentication with server-side sessions (Better Auth)
- Image carousel for visual guide references
- Responsive design for desktop and mobile use
- Light/dark theme support
- Profile management for all user roles
- Form validation with Zod schemas
- Modern UI with shadcn/ui components
Frontend:
- Framework: Next.js 16 with App Router
- Language: TypeScript for type safety
- Styling: Tailwind CSS 4 + tw-animate-css
- UI Components: shadcn/ui (Base UI React)
- Icons: Lucide React
- Themes: next-themes for light/dark mode
- Notifications: Sonner toast system
Backend:
- Runtime: Next.js API Routes (Node.js)
- Authentication: Better Auth with email/password and server-side sessions
- Database ORM: Drizzle ORM with type-safe queries
- Validation: Zod schema validation
Database:
- Provider: Neon serverless PostgreSQL
- Migrations: Drizzle Kit
- Schema: Custom tables for users, guides, images, profiles with role-based enums
Important
Ensure you have the following installed:
1. Clone Repository
git clone https://github.com/ChanMeng666/biosecurity.git
cd biosecurity2. Install Dependencies
npm install3. Configure Environment Variables
# Copy environment template
cp .env.example .env.local
# Edit environment variables
nano .env.localCreate .env.local with the following variables:
# Neon Database (get from neonctl connection-string)
DATABASE_URL=postgresql://user:[email protected]/neondb?sslmode=require
# Better Auth (generate a random 32+ character secret)
BETTER_AUTH_SECRET=your-random-secret-here
BETTER_AUTH_URL=http://localhost:3000
# App URL
NEXT_PUBLIC_APP_URL=http://localhost:3000Quick Reference:
| Variable | Required | Purpose |
|---|---|---|
DATABASE_URL |
Yes | Neon PostgreSQL connection string |
BETTER_AUTH_SECRET |
Yes | Auth encryption key (32+ chars) |
BETTER_AUTH_URL |
Yes | Auth base URL |
NEXT_PUBLIC_APP_URL |
Yes | Public-facing app URL |
Tip
Use openssl rand -base64 32 to generate a secure random secret for BETTER_AUTH_SECRET.
4. Run Database Migrations
# Generate migration files from schema
npm run db:generate
# Push schema to database
npm run db:pushTip
Use npm run db:studio to open the Drizzle Studio GUI for browsing your database.
5. Start Development Server
npm run devOpen http://localhost:3000 to view the application.
Available Scripts:
npm run dev # Start dev server with hot reload
npm run build # Production build
npm run start # Start production server
npm run lint # Run ESLint
npm run db:generate # Generate Drizzle migration files
npm run db:push # Push schema changes to database
npm run db:migrate # Run pending migrations
npm run db:studio # Open Drizzle Studio database GUIsrc/
├── app/ # Next.js App Router
│ ├── (auth)/ # Authentication routes
│ │ ├── login/ # Login page
│ │ └── register/ # Registration pages
│ │ ├── admin/ # Admin registration
│ │ ├── agronomist/ # Agronomist registration
│ │ └── staff/ # Staff registration
│ ├── (dashboard)/ # Protected dashboard routes
│ │ ├── admin/ # Admin dashboard
│ │ │ ├── manage-guides/ # Guide CRUD management
│ │ │ ├── manage-agronomists/ # Agronomist management
│ │ │ └── manage-staff/ # Staff management
│ │ ├── agronomist/ # Agronomist dashboard
│ │ │ └── guides/ # Guide browsing
│ │ └── staff/ # Staff dashboard
│ │ ├── manage-guides/ # Guide CRUD management
│ │ └── view-agronomists/ # View agronomist profiles
│ ├── api/ # API routes
│ │ ├── auth/[...all]/ # Better Auth handler
│ │ ├── guides/ # Guide CRUD endpoints
│ │ ├── agronomists/ # Agronomist endpoints
│ │ ├── staff/ # Staff endpoints
│ │ └── profile/ # Profile endpoints
│ └── sources/ # Sources & credits page
├── components/
│ ├── ui/ # shadcn/ui base components
│ ├── guides/ # Guide-specific components
│ ├── layout/ # Navbar, dashboard shell
│ ├── shared/ # Confirm dialog, data table
│ └── users/ # Profile editor
└── lib/
├── auth/ # Better Auth config & helpers
├── db/ # Drizzle ORM, schema, migrations
└── validators/ # Zod validation schemas
Contributions are welcome! Here's how you can help:
- 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
Guidelines:
- Follow TypeScript best practices
- Use the existing code style and ESLint configuration
- Test your changes locally before submitting
- Write clear commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
Chan Meng
A comprehensive biosecurity guide for agricultural pest and weed management