Reorganize project structure with backend/ and frontend/ directories

This commit is contained in:
Ryderjj89
2025-09-13 12:14:01 -04:00
parent 84f1dfaf23
commit 13c93879c0
6 changed files with 130 additions and 26 deletions

View File

@@ -1,20 +1,42 @@
FROM node:18-alpine # Multi-stage Dockerfile for production deployment
FROM node:18-alpine AS base
WORKDIR /app # Install git for cloning bible repository
# Install git for cloning the bible repository
RUN apk add --no-cache git RUN apk add --no-cache git
# Copy package files # Backend stage
COPY package*.json ./ FROM base AS backend
WORKDIR /app/backend
# Install dependencies COPY backend/package*.json ./
RUN npm ci --only=production RUN npm ci --only=production
# Copy application code # Frontend build stage
COPY . . FROM base AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
COPY frontend/tsconfig.json ./
COPY frontend/tailwind.config.js ./
COPY frontend/postcss.config.js ./
RUN npm ci
COPY frontend/public ./public
COPY frontend/src ./src
RUN npm run build
# Clone ESV Bible markdown repository # Production stage
FROM base AS production
WORKDIR /app
# Copy backend
COPY backend ./backend
COPY --from=backend /app/backend/node_modules ./backend/node_modules
# Copy built frontend
COPY --from=frontend-build /app/frontend/build ./frontend/build
# Copy docker-compose configuration
COPY docker-compose.yml ./
# Clone ESV Bible repository
RUN git clone https://github.com/lguenth/mdbible.git /tmp/mdbible && \ RUN git clone https://github.com/lguenth/mdbible.git /tmp/mdbible && \
mkdir -p /app/bible-data && \ mkdir -p /app/bible-data && \
cp -r /tmp/mdbible/by_chapter/* /app/bible-data/ && \ cp -r /tmp/mdbible/by_chapter/* /app/bible-data/ && \
@@ -23,5 +45,6 @@ RUN git clone https://github.com/lguenth/mdbible.git /tmp/mdbible && \
# Expose port # Expose port
EXPOSE 3000 EXPOSE 3000
# Start the application # Start backend server
WORKDIR /app/backend
CMD ["npm", "start"] CMD ["npm", "start"]

View File

@@ -2,11 +2,31 @@
A Docker-based web service for serving the ESV Bible in Markdown format with chapter-by-chapter organization. A Docker-based web service for serving the ESV Bible in Markdown format with chapter-by-chapter organization.
## Project Structure
```
esv-bible/
├── backend/ # Backend API server
│ ├── src/
│ │ └── index.js # Express server
│ ├── package.json
│ └── Dockerfile
├── frontend/ # React frontend application
│ ├── src/
│ ├── public/
│ ├── package.json
│ └── ...
├── bible-data/ # ESV Bible markdown files (auto-downloaded)
├── docker-compose.yml
└── README.md
```
## Features ## Features
- Complete ESV Bible text in Markdown format from [lguenth/mdbible](https://github.com/lguenth/mdbible) - Complete ESV Bible text in Markdown format from [lguenth/mdbible](https://github.com/lguenth/mdbible)
- Organized by book and chapter for easy navigation - Organized by book and chapter for easy navigation
- Docker containerized for easy deployment - Docker containerized for easy deployment
- Modern React frontend with responsive design
- RESTful API for accessing Bible content - RESTful API for accessing Bible content
- Persistent volume storage for Bible data - Persistent volume storage for Bible data
- Optimized for remote hosting - Optimized for remote hosting
@@ -43,12 +63,20 @@ curl http://localhost:3000/books/Genesis/1
## Development ## Development
For local development: ### Backend Development
```bash ```bash
cd backend
npm install npm install
npm run dev npm run dev
``` ```
### Frontend Development
```bash
cd frontend
npm install
npm start
```
## Docker Deployment ## Docker Deployment
Build and run with Docker Compose: Build and run with Docker Compose:

27
backend/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM node:18-alpine
WORKDIR /app
# Install git for cloning the bible repository
RUN apk add --no-cache git
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy application code
COPY . .
# Clone ESV Bible markdown repository
RUN git clone https://github.com/lguenth/mdbible.git /tmp/mdbible && \
mkdir -p /app/bible-data && \
cp -r /tmp/mdbible/by_chapter/* /app/bible-data/ && \
rm -rf /tmp/mdbible
# Expose port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]

21
backend/package.json Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "esv-bible-markdown",
"version": "1.0.0",
"description": "ESV Bible in Markdown format served via Docker",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js"
},
"keywords": ["bible", "esv", "markdown", "docker"],
"author": "",
"license": "MIT",
"dependencies": {
"express": "^4.18.2",
"cors": "^2.8.5",
"helmet": "^7.1.0"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}

View File

@@ -1,21 +1,26 @@
{ {
"name": "esv-bible-markdown", "name": "esv-bible-project",
"version": "1.0.0", "version": "1.0.0",
"description": "ESV Bible in Markdown format served via Docker", "description": "ESV Bible application with React frontend and Node.js backend",
"main": "src/index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "node src/index.js", "dev": "concurrently \"npm run dev:backend\" \"npm run dev:frontend\"",
"dev": "nodemon src/index.js" "dev:backend": "cd backend && npm run dev",
"dev:frontend": "cd frontend && npm start",
"install:all": "npm install && cd backend && npm install && cd ../frontend && npm install",
"build:frontend": "cd frontend && npm run build",
"docker:build": "docker-compose build",
"docker:up": "docker-compose up",
"docker:down": "docker-compose down"
}, },
"keywords": ["bible", "esv", "markdown", "docker"], "keywords": ["bible", "esv", "react", "docker", "markdown"],
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": {
"express": "^4.18.2",
"cors": "^2.8.5",
"helmet": "^7.1.0"
},
"devDependencies": { "devDependencies": {
"nodemon": "^3.0.1" "concurrently": "^8.2.0"
} },
"workspaces": [
"backend",
"frontend"
]
} }