Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ─────────────────────────────────────────────────────────────────────────────
# urBackend β€” Environment Variables
# Copy this file to .env and fill in your values before running docker-compose.
# ─────────────────────────────────────────────────────────────────────────────

# Server
PORT=1234
NODE_ENV=production

# ── Database & Cache ──────────────────────────────────────────────────────────
# When using docker-compose, these are automatically overridden to point to
# internal service names (mongo, redis). You do NOT need to change these.
MONGO_URL=mongodb://mongo:27017/urbackend
REDIS_URL=redis://redis:6379

# ── Authentication ────────────────────────────────────────────────────────────
JWT_SECRET=your_super_secret_jwt_key_min_32_chars
ENCRYPTION_KEY=32_character_long_string_for_byod_creds
API_KEY_SALT=your_random_api_key_salt

# ── External Storage (Supabase) ───────────────────────────────────────────────
# Required for file upload/storage features.
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key

# ── Email (Resend) ────────────────────────────────────────────────────────────
# Required for OTP / email verification flow.
RESEND_API_KEY=re_your_resend_api_key
EMAIL_FROM=onboarding@resend.dev

# ── Frontend ──────────────────────────────────────────────────────────────────
FRONTEND_URL=http://localhost:5173
7 changes: 7 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.env
*.log
tests/
.git
.gitignore
npm-debug.log*
18 changes: 18 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ── Stage: Production ─────────────────────────────────────────────────────────
FROM node:20-alpine

# Set working directory
WORKDIR /app

# Install dependencies first (layer caching)
COPY package*.json ./
RUN npm ci --omit=dev

# Copy source
COPY . .

# Expose backend port
EXPOSE 1234

# Start the server
CMD ["node", "app.js"]
Comment thread
yash-pouranik marked this conversation as resolved.
Comment thread
yash-pouranik marked this conversation as resolved.
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

services:
# ── MongoDB ───────────────────────────────────────────────────────────────────
mongo:
image: mongo:7
container_name: urbackend_mongo
restart: unless-stopped
ports:
- '27017:27017'
Comment thread
yash-pouranik marked this conversation as resolved.
Comment thread
yash-pouranik marked this conversation as resolved.
volumes:
- mongo_data:/data/db

# ── Redis ─────────────────────────────────────────────────────────────────────
redis:
image: redis:latest
Comment thread
yash-pouranik marked this conversation as resolved.
Comment thread
yash-pouranik marked this conversation as resolved.
container_name: urbackend_redis
restart: unless-stopped
ports:
- '6379:6379'
Comment thread
yash-pouranik marked this conversation as resolved.
volumes:
- redis_data:/data

# ── Backend (Node.js) ─────────────────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: urbackend_api
restart: unless-stopped
ports:
- '1234:1234'
depends_on:
- mongo
- redis
Comment thread
yash-pouranik marked this conversation as resolved.
env_file:
- path: .env
required: false
environment:
# Override DB URLs to use Docker service names
MONGO_URL: mongodb://mongo:27017/urbackend
REDIS_URL: redis://redis:6379
NODE_ENV: production
PORT: 1234

volumes:
mongo_data:
redis_data: