eeshstuti-svelte Svelte Themes

Eeshstuti Svelte

A Svelte website for Hindu prayers, mantras, and stotrams for various deities

Database Implementation Plan

1. Choose Database & Backend Solution

  • Option A: SvelteKit + Prisma + PostgreSQL/MySQL
  • Option B: SvelteKit + Firebase/Firestore
  • Option C: SvelteKit + Supabase (PostgreSQL with API)

2. Setup Steps

If choosing Option A (Prisma + PostgreSQL):

  1. Install dependencies:

    npm install prisma @prisma/client
    npx prisma init
    
  2. Define schema in prisma/schema.prisma:

    model Deity {
      id         String     @id @default(uuid())
      name       String
      prayers    Prayer[]
      stories    Story[]
      images     Image[]
      occasions  OccasionDeity[]
    }
       
    model Prayer {
      id          String   @id @default(uuid())
      name        String
      content     String   @db.Text
      type        String
      translation String?  @db.Text
      audioUrl    String?
      deityId     String
      deity       Deity    @relation(fields: [deityId], references: [id])
      occasions   OccasionPrayer[]
    }
    
    // Additional models for Story, Image, Occasion, etc.
    
  3. Create API endpoints in SvelteKit using server routes

If choosing Option B (Firebase):

  1. Install Firebase:

    npm install firebase
    
  2. Set up Firebase config

  3. Create Firestore collections

3. Implement Data Access Layer

  • Create server endpoints in src/routes/api/
  • Create API client in frontend

4. Frontend Integration

  • Replace hardcoded data with API calls
  • Implement data loading states
  • Add error handling

5. Content Management System

  • Create admin interface for managing content
  • Implement auth for admins

6. Migration Strategy

  • Export current hardcoded data to JSON format
  • Write import scripts
  • Test all CRUD operations

Which option would you prefer to proceed with?

After updating db in schema.prisma we should do npx prisma migrate dev --create-only This will first check if all the changes are correct then if all is well then ask yes /no and name of migration then do prisma migrate dev then npx prisma generate to regenerate the prisma client. then npx prisma studio to check the database

Top categories

Loading Svelte Themes