Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sambrody62/meditation-weekly

Repository files navigation

ZenLife Meditation Platform

Weekly meditation platform with AI-generated content and professional audio production.

Architecture

  • Frontend: Server-rendered EJS templates with responsive design
  • Backend: Node.js/TypeScript with Express
  • Database: PostgreSQL (Cloud SQL)
  • Authentication: Google OAuth 2.0
  • Infrastructure: Google Cloud Platform (Cloud Run, Cloud SQL, GCS, Pub/Sub)
  • AI: Vertex AI for content generation, ElevenLabs for TTS

Project Structure

src/
├── controllers/    # Request handlers
├── db/            # Database migrations and seeds
├── middleware/    # Express middleware
├── models/        # Data models
├── routes/        # Route definitions
├── services/      # Business logic
├── utils/         # Utility functions
└── views/         # EJS templates
    ├── admin/     # Admin interface
    └── public/    # Public site

Phase Completion Status

  • Phase 0: Infrastructure bootstrap
  • Phase 1: Core scaffold with auth and database
  • Phase 2: AI generation and audio pipeline
  • Phase 3: Playback and scheduling
  • Phase 4: QA and launch

Local Development

  1. Prerequisites:

    • Node.js 20+
    • PostgreSQL 15+
    • Google Cloud SDK
  2. Setup:

    # Install dependencies
    npm install
    
    # Copy environment variables
    cp .env.example .env
    # Edit .env with your configuration
    
    # Run database migrations
    npm run migrate
    
    # Start development server
    npm run dev
  3. Environment Variables:

    • DATABASE_URL: PostgreSQL connection string
    • GOOGLE_CLIENT_ID: OAuth client ID
    • GOOGLE_CLIENT_SECRET: OAuth client secret
    • SESSION_SECRET: Express session secret
    • ADMIN_EMAILS: Comma-separated admin emails

Deployment

Manual Deployment

# Build and deploy to Cloud Run
./deploy.sh

CI/CD with Cloud Build

Push to main branch triggers automatic deployment via Cloud Build.

Post-Deployment Steps

  1. Update OAuth Configuration:

    • Add redirect URI: https://YOUR-SERVICE-URL/auth/google/callback
    • Configure authorized domains
  2. Set Admin Users:

    • Update ADMIN_EMAILS environment variable
    • First admin user auto-assigned on login
  3. Configure Secrets:

    • oauth-client-id: Google OAuth client ID
    • oauth-client-secret: Google OAuth secret
    • elevenlabs-api-key: ElevenLabs API key
    • jwt-secret: Session secret

Database Schema

Key tables:

  • users: User accounts with roles
  • themes: Weekly meditation themes
  • meditations: Individual meditation sessions
  • playback_events: Analytics and tracking
  • llm_jobs: AI generation queue
  • publish_jobs: Audio processing queue

API Endpoints

Public

  • GET /: Current week view
  • GET /theme/:id: Theme details
  • GET /meditation/:id: Meditation player
  • GET /archive: Past themes

Admin (requires admin role)

  • GET /admin: Dashboard
  • GET /admin/themes: Manage themes
  • POST /admin/themes/:id/generate: Trigger AI generation
  • POST /admin/themes/:id/approve: Approve for publishing

API

  • GET /api/health: Health check
  • POST /api/playback/event: Track playback
  • GET /api/meditations/current-week: Current content

Scripts

  • npm run dev: Start development server
  • npm run build: Build TypeScript
  • npm run start: Start production server
  • npm run migrate: Run database migrations
  • npm run test: Run tests
  • npm run lint: Lint code
  • npm run typecheck: Type checking

Monitoring

  • Health endpoint: /health
  • Structured logging with Winston
  • Cloud Monitoring integration
  • Playback analytics tracking

Security

  • HTTPS-only cookies
  • CSRF protection
  • Rate limiting
  • Content Security Policy
  • SQL injection prevention
  • XSS protection

Next Steps

  1. Implement Vertex AI integration for content generation
  2. Add ElevenLabs TTS pipeline
  3. Build audio mixing service
  4. Create HLS streaming setup
  5. Add comprehensive testing
  6. Performance optimization

License

Proprietary - All rights reserved

About

AI-powered weekly meditation platform with automatic content generation and voice synthesis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published