mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-17 21:14:08 +01:00
Documetation setup, rewrite dockerfile and compose, manifest and add healthcheck |
||
|---|---|---|
| backend | ||
| frontend | ||
| k8s | ||
| .gitattributes | ||
| .gitignore | ||
| docker-compose.yml | ||
| README.md | ||
| SETUP.md | ||
ForFarm
A farming software designed to empower farmers and agribusinesses by AI, weather data, and analytics. ForFarm helps users make data-driven decisions, and optimize resource management through a tools.
Features
- Farm & Crop Management: Define farms, map croplands (points, polygons), track crop lifecycles, status, and growth stages.
- Inventory Tracking: Manage farm resources like seeds, fertilizers, equipment, etc.
- Data Analytics: Visualize farm and crop performance metrics. (Integration with weather, soil data planned).
- Knowledge Hub: Access articles and guides on farming best practices.
- AI Chatbot: Get contextual assistance based on your farm/crop data or ask general farming questions.
- Weather Integration: (Implemented via Worker) Fetches current weather data for farms.
- User Authentication: Secure login/registration using email/password and Google OAuth.
- Marketplace Insights: (Mock Data) Provides simulated market price trends and analysis.
Project Structure
The project is organized into two main components:
├── backend/ # Go backend application (API, business logic, data access)
│ ├── cmd/ # Main entry points (API server, CLI commands)
│ ├── internal/ # Private application code
│ │ ├── api/ # API handlers and routing (Huma framework)
│ │ ├── cache/ # Caching interface and implementations
│ │ ├── config/ # Configuration loading (Viper)
│ │ ├── domain/ # Core business entities and repository interfaces
│ │ ├── event/ # Event bus and projection logic
│ │ ├── middlewares/ # HTTP middlewares (Auth, Rate Limiting)
│ │ ├── repository/ # Data access layer implementations (Postgres)
│ │ ├── services/ # Business logic services (Chat, Weather, Analytics)
│ │ └── workers/ # Background worker processes (Weather Updater)
│ ├── migrations/ # Database schema migrations (Goose)
│ ├── scripts/ # Utility scripts (Seeding)
│ ├── .air.toml # Live reload config for backend dev
│ ├── go.mod # Go module dependencies
│ └── go.dockerfile # Dockerfile for backend
├── frontend/ # Next.js frontend application (UI)
│ ├── app/ # Next.js App Router structure (pages, layouts)
│ ├── api/ # Frontend API client functions for backend interaction
│ ├── components/ # Reusable UI components (shadcn/ui)
│ ├── context/ # React context providers (Session)
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions, providers
│ ├── schemas/ # Zod validation schemas for forms
│ ├── types.ts # TypeScript type definitions
│ ├── next.config.ts # Next.js configuration
│ └── next.dockerfile # Dockerfile for frontend
├── docker-compose.yml # Docker Compose configuration for services
├── .env.example # Example environment variables file
├── README.md # This file
└── SETUP.md # Detailed development setup guide
- Backend: Built with Go, using Chi for routing, Huma for API definition, pgx for PostgreSQL interaction, and Cobra for CLI commands. It handles business logic, data persistence, and external service integrations.
- Frontend: Built with Next.js (App Router) and TypeScript, using Tailwind CSS and shadcn/ui for styling and components. It provides the user interface and interacts with the backend API.
Installation & Setup
For detailed setup instructions, please refer to the SETUP.md guide.
The basic steps are:
- Prerequisites: Ensure Docker, Docker Compose, Go, Node.js, and pnpm are installed.
- Clone: Clone this repository.
- Configure: Create a
.envfile from.env.exampleand fill in necessary secrets and keys (Database, JWT, Google OAuth, Maps API, Weather API, Gemini API). - Run: Start all services using
docker compose up --build -d. - Migrate: Run database migrations:
cd backend && make migrate && cd ... - Seed (Optional): Populate static data:
cd backend && make seed && cd ... - Access: Open http://localhost:3000 in your browser.
Usage
Once set up and running:
- Navigate to http://localhost:3000.
- Register a new account or log in.
- Explore the dashboard:
- Add and manage your farms.
- Add croplands within your farms, drawing boundaries or placing markers.
- Manage your inventory items.
- Consult the AI Chatbot for farming advice.
- Browse the Knowledge Hub articles.
- View (simulated) Marketplace data.