Plant watering tracker with Phoenix API backend and React Native/Expo frontend.
Backend (Phoenix):
mix setup # Install deps, create DB, run migrations
mix phx.server # Start at http://localhost:4000Frontend (Expo):
cd assets
npm install
npm run web # Start at http://localhost:8081docker compose up -d┌─────────────────────────────────────────────────────┐
│ Phoenix Server │
│ (port 4001 prod) │
├─────────────────────┬───────────────────────────────┤
│ /api/* │ /* │
│ REST API │ Expo Web Build │
│ (JSON) │ (priv/static/) │
└─────────────────────┴───────────────────────────────┘
│
▼
┌─────────────────────┐
│ PostgreSQL │
│ (Docker) │
└─────────────────────┘
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/plants |
List all plants |
| POST | /api/plants |
Create plant |
| GET | /api/plants/:id |
Get plant |
| PUT | /api/plants/:id |
Update plant |
| DELETE | /api/plants/:id |
Delete plant |
| POST | /api/plants/:id/water |
Mark as watered |
quench/
├── mix.exs # Phoenix project
├── lib/
│ ├── quench/ # Business logic
│ │ ├── plants.ex # Plants context
│ │ └── plants/
│ │ └── plant.ex # Plant schema (UXID)
│ └── quench_web/ # Web layer
│ ├── router.ex
│ └── controllers/
├── priv/
│ └── static/ # Expo web build
├── assets/ # React Native/Expo
│ ├── App.tsx
│ ├── package.json
│ └── src/
│ ├── components/
│ ├── hooks/
│ ├── services/
│ │ └── api.ts # API client
│ └── screens/
├── Dockerfile
└── docker-compose.yml
# Phoenix
mix test # Run tests
mix test path/to/test.exs # Single test file
mix precommit # Format, lint, test
mix ecto.gen.migration name # New migration
mix phx.gen.secret # Generate secret key
# Expo (from assets/)
npm run ios # iOS simulator
npm run android # Android emulator
npm run web # Web browser
# Deployment
mix deploy # Auto-deploy if new commits
mix deploy --force # Force deploySECRET_KEY_BASE=<mix phx.gen.secret>
DATABASE_URL=ecto://user:pass@host/quench_prod
PHX_HOST=your-domain.com
PORT=4001All schemas use prefixed UUIDs via UXID:
use Quench.Schema, prefix: "plant"
# Generates IDs like: plant_01KE5VX9BZF4N9V6ED-
Add services to NixOS config:
quench.nix- Docker Compose servicequench-deploy.nix- Auto-deploy timerquench-backup.nix- Database backup timer
-
Create env file:
sudo mkdir -p /etc/quench sudo nano /etc/quench/env
-
Rebuild and start:
sudo nixos-rebuild switch --flake .#symphony sudo systemctl start quench
Private