From ef5f921e211a2cfa4e297265a3d256b6db4ae9b1 Mon Sep 17 00:00:00 2001 From: Hyoseong Jo Date: Mon, 15 Dec 2025 09:36:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=95=EB=A6=AC2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 102 ---------------- .env.development | 102 ---------------- .env.example | 79 ------------ .env.production | 77 ------------ .gitignore | 101 --------------- README.md | 290 -------------------------------------------- backend/.gitignore | 65 +++++++--- backend/Dockerfile | 19 +-- commands.txt | 74 ----------- frontend/.gitignore | 67 +++++++--- 10 files changed, 97 insertions(+), 879 deletions(-) delete mode 100644 .env delete mode 100644 .env.development delete mode 100644 .env.example delete mode 100644 .env.production delete mode 100644 .gitignore delete mode 100644 README.md delete mode 100644 commands.txt diff --git a/.env b/.env deleted file mode 100644 index 9471e2d..0000000 --- a/.env +++ /dev/null @@ -1,102 +0,0 @@ -# ============================================== -# DEVELOPMENT ENVIRONMENT VARIABLES -# ============================================== -# Copy this file to .env.local for local development -# DO NOT commit sensitive values to version control - -# ============================================== -# DATABASE CONFIGURATION -# ============================================== -DATABASE_URL=postgresql://genome:genome1@3@192.168.11.46:5431/genome_db -POSTGRES_HOST=192.168.11.46 -POSTGRES_USER=genome -POSTGRES_PASSWORD=genome1@3 -POSTGRES_DB=genome_db -POSTGRES_PORT=5431 -POSTGRES_SYNCHRONIZE=true -POSTGRES_LOGGING=true - -# ============================================== -# REDIS CONFIGURATION -# ============================================== -REDIS_URL=redis://192.168.11.46:6379 -REDIS_HOST=192.168.11.46 -REDIS_PORT=6379 - -# ============================================== -# BACKEND CONFIGURATION -# ============================================== -BACKEND_PORT=4000 -NODE_ENV=development - -# ============================================== -# JWT AUTHENTICATION -# ============================================== -JWT_SECRET=your-super-secret-jwt-key-change-this-in-production -JWT_EXPIRES_IN=24h -JWT_REFRESH_SECRET=your-refresh-token-secret -JWT_REFRESH_EXPIRES_IN=7d - -# ============================================== -# CORS CONFIGURATION -# ============================================== -CORS_ORIGIN=http://localhost:3000,http://192.168.11.249:3000,http://123.143.174.11:5244 -CORS_CREDENTIALS=true - -# ============================================== -# SECURITY SETTINGS -# ============================================== -RATE_LIMIT_WINDOW_MS=900000 -RATE_LIMIT_MAX_REQUESTS=100 -BCRYPT_SALT_ROUNDS=12 - -# ============================================== -# FILE UPLOAD -# ============================================== -MAX_FILE_SIZE=10485760 -UPLOAD_DESTINATION=./uploads -ALLOWED_FILE_TYPES=jpg,jpeg,png,gif,pdf,doc,docx - -# ============================================== -# EMAIL CONFIGURATION -# ============================================== -SMTP_HOST=smtp.gmail.com -SMTP_PORT=587 -SMTP_SECURE=false -SMTP_USER=your-email@gmail.com -SMTP_PASS=your-app-password -FROM_EMAIL=noreply@yourdomain.com - -# ============================================== -# LOGGING -# ============================================== -LOG_LEVEL=debug -LOG_FORMAT=dev -LOG_FILE_ENABLED=true -LOG_FILE_PATH=./logs - -# ============================================== -# EXTERNAL SERVICES -# ============================================== -# AWS_ACCESS_KEY_ID=your-aws-access-key -# AWS_SECRET_ACCESS_KEY=your-aws-secret -# AWS_REGION=us-east-1 -# AWS_S3_BUCKET=your-bucket-name - -# ============================================== -# MONITORING -# ============================================== -# SENTRY_DSN=your-sentry-dsn -# HEALTH_CHECK_ENABLED=true - -# ============================================== -# FRONTEND CONFIGURATION -# ============================================== -FRONTEND_PORT=3000 -NEXT_PUBLIC_API_URL=/api - -# ============================================== -# NGINX CONFIGURATION -# ============================================== -NGINX_HTTP_PORT=80 -NGINX_HTTPS_PORT=443 \ No newline at end of file diff --git a/.env.development b/.env.development deleted file mode 100644 index f250ef8..0000000 --- a/.env.development +++ /dev/null @@ -1,102 +0,0 @@ -# ============================================== -# DEVELOPMENT ENVIRONMENT VARIABLES -# ============================================== -# Copy this file to .env.local for local development -# DO NOT commit sensitive values to version control - -# ============================================== -# DATABASE CONFIGURATION -# ============================================== -DATABASE_URL=postgresql://user:password@localhost:5432/genome_db -POSTGRES_HOST=192.168.11.46 -POSTGRES_USER=genome -POSTGRES_PASSWORD=genome1@3 -POSTGRES_DB=genome_db -POSTGRES_PORT=5431 -POSTGRES_SYNCHRONIZE=true -POSTGRES_LOGGING=true - -# ============================================== -# REDIS CONFIGURATION -# ============================================== -REDIS_URL=redis://192.168.11.46:6379 -REDIS_HOST=localhost -REDIS_PORT=6379 - -# ============================================== -# BACKEND CONFIGURATION -# ============================================== -BACKEND_PORT=4000 -NODE_ENV=development - -# ============================================== -# JWT AUTHENTICATION -# ============================================== -JWT_SECRET=your-super-secret-jwt-key-change-this-in-production -JWT_EXPIRES_IN=24h -JWT_REFRESH_SECRET=your-refresh-token-secret -JWT_REFRESH_EXPIRES_IN=7d - -# ============================================== -# CORS CONFIGURATION -# ============================================== -CORS_ORIGIN=http://localhost:3000,http://192.168.11.46:3000,http://123.143.174.11:5244 -CORS_CREDENTIALS=true - -# ============================================== -# SECURITY SETTINGS -# ============================================== -RATE_LIMIT_WINDOW_MS=900000 -RATE_LIMIT_MAX_REQUESTS=100 -BCRYPT_SALT_ROUNDS=12 - -# ============================================== -# FILE UPLOAD -# ============================================== -MAX_FILE_SIZE=10485760 -UPLOAD_DESTINATION=./uploads -ALLOWED_FILE_TYPES=jpg,jpeg,png,gif,pdf,doc,docx - -# ============================================== -# EMAIL CONFIGURATION -# ============================================== -SMTP_HOST=smtp.gmail.com -SMTP_PORT=587 -SMTP_SECURE=false -SMTP_USER=your-email@gmail.com -SMTP_PASS=your-app-password -FROM_EMAIL=noreply@yourdomain.com - -# ============================================== -# LOGGING -# ============================================== -LOG_LEVEL=debug -LOG_FORMAT=dev -LOG_FILE_ENABLED=true -LOG_FILE_PATH=./logs - -# ============================================== -# EXTERNAL SERVICES -# ============================================== -# AWS_ACCESS_KEY_ID=your-aws-access-key -# AWS_SECRET_ACCESS_KEY=your-aws-secret -# AWS_REGION=us-east-1 -# AWS_S3_BUCKET=your-bucket-name - -# ============================================== -# MONITORING -# ============================================== -# SENTRY_DSN=your-sentry-dsn -# HEALTH_CHECK_ENABLED=true - -# ============================================== -# FRONTEND CONFIGURATION -# ============================================== -FRONTEND_PORT=3000 -NEXT_PUBLIC_API_URL=/api - -# ============================================== -# NGINX CONFIGURATION -# ============================================== -NGINX_HTTP_PORT=80 -NGINX_HTTPS_PORT=443 \ No newline at end of file diff --git a/.env.example b/.env.example deleted file mode 100644 index 0ae1bbb..0000000 --- a/.env.example +++ /dev/null @@ -1,79 +0,0 @@ -# ============================================== -# ENVIRONMENT VARIABLES TEMPLATE -# ============================================== -# Copy this file to .env and fill in your actual values -# NEVER commit real credentials to version control - -# ============================================== -# DATABASE CONFIGURATION -# ============================================== -DATABASE_URL=postgresql://username:password@localhost:5432/database_name -POSTGRES_USER=your_db_user -POSTGRES_PASSWORD=your_secure_password -POSTGRES_DB=your_database_name - -# ============================================== -# REDIS CONFIGURATION -# ============================================== -REDIS_URL=redis://localhost:6379 -REDIS_HOST=localhost -REDIS_PORT=6379 -REDIS_PASSWORD=your_redis_password_if_needed - -# ============================================== -# BACKEND CONFIGURATION -# ============================================== -BACKEND_PORT=4000 -NODE_ENV=development -JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters -JWT_EXPIRES_IN=24h -API_PREFIX=/api/v1 - -# ============================================== -# FRONTEND CONFIGURATION -# ============================================== -FRONTEND_PORT=3000 -NEXT_PUBLIC_API_URL=http://localhost:4000 -NEXT_PUBLIC_APP_NAME=Next Nest Docker Template - -# ============================================== -# NGINX CONFIGURATION -# ============================================== -NGINX_HTTP_PORT=80 -NGINX_HTTPS_PORT=443 - -# ============================================== -# CORS CONFIGURATION -# ============================================== -CORS_ORIGIN=http://localhost:3000,http://localhost:80 -CORS_CREDENTIALS=true - -# ============================================== -# SECURITY SETTINGS -# ============================================== -RATE_LIMIT_WINDOW_MS=900000 -RATE_LIMIT_MAX_REQUESTS=100 -BCRYPT_SALT_ROUNDS=12 - -# ============================================== -# EMAIL CONFIGURATION (Optional) -# ============================================== -# SMTP_HOST=smtp.gmail.com -# SMTP_PORT=587 -# SMTP_USER=your-email@gmail.com -# SMTP_PASS=your-app-password - -# ============================================== -# EXTERNAL SERVICES (Optional) -# ============================================== -# AWS_ACCESS_KEY_ID=your-aws-access-key -# AWS_SECRET_ACCESS_KEY=your-aws-secret-key -# AWS_REGION=us-east-1 -# AWS_S3_BUCKET=your-bucket-name - -# ============================================== -# MONITORING & LOGGING (Optional) -# ============================================== -# LOG_LEVEL=info -# SENTRY_DSN=your-sentry-dsn -# MONITORING_ENABLED=true \ No newline at end of file diff --git a/.env.production b/.env.production deleted file mode 100644 index 0b31e22..0000000 --- a/.env.production +++ /dev/null @@ -1,77 +0,0 @@ -# ============================================== -# PRODUCTION ENVIRONMENT VARIABLES -# ============================================== -# This file contains production environment variable templates -# DO NOT use default values in production! - -# ============================================== -# DATABASE CONFIGURATION -# ============================================== -DATABASE_URL=postgresql://prod_user:STRONG_PASSWORD@postgres:5432/prod_db -POSTGRES_USER=prod_user -POSTGRES_PASSWORD=CHANGE_THIS_STRONG_PASSWORD -POSTGRES_DB=prod_db - -# ============================================== -# REDIS CONFIGURATION -# ============================================== -REDIS_URL=redis://redis:6379 -REDIS_HOST=redis -REDIS_PORT=6379 -REDIS_PASSWORD=REDIS_STRONG_PASSWORD - -# ============================================== -# BACKEND CONFIGURATION -# ============================================== -BACKEND_PORT=4000 -NODE_ENV=production -JWT_SECRET=SUPER_SECURE_JWT_SECRET_AT_LEAST_32_CHARACTERS_LONG -JWT_EXPIRES_IN=1h -API_PREFIX=/api/v1 - -# ============================================== -# FRONTEND CONFIGURATION -# ============================================== -FRONTEND_PORT=3000 -NEXT_PUBLIC_API_URL=https://your-domain.com -NEXT_PUBLIC_APP_NAME=Your App Name - -# ============================================== -# NGINX CONFIGURATION -# ============================================== -NGINX_HTTP_PORT=80 -NGINX_HTTPS_PORT=443 - -# ============================================== -# CORS CONFIGURATION -# ============================================== -CORS_ORIGIN=https://your-domain.com -CORS_CREDENTIALS=true - -# ============================================== -# SECURITY SETTINGS -# ============================================== -RATE_LIMIT_WINDOW_MS=900000 -RATE_LIMIT_MAX_REQUESTS=50 -BCRYPT_SALT_ROUNDS=15 - -# ============================================== -# SSL CONFIGURATION -# ============================================== -SSL_CERT_PATH=/etc/nginx/ssl/cert.pem -SSL_KEY_PATH=/etc/nginx/ssl/key.pem - -# ============================================== -# MONITORING & LOGGING -# ============================================== -LOG_LEVEL=warn -SENTRY_DSN=https://your-sentry-dsn@sentry.io/project-id -MONITORING_ENABLED=true - -# ============================================== -# EXTERNAL SERVICES -# ============================================== -# AWS_ACCESS_KEY_ID=your-production-aws-key -# AWS_SECRET_ACCESS_KEY=your-production-aws-secret -# AWS_REGION=us-east-1 -# AWS_S3_BUCKET=your-production-bucket \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f69e21a..0000000 --- a/.gitignore +++ /dev/null @@ -1,101 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.* -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/versions - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build -/dist - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* - -# env files (can opt-in for committing if needed) -# .env* - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts - -# Docker -.dockerignore - -# IDE and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# Database -*.sqlite -*.sqlite3 -*.db - -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Coverage directory used by tools like istanbul -coverage/ -*.lcov - -# nyc test coverage -.nyc_output - -# Temporary folders -tmp/ -temp/ -.tmp/ -.temp/ - -# OS generated files -Thumbs.db -ehthumbs.db - -# SSL certificates -*.key -*.crt -*.pem -ssl/ - -# Backup files -*.bak -*.backup \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 74470ff..0000000 --- a/README.md +++ /dev/null @@ -1,290 +0,0 @@ -# Next.js + NestJS + Docker Template - -A full-stack TypeScript template with Next.js frontend, NestJS backend, PostgreSQL, Redis, and Nginx, all containerized with Docker. - -## πŸš€ Quick Start -## 개발 ν™˜κ²½ ꡬ좕 - -```bash -# Clone the repository -git clone -cd next_nest_docker_template - -# Copy environment variables -cp .env.example .env - -# Start development environment -docker compose up -d - -# View logs -docker compose logs -f -``` - -Your application will be available at: -- **Frontend**: http://localhost:3000 -- **Backend API**: http://localhost:4000 -- **Nginx Proxy**: http://localhost:80 - -## πŸ“ Project Structure - -``` -β”œβ”€β”€ frontend/ # Next.js application -β”‚ β”œβ”€β”€ src/ # Source code -β”‚ β”œβ”€β”€ Dockerfile # Development Dockerfile -β”‚ └── .env.local.example # Frontend environment variables -β”œβ”€β”€ backend/ # NestJS application -β”‚ β”œβ”€β”€ src/ # Source code -β”‚ β”œβ”€β”€ Dockerfile # Development Dockerfile -β”‚ └── .env.example # Backend environment variables -β”œβ”€β”€ nginx/ # Nginx configuration -β”‚ β”œβ”€β”€ nginx.conf # Proxy configuration -β”‚ └── ssl/ # SSL certificates directory -β”œβ”€β”€ .env # Main environment variables -β”œβ”€β”€ .env.example # Environment template -β”œβ”€β”€ .env.production # Production environment template -β”œβ”€β”€ docker-compose.yml # Development containers -└── docker-compose.prod.yml # Production containers -``` - -## πŸ› οΈ Technology Stack - -### Frontend -- **Next.js 15.5.3** - React framework with Turbopack -- **React 19.1.0** - UI library -- **TypeScript** - Type safety -- **Tailwind CSS** - Styling - -### Backend -- **NestJS 11** - Node.js framework -- **TypeScript** - Type safety -- **Express** - HTTP server - -### Database & Cache -- **PostgreSQL 15** - Primary database -- **Redis 7** - Caching and sessions - -### Infrastructure -- **Docker & Docker Compose** - Containerization -- **Nginx** - Reverse proxy and load balancer - -## πŸ”§ Environment Configuration - -### Development Setup - -1. Copy the environment template: -```bash -cp .env.example .env -``` - -2. Configure your variables in `.env`: -```env -# Database -POSTGRES_USER=user -POSTGRES_PASSWORD=password -POSTGRES_DB=mydb - -# Security -JWT_SECRET=your-super-secret-jwt-key -CORS_ORIGIN=http://localhost:3000 - -# Ports -FRONTEND_PORT=3000 -BACKEND_PORT=4000 -``` - -### Production Setup - -1. Copy the production template: -```bash -cp .env.production .env -``` - -2. Update with your production values: -```env -# Use strong passwords in production -POSTGRES_PASSWORD=STRONG_PRODUCTION_PASSWORD -JWT_SECRET=SUPER_SECURE_JWT_SECRET_AT_LEAST_32_CHARACTERS_LONG - -# Use your domain -NEXT_PUBLIC_API_URL=https://your-domain.com -CORS_ORIGIN=https://your-domain.com -``` - -## 🐳 Docker Commands - -### Development -```bash -# Start all services -docker compose up -d - -# Rebuild and start -docker compose up -d --build - -# View logs -docker compose logs -f [service-name] - -# Stop services -docker compose down - -# Remove volumes (⚠️ deletes data) -docker compose down -v -``` - -### Production -```bash -# Start production environment -docker compose -f docker-compose.prod.yml up -d - -# Build and deploy -docker compose -f docker-compose.prod.yml up -d --build -``` - -## πŸ” Service Details - -### Frontend (Next.js) -- **Port**: 3000 (configurable via `FRONTEND_PORT`) -- **Development**: Hot reload enabled -- **Build**: Optimized production build with Turbopack - -### Backend (NestJS) -- **Port**: 4000 (configurable via `BACKEND_PORT`) -- **Development**: Watch mode enabled -- **Features**: JWT auth, CORS, rate limiting - -### Database (PostgreSQL) -- **Port**: 5432 (configurable via `POSTGRES_PORT`) -- **Volume**: `postgres_data` for persistence -- **Health Check**: Built-in readiness check - -### Cache (Redis) -- **Port**: 6379 (configurable via `REDIS_PORT`) -- **Volume**: `redis_data` for persistence -- **Health Check**: Ping command - -### Proxy (Nginx) -- **Ports**: 80 (HTTP), 443 (HTTPS) -- **Features**: Load balancing, SSL termination -- **Configuration**: `nginx/nginx.conf` - -## πŸ” Security Features - -- **JWT Authentication** - Secure API access -- **CORS Configuration** - Cross-origin request control -- **Rate Limiting** - API abuse prevention -- **Environment Variables** - Secure configuration management -- **SSL Support** - HTTPS encryption ready - -## 🚦 Health Checks - -All services include health checks: -- **Frontend**: HTTP GET to `/` -- **Backend**: HTTP GET to `/` -- **PostgreSQL**: `pg_isready` command -- **Redis**: `redis-cli ping` command - -## πŸ“ Development Workflow - -1. **Setup Environment**: -```bash -cp .env.example .env -# Edit .env with your settings -``` - -2. **Start Development**: -```bash -docker compose up -d -``` - -3. **Develop**: - - Frontend: Edit files in `frontend/src/` - - Backend: Edit files in `backend/src/` - - Changes are automatically reflected due to volume mounts - -4. **View Logs**: -```bash -docker compose logs -f frontend -docker compose logs -f backend -``` - -5. **Database Access**: -```bash -docker exec -it postgres-db psql -U user -d mydb -``` - -6. **Redis Access**: -```bash -docker exec -it redis-cache redis-cli -``` - -## πŸ”§ Customization - -### Adding New Services -1. Add service to `docker-compose.yml` -2. Update environment variables -3. Configure networking and dependencies - -### SSL Configuration -1. Place certificates in `nginx/ssl/` -2. Update `nginx.conf` for HTTPS -3. Update environment variables for HTTPS URLs - -### Environment Variables -All configurable values use environment variables with sensible defaults: -- See `.env.example` for full list -- Override any value in your `.env` file -- Production values in `.env.production` - -## πŸ› Troubleshooting - -### Common Issues - -**Port Conflicts**: -```bash -# Change ports in .env -FRONTEND_PORT=3001 -BACKEND_PORT=4001 -``` - -**Permission Issues**: -```bash -# Fix file permissions -sudo chown -R $USER:$USER . -``` - -**Database Connection**: -```bash -# Check database logs -docker compose logs postgres -``` - -**Container Not Starting**: -```bash -# Check specific service logs -docker compose logs [service-name] -``` - -### Reset Everything -```bash -# Stop and remove everything -docker compose down -v -docker system prune -f - -# Start fresh -docker compose up -d --build -``` - -## πŸ“„ License - -This project is licensed under the MIT License. - -## 🀝 Contributing - -1. Fork the repository -2. Create a feature branch -3. Commit your changes -4. Push to the branch -5. Create a Pull Request - ---- - -**Happy coding!** πŸŽ‰ \ No newline at end of file diff --git a/backend/.gitignore b/backend/.gitignore index e388170..b46f203 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,9 +1,28 @@ -# compiled output -/dist +# ============================================== +# Dependencies +# ============================================== /node_modules +package-lock.json + +# ============================================== +# Build Output +# ============================================== +/dist /build +# ============================================== +# Environment Variables (민감정보) +# ============================================== +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +# .env.example은 컀밋 κ°€λŠ₯ + +# ============================================== # Logs +# ============================================== logs *.log npm-debug.log* @@ -12,14 +31,15 @@ yarn-debug.log* yarn-error.log* lerna-debug.log* -# OS -.DS_Store - -# Tests +# ============================================== +# Testing +# ============================================== /coverage /.nyc_output -# IDEs and editors +# ============================================== +# IDE & Editors +# ============================================== /.idea .project .classpath @@ -27,30 +47,35 @@ lerna-debug.log* *.launch .settings/ *.sublime-workspace - -# IDE - VSCode .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local +# ============================================== +# OS Files +# ============================================== +.DS_Store +Thumbs.db -# temp directory +# ============================================== +# Temp & Runtime +# ============================================== .temp .tmp - -# Runtime data pids *.pid *.seed *.pid.lock -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json \ No newline at end of file +# ============================================== +# Diagnostic Reports +# ============================================== +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# ============================================== +# Uploads (둜컬 ν…ŒμŠ€νŠΈμš©) +# ============================================== +/uploads/* +!/uploads/.gitkeep diff --git a/backend/Dockerfile b/backend/Dockerfile index 8ae3caa..21f088d 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -11,26 +11,9 @@ COPY package*.json ./ # μ˜μ‘΄μ„± μ„€μΉ˜ RUN npm install -# μ†ŒμŠ€ μ½”λ“œ 볡사 +# μ†ŒμŠ€ μ½”λ“œ 볡사 (.env 포함) COPY . . -# ν™˜κ²½λ³€μˆ˜ μ„€μ • (Docker ν™˜κ²½μš©) -ENV NODE_ENV=production -ENV POSTGRES_HOST=192.168.11.46 -ENV POSTGRES_PORT=5431 -ENV POSTGRES_USER=genome -ENV POSTGRES_PASSWORD=genome1@3 -ENV POSTGRES_DB=genome_db -ENV POSTGRES_SYNCHRONIZE=false -ENV POSTGRES_LOGGING=false -ENV REDIS_URL=redis://192.168.11.46:6379 -ENV REDIS_HOST=192.168.11.46 -ENV REDIS_PORT=6379 -ENV JWT_SECRET=your-super-secret-jwt-key-change-this-in-production -ENV JWT_EXPIRES_IN=24h -ENV JWT_REFRESH_SECRET=your-refresh-token-secret -ENV JWT_REFRESH_EXPIRES_IN=7d - # NestJS λΉŒλ“œ RUN npm run build diff --git a/commands.txt b/commands.txt deleted file mode 100644 index 3611d1e..0000000 --- a/commands.txt +++ /dev/null @@ -1,74 +0,0 @@ -[BACKEND] -nest g resource -npm run start:dev - -[FRONTEND] -npm run build : 배포용, TypeScript/ESLint 였λ₯˜κ°€ 있으면 λΉŒλ“œ μ‹€νŒ¨ -npm run start -npm run dev : 개발λͺ¨λ“œ, TypeScript 였λ₯˜κ°€ μžˆμ–΄λ„ μ‹€ν–‰, κ°œλ°œν•  λ•ŒλŠ” νŽΈν•˜κ²Œ μž‘μ—…, 배포할 λ•ŒλŠ” 버그 μ—†λŠ” μ½”λ“œλ₯Ό 보μž₯ - -[DOCKER] -docker ps : μ‹€ν–‰ 쀑인 μ»¨ν…Œμ΄λ„ˆ 쑰회 -docker ps -a : λͺ¨λ“  μ»¨ν…Œμ΄λ„ˆ 쑰회 -docker compose up -d : λ°±κ·ΈλΌμš΄λ“œ compose μ‹€ν–‰ -docker compose down : μ’…λ£Œ -docker-compose up -d redis : redis μ„œλ²„ μ‹€ν–‰ -docker-compose down -v : λ³Όλ₯¨ μ‚­μ œ (데이터도 같이 μ‚­μ œ / TypeORM이 ν…Œμ΄λΈ” κ΅¬μ‘°λŠ” μžλ™ 생성) -docker-compose rm -f frontend - -docker-compose restart backend μ„œλΉ„μŠ€ μž¬μ‹œμž‘ -docker-compose up -d backend μ»¨ν…Œμ΄λ„ˆκ°€ μ—†μœΌλ©΄ μƒˆλ‘œ μƒμ„±ν•˜κ³ , 이미 있으면 μž¬μ‹œμž‘ - -dev λͺ¨λ“œ docker 외뢀망 μ‹€ν–‰ -docker-compose -f docker-compose.dev.yml up -d -docker-compose -f docker-compose.dev.yml down -docker-compose -f docker-compose.dev.yml restart backend -docker compose -f docker-compose.dev.yml build -docker compose -f docker-compose.dev.yml up --build - - -[μΊμ‹œμ‚­μ œ] -.next ν΄λ”λŠ” Next.js의 λΉŒλ“œ μΊμ‹œ 폴더 -μ‚­μ œν•΄λ„ μ•ˆμ „ν•œ 이유: - 1. μžλ™ μž¬μƒμ„±: 개발 μ„œλ²„(npm run dev)λ₯Ό μ‹€ν–‰ν•˜λ©΄ μžλ™μœΌλ‘œ λ‹€μ‹œ μƒμ„±λ©λ‹ˆλ‹€ - 2. μΊμ‹œλ§Œ 포함: μ†ŒμŠ€ μ½”λ“œκ°€ μ•„λ‹Œ 컴파일된 결과물만 μ €μž₯λ©λ‹ˆλ‹€ - 3. 원본 보쑴: src/ ν΄λ”μ˜ μ‹€μ œ μ½”λ“œλŠ” μ „ν˜€ 영ν–₯ μ—†μŠ΅λ‹ˆλ‹€ - - .next 폴더에 λ“€μ–΄μžˆλŠ” 것: - - .next/ - β”œβ”€β”€ cache/ # Turbopack/Webpack μΊμ‹œ - β”œβ”€β”€ server/ # μ„œλ²„ μ‚¬μ΄λ“œ λΉŒλ“œ 파일 - β”œβ”€β”€ static/ # 정적 에셋 - └── types/ # μžλ™ μƒμ„±λœ νƒ€μž… μ •μ˜ - - μ‚­μ œν•˜λŠ” 이유: - - μΊμ‹œ 손상: νŒ¨ν‚€μ§€ μ„€μΉ˜ ν›„ μΊμ‹œκ°€ 였래된 버전 μ°Έμ‘° - - λΉŒλ“œ 였λ₯˜: 이전 λΉŒλ“œ 였λ₯˜κ°€ μΊμ‹œμ— λ‚¨μ•„μžˆμ„ λ•Œ - - λͺ¨λ“ˆ ν•΄κ²° 문제: μƒˆλ‘œ μ„€μΉ˜ν•œ νŒ¨ν‚€μ§€(cmdk)λ₯Ό 인식 λͺ»ν•  λ•Œ - - - [방법] - Windowsμ—μ„œ .next 폴더 μ‚­μ œ 방법: - - 방법 1: 파일 탐색기 (κ°€μž₯ 쉬움) - - 1. C:\Users\COCOON\Desktop\repo14\repo14\next_nest_docker_template-main\frontend 폴더 μ—΄κΈ° - 2. .next 폴더 μ°ΎκΈ° (μˆ¨κΉ€ 파일 보기 ν™œμ„±ν™” ν•„μš”ν•  수 있음) - 3. .next 폴더 우클릭 β†’ μ‚­μ œ - 4. νœ΄μ§€ν†΅ λΉ„μš°κΈ° (선택사항) - - 방법 2: λͺ…λ Ή ν”„λ‘¬ν”„νŠΈ (CMD) - - cd C:\Users\COCOON\Desktop\repo14\repo14\next_nest_docker_template-main\frontend - rmdir /s /q .next - - 방법 3: PowerShell - - cd C:\Users\COCOON\Desktop\repo14\repo14\next_nest_docker_template-main\frontend - Remove-Item -Recurse -Force .next - - 방법 4: Git Bash (μ‚¬μš©ν•œ 방법) - - cd /c/Users/COCOON/Desktop/repo14/repo14/next_nest_docker_template-main/frontend - rm -rf .next \ No newline at end of file diff --git a/frontend/.gitignore b/frontend/.gitignore index 5ef6a52..df78db4 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -1,6 +1,6 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies +# ============================================== +# Dependencies +# ============================================== /node_modules /.pnp .pnp.* @@ -9,33 +9,68 @@ !.yarn/plugins !.yarn/releases !.yarn/versions +package-lock.json -# testing -/coverage - -# next.js +# ============================================== +# Build Output +# ============================================== /.next/ /out/ - -# production /build -# misc +# ============================================== +# Environment Variables (민감정보) +# ============================================== +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +# .env.example은 컀밋 κ°€λŠ₯ + +# ============================================== +# Testing +# ============================================== +/coverage + +# ============================================== +# IDE & Editors +# ============================================== +/.idea +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# ============================================== +# OS Files +# ============================================== .DS_Store +Thumbs.db *.pem -# debug +# ============================================== +# Debug Logs +# ============================================== npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* -# env files (can opt-in for committing if needed) -.env* - -# vercel +# ============================================== +# Vercel +# ============================================== .vercel -# typescript +# ============================================== +# TypeScript +# ============================================== *.tsbuildinfo next-env.d.ts + +# ============================================== +# Misc +# ============================================== +.temp +.tmp