Monorepo for the Digital Kangyur Library platform.
frontend: React + Vite web applicationbackend: Express + Prisma API
- Node.js 18+ (LTS recommended)
- npm 9+
- PostgreSQL 14+ (or compatible)
digital-kangyur-library/
|- frontend/ # Vite React app
|- backend/ # Express API + Prisma
`- package.json # Root script to run both apps
From repository root:
npm install
npm install --prefix backend
npm install --prefix frontendIn backend, copy env.example to .env:
cd backend
cp env.example .envRequired values in backend/.env:
PORT=3000
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRATION=1h
JWT_REFRESH_EXPIRATION=7d
BASE_URL=http://localhost:3000
CORS_ORIGIN=*
DATABASE_URL=postgresql://postgres:password@localhost:5432/karchag_db1?schema=publicOptional (only needed if file upload to S3 is used):
S3_REGION=us-east-1
S3_BUCKET=your-bucket-name
S3_ACCESS_KEY_ID=your-access-key-id
S3_SECRET_ACCESS_KEY=your-secret-access-key
S3_UPLOAD_PREFIX=uploads
S3_ACL=public-readFrom backend:
npx prisma generate
npx prisma migrate devOptional seed data (timeline):
npm run seed:timelineFrom repository root (runs frontend and backend together):
npm run devDefault local URLs:
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:3000/api/v1 - Swagger docs:
http://localhost:3000/api-docs - Health check:
http://localhost:3000/health
From backend:
npm run devFrom frontend:
npm run devThe frontend uses:
VITE_API_BASE_URLif set- fallback:
http://localhost:3000/api/v1
If needed, create frontend/.env:
VITE_API_BASE_URL=http://localhost:3000/api/v1From backend:
npm run buildFrom frontend:
npm run buildPreview frontend production build:
cd frontend
npm run previewRoot:
npm run dev- run frontend and backend concurrently
Backend:
npm run dev- start backend with nodemonnpm start- start backendnpm run build- compile TypeScriptnpm run type-check- run TypeScript checksnpm run seed:timeline- seed timeline data
Frontend:
npm run dev- start Vite dev servernpm run build- create production buildnpm run lint- run ESLintnpm run preview- preview production build
- Prisma connection error:
- Confirm PostgreSQL is running.
- Confirm
DATABASE_URLinbackend/.env.
- CORS/API issues:
- Set
CORS_ORIGINin backend.env. - Set
VITE_API_BASE_URLin frontend.envif backend URL differs.
- Set
- Upload API issues:
- Verify S3 credentials and bucket settings in backend
.env.
- Verify S3 credentials and bucket settings in backend