diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 0000000..43a288b --- /dev/null +++ b/SETUP.md @@ -0,0 +1,203 @@ +# Pantry - Setup Guide + +## ✅ Current Status + +### Infrastructure (Complete) + +- **Supabase Dev Instance**: Running on Coolify + - URL: `https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de` + - Status: ✅ Healthy + - Services: PostgreSQL, Auth (GoTrue), Realtime, Storage, PostgREST + +### Environment Configuration (Complete) + +- `.env.example` - Template for all environments +- `.env.development` - Dev credentials (Coolify Supabase) +- `.gitignore` - Protects secrets + +--- + +## 🚀 Quick Start (Development) + +### Prerequisites + +- **Bun** 1.0+ (or Node.js 20+) +- **Git** access to repository +- **Access to Coolify** Supabase instance (credentials in `.env.development`) + +### Setup Steps + +1. **Clone Repository** + ```bash + git clone https://gitea.jeanlucmakiola.de/pantry-app/pantry.git + cd pantry + ``` + +2. **Copy Development Environment** + ```bash + cp .env.development .env + ``` + +3. **Install Dependencies** (once `app/` exists) + ```bash + cd app + bun install + ``` + +4. **Apply Database Migrations** (once created) + ```bash + cd supabase + # TBD: Migration command + ``` + +5. **Start Development Server** + ```bash + cd app + bun run dev + ``` + +6. **Access App** + - App: `http://localhost:3000` + - Supabase API: `https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de` + +--- + +## 🗄️ Supabase Instance Details + +### Endpoints + +| Service | URL | +|---------|-----| +| API (PostgREST) | `https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de/rest/v1/` | +| Auth | `https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de/auth/v1/` | +| Realtime | `wss://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de/realtime/v1/` | +| Storage | `https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de/storage/v1/` | + +### Credentials + +**Public (safe to use in frontend):** +- Anon Key: In `.env.development` + +**Secret (server-side only):** +- Service Role Key: In `.env.development` +- JWT Secret: In `.env.development` +- Postgres Password: In `.env.development` + +### Dashboard Access + +If Supabase Studio is exposed on Coolify: +- URL: Check Coolify service configuration +- Username: From `SERVICE_USER_ADMIN` in Coolify +- Password: From `SERVICE_PASSWORD_ADMIN` in Coolify + +--- + +## 📋 Next Steps + +### Week 1: Foundation (In Progress) + +- [x] ~~Supabase dev environment setup~~ (Complete) +- [x] ~~Environment configuration~~ (Complete) +- [ ] Create database schema (`supabase/migrations/`) +- [ ] Scaffold Nuxt 4 app (`app/`) +- [ ] Implement email/password auth +- [ ] Deploy first version to Coolify + +### Immediate Tasks + +1. **Database Schema** (#10) + - Create migration files in `supabase/migrations/` + - Tables: `inventory_items`, `products`, `tags`, `item_tags`, `units` + - See: `docs/DATABASE.md` + +2. **Nuxt Scaffold** (#8) + - Initialize Nuxt 4 project in `app/` + - Install dependencies: `@nuxtjs/supabase`, `@nuxt/ui`, Tailwind + - Configure `nuxt.config.ts` + +3. **Auth Implementation** (#11) + - Supabase Auth integration + - Login/signup pages + - Protected routes + +--- + +## 🔧 Development Workflow + +### Making Changes + +```bash +# 1. Create feature branch +git checkout -b feature/your-feature + +# 2. Make changes +# Edit files... + +# 3. Test locally +bun run dev + +# 4. Commit and push +git add . +git commit -m "feat: Your feature description" +git push origin feature/your-feature + +# 5. Create PR on Gitea +``` + +### Database Migrations + +```bash +# Create new migration +cd supabase/migrations +touch 001_initial_schema.sql + +# Edit migration file (SQL) +# Test locally against Coolify Supabase instance + +# Apply migration (TBD - once we set up migration tooling) +``` + +--- + +## 🚨 Troubleshooting + +### Can't connect to Supabase + +**Test connection:** +```bash +curl -s "https://supabasekong-ewo8wssk4gs8cgg0c8kosk40.jeanlucmakiola.de/rest/v1/" \ + -H "apikey: " +``` + +Should return OpenAPI spec. If not: +- Check Coolify service status +- Verify URL in `.env` +- Check network/firewall + +### Environment variables not loading + +- Ensure `.env` exists in project root +- Check `.env` has no syntax errors +- Restart dev server after changes + +### Database migration issues + +- Verify `SUPABASE_SERVICE_ROLE_KEY` is set +- Check migration SQL syntax +- Review Supabase logs in Coolify + +--- + +## 📚 Documentation + +- [Project Plan](docs/PROJECT_PLAN.md) - Vision, roadmap +- [Architecture](docs/ARCHITECTURE.md) - Tech stack, design +- [Database Schema](docs/DATABASE.md) - Tables, RLS, functions +- [API Reference](docs/API.md) - Endpoints, usage +- [Development Guide](docs/DEVELOPMENT.md) - Conventions, workflow +- [Deployment](docs/DEPLOYMENT.md) - Docker, Coolify + +--- + +**Last Updated:** 2026-02-08 +**Status:** Week 1 - Foundation in progress