README, multi-tenant SaaS architecture (database-per-tenant), automated onboarding flow (signup → 60 seconds → live site), and template extraction plan from AHCR codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
137 lines
4.8 KiB
Markdown
137 lines
4.8 KiB
Markdown
# Template Extraction Plan
|
|
|
|
## What to Pull from AHCR
|
|
|
|
The AHCR codebase (`almosthomecaninerescue.com-2026/ahcr`) is the source. We extract and genericize.
|
|
|
|
### Copy As-Is (Core Framework)
|
|
- SvelteKit config, vite config, tsconfig
|
|
- Drizzle ORM setup and schema (strip AHCR-specific data)
|
|
- Auth system (sessions, Argon2, roles)
|
|
- Rate limiting
|
|
- Audit logging
|
|
- File upload handler
|
|
- Email system (Nodemailer)
|
|
- Stripe integration
|
|
- Bot protection (tracking, robots.txt, honeypot)
|
|
|
|
### Genericize (Replace AHCR-Specific)
|
|
|
|
| AHCR-Specific | PawPrint Generic |
|
|
|---|---|
|
|
| "Almost Home Canine Rescue" | `ORG_NAME` env var |
|
|
| Sioux Falls, SD references | `ORG_LOCATION` env var |
|
|
| SD17 Petfinder org ID | `PETFINDER_ORG_ID` env var (optional) |
|
|
| Teal color scheme (#0d9488) | Configurable via setup wizard, stored in site_settings |
|
|
| AHCR logo / images | Placeholder logo, upload your own |
|
|
| 16 adoption agreement items | Configurable JSON in site_settings |
|
|
| Foster application agreements | Configurable JSON |
|
|
| info@almosthomecaninerescue.com | `SMTP_FROM` env var |
|
|
| GiveButter donation link | Generic donate page with configurable URL |
|
|
| Facebook app ID / secrets | Per-tenant config |
|
|
| Specific intake sources | Seed with common defaults, editable in admin |
|
|
| Content blocks (home, about, etc.) | Seed with placeholder content |
|
|
|
|
### Remove (AHCR Data)
|
|
- database_dump.sql
|
|
- decoded_lewodi.php (malware artifact)
|
|
- CSV import data and scripts (AHCR-specific)
|
|
- Petfinder scraper (API is dead)
|
|
- docs/csv-import-data-issues.md
|
|
- docs/deleted-junk-pets.md
|
|
- All pet data, user data, etc.
|
|
|
|
### Add (New for Template)
|
|
- Setup wizard (first-login onboarding)
|
|
- `org_config` table or expand site_settings for org-level config
|
|
- Configurable color theme (CSS custom properties)
|
|
- Configurable application form questions
|
|
- Seed script with placeholder data (example pets, example events)
|
|
- Docker Compose file
|
|
- Landing page / marketing site (separate from rescue site)
|
|
- Health check endpoint (`/api/health`)
|
|
- Tenant provisioning scripts
|
|
|
|
## File-by-File Extraction Checklist
|
|
|
|
### Config Files
|
|
- [ ] package.json — update name, description, remove AHCR references
|
|
- [ ] svelte.config.js — keep as-is
|
|
- [ ] vite.config.ts — keep as-is
|
|
- [ ] tsconfig.json — keep as-is
|
|
- [ ] drizzle.config.ts — keep as-is
|
|
- [ ] .env.example — genericize all values
|
|
- [ ] .gitignore — keep, add uploads/
|
|
|
|
### Schema
|
|
- [ ] src/lib/server/schema.ts — keep all tables, add org_config if needed
|
|
- [ ] drizzle/ migrations — regenerate clean from schema
|
|
|
|
### Auth & Roles
|
|
- [ ] src/lib/roles.ts — keep all roles
|
|
- [ ] src/lib/server/auth.ts — keep as-is
|
|
- [ ] src/lib/server/auth-utils.ts — keep as-is
|
|
- [ ] src/hooks.server.ts — keep, genericize any hardcoded strings
|
|
|
|
### Server Utilities
|
|
- [ ] src/lib/server/db.ts — keep as-is
|
|
- [ ] src/lib/server/email.ts — genericize from address, org name in templates
|
|
- [ ] src/lib/server/stripe.ts — keep as-is
|
|
- [ ] src/lib/server/upload.ts — keep as-is
|
|
- [ ] src/lib/server/audit.ts — keep as-is
|
|
- [ ] src/lib/server/track.ts — keep as-is
|
|
- [ ] src/lib/server/rate-limit.ts — keep as-is
|
|
- [ ] src/lib/server/content.ts — keep as-is
|
|
- [ ] src/lib/server/facebook.ts — keep as-is
|
|
- [ ] src/lib/server/contract.ts — genericize org name in contract template
|
|
- [ ] src/lib/server/slugify.ts — keep as-is
|
|
|
|
### Routes — Keep & Genericize
|
|
- [ ] All admin routes — keep, genericize any AHCR text
|
|
- [ ] All public routes — keep, replace hardcoded content with CMS blocks
|
|
- [ ] Foster portal — keep as-is
|
|
- [ ] API routes — keep as-is
|
|
- [ ] robots.txt — keep dynamic version
|
|
- [ ] sitemap.xml — keep, genericize
|
|
|
|
### Routes — Remove
|
|
- [ ] src/lib/server/csv-import.ts — AHCR-specific
|
|
- [ ] src/lib/server/run-import.ts — AHCR-specific
|
|
- [ ] src/routes/admin/import/ — replace with generic CSV import
|
|
|
|
### Components
|
|
- [ ] All UI components — keep as-is
|
|
- [ ] Header/Footer — genericize org name, links
|
|
- [ ] Replace any hardcoded "Almost Home" text
|
|
|
|
### Static Assets
|
|
- [ ] Remove AHCR logos and images
|
|
- [ ] Add placeholder logo
|
|
- [ ] Keep favicon structure (replace with paw icon)
|
|
|
|
### New Files to Create
|
|
- [ ] scripts/provision-tenant.sh
|
|
- [ ] scripts/deprovision-tenant.sh
|
|
- [ ] scripts/seed-tenant.js
|
|
- [ ] scripts/send-welcome.js
|
|
- [ ] scripts/migrate-all.sh
|
|
- [ ] docker-compose.yml
|
|
- [ ] Dockerfile
|
|
- [ ] Setup wizard route (/setup)
|
|
- [ ] Health check endpoint (/api/health)
|
|
- [ ] Landing/marketing page (separate or at /)
|
|
|
|
## Estimated Effort
|
|
|
|
| Task | Time |
|
|
|------|------|
|
|
| Extract and genericize core app | 4-6 hours |
|
|
| Setup wizard | 2-3 hours |
|
|
| Docker Compose | 1 hour |
|
|
| Provisioning scripts | 2-3 hours |
|
|
| Admin meta-dashboard | 4-6 hours |
|
|
| Landing page | 2-3 hours |
|
|
| Stripe billing integration | 2-3 hours |
|
|
| Testing & polish | 3-4 hours |
|
|
| **Total** | **~20-30 hours** |
|