Companion planting recommendations for your garden beds.
Tell power2plant your growing zone and which plants you want to grow — it assigns them to beds to maximize companion planting benefits and flags incompatible pairs.
Anonymous: works immediately, state saved in localStorage.
Signed in: zone and bed config synced to your account across devices.
- Hardiness zone detection via geolocation or map picker (Open-Meteo)
- Plant search across 66,000+ crops (Trefle, USDA, OpenFarm, PFAF, PlantBuddies)
- Companion planting relationship database (343+ relationships with confidence scores)
- Greedy affinity bed assignment algorithm
- Email/password auth via better-auth
- Offline-first: localStorage fallback when not signed in
- Next.js 15 (App Router)
- Prisma 6 + PostgreSQL 16
- better-auth
- shadcn/ui (Tailwind v4, base-nova)
- Leaflet / react-leaflet
- Vitest 3
- Docker (with Compose v2)
The host doesn't need Node, pnpm, or psql — everything lives in the dev container.
# Clone
git clone https://github.com/your-org/power2plant.git
cd power2plant
# Configure environment
cp .env.example .env
# Edit .env — set BETTER_AUTH_SECRET (dev defaults handle the rest)
# Start the stack (Postgres + app with hot reload)
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -dThe dev compose command runs prisma generate, prisma migrate deploy, and next dev on startup. Open http://localhost:3000.
For any project commands (tests, Prisma, db dump/restore, etc.) open a shell inside the dev container and run them there:
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec app sh
# from inside the container:
pnpm test:run # run tests
pnpm db:migrate # create a new migration (dev workflow)
pnpm db:restore # load the committed seed.sql
pnpm db:import # import fresh plant data (needs TREFLE_TOKEN)
pnpm db:dump # snapshot the DB to db/seed.sql
pnpm db:studio # Prisma Studio at http://localhost:5555| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
BETTER_AUTH_SECRET |
Yes (prod) | Secret for session signing (≥32 chars) |
BETTER_AUTH_URL |
Yes (prod) | Public URL of the app (e.g. https://example.com) |
NEXT_PUBLIC_APP_URL |
Yes (prod) | Same as BETTER_AUTH_URL, exposed to client |
TREFLE_TOKEN |
For import | API token for Trefle plant database |
In development, BETTER_AUTH_SECRET and BETTER_AUTH_URL fall back to safe defaults if unset.
Run all of these from a shell inside the dev container (docker compose -f docker-compose.yml -f docker-compose.dev.yml exec app sh):
| Command | Description |
|---|---|
pnpm dev |
Start dev server (already running via compose) |
pnpm build |
Production build |
pnpm test:run |
Run test suite (65 tests) |
pnpm db:migrate |
Create / apply Prisma migrations |
pnpm db:import |
Import plant data from all sources |
pnpm db:import <source> |
Import from a specific source (trefle, usda, openfarm, plantbuddies, pfaf) |
pnpm db:restore |
Restore pre-seeded plant database |
pnpm db:dump |
Dump current database to file |
pnpm db:studio |
Open Prisma Studio |
Plant data is seeded from multiple open sources:
| Source | Data | License |
|---|---|---|
| Trefle | Taxonomy, plant info | API (token required) |
| USDA PLANTS | Taxonomy supplement | Public domain |
| OpenFarm | Companion relationships | CC BY 4.0 |
| PFAF | Companion + growing data | CC BY-NC-SA 4.0 |
| PlantBuddies | 1,717 relationships | License TBD — contact Serlo |
Note: PlantBuddies data is used as non-commercial fair use pending license clarification with Serlo. Do not use in a commercial deployment until resolved.
Development is covered in Getting Started — edit files in src/ and Next.js hot reloads automatically.
export BETTER_AUTH_SECRET="your-secret-here"
export BETTER_AUTH_URL="https://your-domain.com"
export NEXT_PUBLIC_APP_URL="https://your-domain.com"
docker compose up --buildMigrations run automatically on container start.
A staging environment can run on the same machine as production, isolated in separate containers. It deploys automatically on every push to a release/* branch via a GitHub webhook.
Set APP_PORT=3001 and DB_PORT=5433 in the staging .env to avoid port collisions with prod. Control the initial dataset with STAGING_DATA_SOURCE=prod (non-user prod data) or STAGING_DATA_SOURCE=seed (committed db/seed.sql).
See docs/server-setup.md for the full setup walkthrough.
See CONTRIBUTING.md.