PEMD360 is a web application for building diagnostics and waste management (PEMD - Plan d'Évacuation des Matériaux et Déchets). The application uses Matterport 3D scans to create interactive tags for tracking various building materials, hazards (asbestos, lead, termites, structural issues), and waste management plans.
# Install project dependencies:
npm install
# Login with Doppler to get the environment variables
doppler login
# Select project and config
doppler setup# Generate migration
npm run drizzle-kit generate
# Apply migration
npm run drizzle-kit migrate- Tags are stored with
anchorPositionandstemVectorfor 3D positioning - Images can be captured directly from the Matterport viewer
- The SDK is loaded via CDN (see package.json trusted dependencies)
- SvelteKit Docs
- Drizzle ORM Docs
- Better Auth Docs
- Matterport SDK Docs
- Cloudflare D1 Docs
- Tailwind CSS v4 Docs
- DaisyUI Docs
- Define schema in
src/lib/server/db/schema.ts - Add relations if needed
- Run
npx drizzle-kit generateto create migration - Run
npx drizzle-kit migrateto apply
- Add under
src/routes/(app)/app/ - Use
+layout.server.tsfor authentication checks - Access user via
locals.user
- Reference existing tag tables (tags_amiante, tags_plomb, etc.)
- Store anchorPosition and stemVector from Matterport SDK
- Image can be base64 data URL or R2 URL
- Link to projet via
sidId(projet.id)
- Use
src/lib/server/excel.tsfor Excel generation with ExcelJS - Use
pdf-libfor PDF manipulation - Export endpoints are in
src/routes/(app)/app/admin/*/export/+server.t
- Verify
MATTERPORT_SDK_KEYis set - Check browser console for SDK errors
- Ensure model ID is valid
- Verify
BETTER_AUTH_SECRETis set - Clear cookies and sessions if having issues
Run npm run check and fix issues before committing
Also run npm run format