mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:01:08 +02:00
Add ability to create shareable links for presentations that can be viewed without authentication. Includes backend share module with NestJS controller/service and web app routes for creating/managing share links and viewing shared decks. - Add ShareModule with public GET endpoint and authenticated CRUD - Add shareApi methods to web API client - Add /shared/[code] route for public deck viewing - Add Share button and modal to deck editor - Update CLAUDE.md with new endpoints and features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7.1 KiB
7.1 KiB
Presi Project Guide
Project Structure
apps/presi/
├── apps/
│ ├── backend/ # NestJS API server (@presi/backend)
│ ├── mobile/ # Expo/React Native mobile app (@presi/mobile)
│ ├── web/ # SvelteKit web application (@presi/web)
│ └── landing/ # Astro marketing landing page (@presi/landing) - TODO
├── packages/
│ └── shared/ # Shared types and utils (@presi/shared)
└── package.json
Commands
Root Level (from monorepo root)
pnpm presi:dev # Run all presi apps
pnpm dev:presi:mobile # Start mobile app
pnpm dev:presi:web # Start web app (port 5178)
pnpm dev:presi:backend # Start backend server
pnpm dev:presi:app # Start web + backend together
pnpm presi:db:push # Push schema to database
pnpm presi:db:studio # Open Drizzle Studio
pnpm presi:db:seed # Seed database with sample data
Mobile App (apps/presi/apps/mobile)
pnpm dev # Start Expo dev server
pnpm ios # Run on iOS simulator
pnpm android # Run on Android emulator
Web App (apps/presi/apps/web)
pnpm dev # Start dev server (port 5178)
pnpm build # Build for production
pnpm preview # Preview production build
pnpm check # Run svelte-check
Backend (apps/presi/apps/backend)
pnpm dev # Start with hot reload
pnpm build # Build for production
pnpm start:prod # Start production server
pnpm db:push # Push schema to database
pnpm db:studio # Open Drizzle Studio
pnpm db:seed # Seed database
Technology Stack
- Mobile: React Native 0.76 + Expo SDK 52, Expo Router, Zustand
- Web: SvelteKit 2.x, Svelte 5 (runes mode), Tailwind CSS
- Backend: NestJS 10, Drizzle ORM, PostgreSQL
- Types: TypeScript 5.x
Architecture
Core Features
- Create and manage presentation decks
- Add and edit slides with various content types
- Apply themes to presentations
- Share decks via share codes
- Present slides in full-screen mode
Backend API Endpoints
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/health |
GET | No | Health check |
/api/decks |
GET | Yes | Get user's decks |
/api/decks |
POST | Yes | Create new deck |
/api/decks/:id |
GET | Yes | Get deck details |
/api/decks/:id |
PUT | Yes | Update deck |
/api/decks/:id |
DELETE | Yes | Delete deck |
/api/decks/:id/slides |
GET | Yes | Get slides for deck |
/api/decks/:id/slides |
POST | Yes | Add slide to deck |
/api/slides/:id |
PUT | Yes | Update slide |
/api/slides/:id |
DELETE | Yes | Delete slide |
/api/slides/reorder |
PUT | Yes | Reorder slides |
/api/share/:code |
GET | No | Get shared deck (public) |
/api/share/deck/:id |
POST | Yes | Create share link |
/api/share/deck/:id/links |
GET | Yes | Get share links for deck |
/api/share/:shareId |
DELETE | Yes | Delete share link |
Data Models
Deck - Presentation deck
id(string) - Unique identifieruserId(string) - Owner user IDtitle(string) - Deck titledescription(string?) - Optional descriptionthemeId(string?) - Theme referenceisPublic(boolean) - Visibility flagcreatedAt/updatedAt(timestamps)
Slide - Individual slide in a deck
id(string) - Unique identifierdeckId(string) - Parent deck referenceorder(number) - Position in deckcontent(SlideContent) - Slide contentcreatedAt(timestamp)
SlideContent - Content structure
type: 'title' | 'content' | 'image' | 'split'title,subtitle,body,imageUrl,bulletPoints
Theme - Visual theme
id,name,colors,fonts,isDefault
SharedDeck - Share link for deck
id(string) - Unique identifierdeckId(string) - Reference to deckshareCode(string) - Unique share code (12 chars)expiresAt(timestamp?) - Optional expirationcreatedAt(timestamp)
Environment Variables
Backend (.env)
NODE_ENV=development
PORT=3008
DATABASE_URL=postgresql://manacore:devpassword@localhost:5432/presi
MANA_CORE_AUTH_URL=http://localhost:3001
CORS_ORIGINS=http://localhost:5173,http://localhost:8081
Mobile (.env)
EXPO_PUBLIC_BACKEND_URL=http://localhost:3008
EXPO_PUBLIC_MANA_CORE_AUTH_URL=http://localhost:3001
Web (.env)
PUBLIC_BACKEND_URL=http://localhost:3008
PUBLIC_MANA_CORE_AUTH_URL=http://localhost:3001
Shared Package
@presi/shared
Located at packages/shared/
Types:
Deck,Slide,SlideContentTheme,ThemeColors,ThemeFontsSharedDeck(for sharing feature)
DTOs:
CreateDeckDto,UpdateDeckDtoCreateSlideDto,UpdateSlideDtoReorderSlidesDto
Code Style Guidelines
- TypeScript: Strict typing with interfaces
- Mobile: Functional components with hooks, Zustand for state
- Web: Svelte 5 runes mode (
$state,$derived,$effect) - Backend: NestJS modules with controllers and services
- Styling: Tailwind CSS (Web), NativeWind (Mobile)
- Formatting: Prettier with project config
Web App Features
The SvelteKit web app provides feature parity with the mobile app:
- Authentication: Login/Register/Forgot Password with Mana Core Auth
- Deck Management: Create, edit, delete presentation decks
- Slide Editor: Create slides with title, body, bullet points, images
- Presentation Mode: Fullscreen presentation with keyboard navigation
- Arrow keys / A/D for navigation
- F for fullscreen toggle
- ESC to exit
- Timer with start/pause
- Speaker notes toggle
- Sharing: Create share links for decks, public view without auth
- Profile: View user info and deck statistics
- Settings: Theme switching (light/dark/system), account info
Web App Structure
src/
├── lib/
│ ├── api/client.ts # API client with auth
│ └── stores/
│ ├── auth.svelte.ts # Auth state (Svelte 5 runes)
│ └── decks.svelte.ts # Decks/slides state
├── routes/
│ ├── +layout.svelte # App layout with header
│ ├── +page.svelte # Deck list (home)
│ ├── login/ # Login page
│ ├── register/ # Register page
│ ├── forgot-password/ # Password reset page
│ ├── deck/[id]/ # Deck editor with slides
│ ├── present/[id]/ # Presentation mode
│ ├── shared/[code]/ # Public shared deck view
│ ├── profile/ # User profile page
│ └── settings/ # Settings page
└── app.css # Global styles
Important Notes
- Authentication: Uses Mana Core Auth (JWT in Authorization header)
- Database: PostgreSQL with Drizzle ORM
- Ports: Backend=3008, Web=5178
- Landing: Not yet implemented (empty folder)