Organic Farm is a comprehensive, full-stack e-commerce platform designed to connect organic farmers directly with consumers. It provides a marketplace for selling produce and renting equipment, empowering farmers and promoting organic agriculture. The platform includes a seller dashboard, a user-friendly product discovery experience, a shopping cart, and an AI-powered assistant for agricultural queries.
- Marketplace: Browse, filter, and purchase a wide range of organic products and machinery.
- Seller Dashboard: A dedicated dashboard for sellers to manage products, view business metrics, and track transactions.
- Product Management: Full CRUD (Create, Read, Update, Delete) functionality for product listings.
- User Authentication: Secure user registration and login with email/password and Google OAuth.
- Shopping Cart: A persistent shopping cart for buyers to add, update, and remove items.
- AI Assistant: An intelligent chat interface powered by Google Gemini to answer farming and agricultural questions.
- Multi-Step Onboarding: A guided onboarding process for new users to set up their buyer, seller, or supplier profiles.
- Modern Tech Stack: Built with Next.js, React, Tailwind CSS, and Shadcn UI for a responsive and performant user experience.
- Type-Safe Backend: Features a robust backend with Hono for API routes and Drizzle ORM for type-safe database interactions with PostgreSQL.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- Node.js (v20 or later)
- bun (or your preferred package manager)
- PostgreSQL database instance
git clone https://github.com/homocodian/organic-farm.git
cd organic-farmbun installCreate a .env.local file in the root of the project and add the following environment variables.
# Get this from your PostgreSQL provider (e.g., Supabase, Neon or local instance)
DIRECT_DATABASE_URL="postgresql://..."
DATABASE_URL="postgresql://..."
# Get these from the Google Cloud Console for OAuth
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"Run the following command to push the database schema to your PostgreSQL instance.
bunx drizzle-kit pushYou can now start the development server.
bun run devOpen http://localhost:3000 with your browser to see the result.
- Framework: Next.js (React)
- Styling: Tailwind CSS & Shadcn UI
- Backend API: Hono
- Database ORM: Drizzle ORM
- Database: PostgreSQL
- Authentication: Better Auth
- AI: Vercel AI SDK with Google Gemini
- State Management: Zustand
- Form Handling: TanStack Form
The repository is organized to separate concerns, making it easier to navigate and maintain.
└── src/
├── app/ # Next.js App Router: pages, layouts, and API routes
├── components/ # Reusable UI components (Shadcn, custom)
├── constants/ # Global constants (links, theme)
├── lib/ # Helper functions, utilities, and client-side logic
└── server/ # Server-side logic
├── db/ # Drizzle ORM schema, migrations, and database instance
├── functions/ # Server Actions and backend functions
└── route/ # Hono API route handlers