Your Actual Folder Layout
๐ Your Repository Structure - Optimized Workflow Guide
Your Actual Folder Layout
bayezid_portfolio/
โโโ .github/
โ โโโ workflows/ โ
NEW - Your CI/CD pipelines
โ โโโ ci-cd.yml
โ โโโ code-quality.yml
โ โโโ deploy.yml
โ
โโโ client/ โ
Frontend (React + Vite)
โ โโโ src/
โ โโโ components/
โ โโโ pages/
โ โโโ styles/
โ
โโโ server/ โ
Backend (Express.js)
โ โโโ index.ts
โ
โโโ shared/ โ
Shared code (types, utils)
โ โโโ ...shared files
โ
โโโ patches/ โ
pnpm patches
โ โโโ wouter@3.7.1.patch
โ
โโโ Configuration Files
โ โโโ vite.config.ts โ
Vite build config
โ โโโ tsconfig.json โ
TypeScript config
โ โโโ tsconfig.node.json
โ โโโ package.json โ
All dependencies
โ โโโ pnpm-lock.yaml
โ โโโ railway.json โ
Railway deployment
โ โโโ template.json
โ โโโ components.json
โ
โโโ Ignore Files
โ โโโ .gitignore
โ โโโ .prettierignore
โ
โโโ Format Config
โ โโโ .prettierrc
โ
โโโ Documentation
โโโ README.md
๐๏ธ Your Tech Stack Breakdown
Frontend (client/)
React 19.2.1
โโโ Vite 7.1.7 (build tool)
โโโ TailwindCSS 4.1.14
โโโ Radix UI (21 components)
โโโ Framer Motion (animations)
โโโ React Hook Form (forms)
โโโ Zod (validation)
โโโ Wouter (routing)
Backend (server/)
Node.js 20
โโโ Express 4.21.2
โโโ TypeScript 5.6.3
โโโ esbuild (bundling)
Shared (shared/)
Shared types, utilities, and constants
Used by both client and server
๐ Build Process (How It Works)
Step 1: Install Dependencies
pnpm install --frozen-lockfile
โโ Installs all client/ dependencies
โโ Installs all server/ dependencies
โโ Applies patches/ (wouter fix)
Step 2: Type Check
pnpm check
โโ TypeScript compiles client/
โโ TypeScript compiles server/
โโ TypeScript compiles shared/
โโ ~3 seconds (no output files)
Step 3: Build Frontend (client/)
pnpm build
โโ Vite processes client/
โโ Outputs to: dist/public/
โโ Includes: JS, CSS, assets
โโ ~20 seconds
Step 4: Build Backend (server/)
esbuild server/index.ts --platform=node ...
โโ Bundles server/ code
โโ Outputs to: dist/index.js
โโ Includes: all dependencies
โโ ~3 seconds
Step 5: Final Output
dist/
โโโ index.js โ Server entry point
โโโ public/ โ Frontend assets
โ โโโ index.html
โ โโโ assets/
โ โ โโโ index-xxx.js
โ โ โโโ vendor-xxx.js
โ โ โโโ style-xxx.css
โ โโโ ...
โโโ ...other files
๐ Build Command Breakdown
Your package.json has:
{
"scripts": {
"build": "vite build && esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist",
"start": "NODE_ENV=production node dist/index.js",
"dev": "vite --host",
"preview": "vite preview --host"
}
}
This means:
vite build- Builds React app todist/public/&&- Then (if successful)esbuild server/...- Bundles Express server todist/index.js- Result - Full-stack app ready to run
๐ CI/CD Flow for Your Structure
Push to GitHub
โ
Check all TypeScript
โโ client/
โโ server/
โโ shared/
โ (~3 sec)
Build Frontend
โโ client/ โ dist/public/
โโ Include assets
โ (~20 sec)
Build Backend
โโ server/ โ dist/index.js
โโ Include dependencies
โ (~3 sec)
Verify Output
โโ dist/index.js exists
โโ dist/public/ exists
โโ Count files
โ (~2 sec)
Run Tests
โโ Security scan
โโ Dependency audit
โ (~5 sec)
Deploy (if main branch)
โโ Docker build with dist/
โโ SSH to server
โโ Start with: node dist/index.js
โ (~10 sec)
โ
Done! (~40-50 seconds total)
๐ณ How Docker Handles Your Structure
Build Stage (in Dockerfile)
FROM node:20-alpine AS builder
WORKDIR /app
COPY pnpm-lock.yaml package.json ./
COPY patches ./patches
COPY client/ ./client
COPY server/ ./server
COPY shared/ ./shared
COPY vite.config.ts tsconfig*.json ./
RUN pnpm install --frozen-lockfile
RUN pnpm build
# Output: dist/index.js + dist/public/
Runtime Stage
FROM node:20-alpine
COPY dist/ ./dist
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
# Only prod dependencies, smaller image
CMD ["node", "dist/index.js"]
# Runs Express server on port 3000
# Serves static files from dist/public/
๐ Folder Organization for CI/CD
What Gets Built
client/ โ โ
Vite builds to dist/public/
server/ โ โ
esbuild bundles to dist/index.js
shared/ โ โ
Included in both builds
patches/ โ โ
Applied during install
What Gets Deployed
dist/
โโโ index.js โ Server code
โโโ public/ โ Frontend assets
โโโ index.html
โโโ assets/
What's Not in Docker
client/src/ โ Source (not needed)
server/ โ Source (bundled into dist/index.js)
shared/ โ Source (bundled)
patches/ โ Only for install
.github/ โ CI/CD config
node_modules/ โ Prod deps only installed
tsconfig.json โ Build config (not needed)
vite.config.ts โ Build config (not needed)
โ Workflow Compatibility Check
| File | Purpose | Used by Workflows | Status |
|---|---|---|---|
vite.config.ts |
Frontend build | โ Yes | โ Configured |
server/index.ts |
Backend entry | โ Yes | โ Bundled |
client/src/ |
Frontend source | โ Yes | โ Built |
shared/ |
Shared types | โ Yes | โ Included |
package.json |
Dependencies | โ Yes | โ Locked |
pnpm-lock.yaml |
Dependency lock | โ Yes | โ Verified |
patches/ |
Patches | โ Yes | โ Applied |
railway.json |
Deployment config | โ ๏ธ Optional | See below |
tsconfig.json |
TypeScript config | โ Yes | โ Used |
template.json |
Template config | โ No | Not needed |
components.json |
Component config | โ No | Not needed |
๐ข Deployment Options
Option 1: Manual SSH (Default in our workflows)
GitHub โ Build โ SSH to server โ Deploy โ Running
Pros: Full control, no vendor lock-in
Cons: Need to manage server
Option 2: Railway (You have railway.json!)
GitHub โ Build โ Push to Railway โ Deploy โ Running
Pros: Easier, managed platform
Cons: Vendor lock-in, need Railway account
Option 3: Docker Registry
GitHub โ Build โ Build Docker โ Push to registry โ Deploy
Pros: Platform-agnostic
Cons: More complex setup
๐ Expected Build Times
| Step | Time | Details |
|---|---|---|
| Install | 30-60s | First run cached after |
| Type Check | 2-3s | client/ + server/ + shared/ |
| Vite Build | 15-20s | client/ with TailwindCSS |
| esbuild | 2-3s | server/ bundling |
| Verify | 2s | Check output files |
| Security | 3-5s | Audit + scan |
| Total | 40-50s | First run with cache |
๐ฏ What Workflows Do Now
1. Type Checking
pnpm check
Checks:
- โ client/src/** TypeScript
- โ server/** TypeScript
- โ shared/** TypeScript
2. Build
pnpm build
Produces:
- โ dist/public/** (Frontend)
- โ dist/index.js (Server)
3. Deployment
node dist/index.js
Runs:
- โ Express server on port 3000
- โ Serves dist/public/** as static
- โ API routes from server/
๐ What Gets Deployed to Server
/home/deploy/app/
โโโ dist/
โ โโโ index.js โ Server starts here
โ โโโ public/ โ Static files served
โโโ package.json
โโโ pnpm-lock.yaml
โโโ node_modules/ โ Prod deps only
โโโ ...
๐ GitHub Actions Integration
Your workflows handle:
1. Setup
โโ Checkout code
โโ Setup Node 20
โโ Cache dependencies
2. Check
โโ Type check (pnpm check)
โโ Format check (prettier)
โโ Build check (pnpm build)
3. Security
โโ Dependency audit
โโ Vulnerability scan
4. Deploy (main branch only)
โโ SSH to server
โโ Git pull
โโ Install deps
โโ Build (pnpm build)
โโ Restart (pm2 restart)
๐ Your Specific Advantages
Full-Stack in One Repo
- Single
pnpm installinstalls everything - Single build command creates both
- Single
Shared Code
- Types in shared/ used by client & server
- No duplication
- Built-in consistency
Single Docker Image
- One image contains everything
- Easy to scale
- Easy to deploy
pnpm Workspace Ready
- Already has patches/
- Can add workspaces later if needed
- Performance-optimized
โจ What's Already Configured
โ
Build: pnpm build handles both client & server
โ
Run: node dist/index.js starts the server
โ
TypeScript: Works across all folders
โ
Vite: Configured for client/ only
โ
esbuild: Configured for server/ only
โ
Patches: Applied automatically
โ
Dependencies: Single lock file
๐ Next Steps
Verify locally (before pushing)
pnpm install pnpm check pnpm build node dist/index.jsPush workflows to GitHub
git add .github/ git commit -m "ci: add workflows" git push origin mainConfigure secrets (see GITHUB_ACTIONS_SETUP.md)
STAGING_SERVER_HOST PRODUCTION_SERVER_HOST (etc...)Monitor first run
https://github.com/bayzed123/bayezid_portfolio/actions
๐ Document Reading Order
- THIS FILE โ You are here
CUSTOMIZATION_SUMMARY.md- What we customizedVITE_QUICK_REFERENCE.md- Build specificsGITHUB_ACTIONS_SETUP.md- Deploy setupCOMPLETE_WORKFLOWS_GUIDE.md- Full reference
โ Checklist Before Deploying
- Workflows are in
.github/workflows/ -
pnpm buildworks locally -
node dist/index.jsstarts your server -
dist/public/has your frontend - Secrets configured in GitHub
- Server is accessible via SSH
- Server has Node 20 + pnpm installed
TL;DR: Your repo has:
- client/ โ Vite builds this to
dist/public/ - server/ โ esbuild bundles this to
dist/index.js - shared/ โ Included in both builds
- Workflows build both, Docker packages both โ
Ready to deploy! ๐