정리2
This commit is contained in:
102
.env
102
.env
@@ -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
|
|
||||||
102
.env.development
102
.env.development
@@ -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
|
|
||||||
79
.env.example
79
.env.example
@@ -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
|
|
||||||
@@ -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
|
|
||||||
101
.gitignore
vendored
101
.gitignore
vendored
@@ -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
|
|
||||||
290
README.md
290
README.md
@@ -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 <repository-url>
|
|
||||||
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!** 🎉
|
|
||||||
65
backend/.gitignore
vendored
65
backend/.gitignore
vendored
@@ -1,9 +1,28 @@
|
|||||||
# compiled output
|
# ==============================================
|
||||||
/dist
|
# Dependencies
|
||||||
|
# ==============================================
|
||||||
/node_modules
|
/node_modules
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
|
# Build Output
|
||||||
|
# ==============================================
|
||||||
|
/dist
|
||||||
/build
|
/build
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
|
# Environment Variables (민감정보)
|
||||||
|
# ==============================================
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
# .env.example은 커밋 가능
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
# Logs
|
# Logs
|
||||||
|
# ==============================================
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
@@ -12,14 +31,15 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
# OS
|
# ==============================================
|
||||||
.DS_Store
|
# Testing
|
||||||
|
# ==============================================
|
||||||
# Tests
|
|
||||||
/coverage
|
/coverage
|
||||||
/.nyc_output
|
/.nyc_output
|
||||||
|
|
||||||
# IDEs and editors
|
# ==============================================
|
||||||
|
# IDE & Editors
|
||||||
|
# ==============================================
|
||||||
/.idea
|
/.idea
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
@@ -27,30 +47,35 @@ lerna-debug.log*
|
|||||||
*.launch
|
*.launch
|
||||||
.settings/
|
.settings/
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|
||||||
# dotenv environment variable files
|
# ==============================================
|
||||||
.env
|
# OS Files
|
||||||
.env.development.local
|
# ==============================================
|
||||||
.env.test.local
|
.DS_Store
|
||||||
.env.production.local
|
Thumbs.db
|
||||||
.env.local
|
|
||||||
|
|
||||||
# temp directory
|
# ==============================================
|
||||||
|
# Temp & Runtime
|
||||||
|
# ==============================================
|
||||||
.temp
|
.temp
|
||||||
.tmp
|
.tmp
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
pids
|
||||||
*.pid
|
*.pid
|
||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# ==============================================
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
# Diagnostic Reports
|
||||||
|
# ==============================================
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
|
# Uploads (로컬 테스트용)
|
||||||
|
# ==============================================
|
||||||
|
/uploads/*
|
||||||
|
!/uploads/.gitkeep
|
||||||
|
|||||||
@@ -11,26 +11,9 @@ COPY package*.json ./
|
|||||||
# 의존성 설치
|
# 의존성 설치
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# 소스 코드 복사
|
# 소스 코드 복사 (.env 포함)
|
||||||
COPY . .
|
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 빌드
|
# NestJS 빌드
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|||||||
74
commands.txt
74
commands.txt
@@ -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
|
|
||||||
67
frontend/.gitignore
vendored
67
frontend/.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
# ==============================================
|
||||||
|
# Dependencies
|
||||||
# dependencies
|
# ==============================================
|
||||||
/node_modules
|
/node_modules
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.*
|
.pnp.*
|
||||||
@@ -9,33 +9,68 @@
|
|||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
# testing
|
# ==============================================
|
||||||
/coverage
|
# Build Output
|
||||||
|
# ==============================================
|
||||||
# next.js
|
|
||||||
/.next/
|
/.next/
|
||||||
/out/
|
/out/
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
/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
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
*.pem
|
*.pem
|
||||||
|
|
||||||
# debug
|
# ==============================================
|
||||||
|
# Debug Logs
|
||||||
|
# ==============================================
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
.pnpm-debug.log*
|
.pnpm-debug.log*
|
||||||
|
|
||||||
# env files (can opt-in for committing if needed)
|
# ==============================================
|
||||||
.env*
|
# Vercel
|
||||||
|
# ==============================================
|
||||||
# vercel
|
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
# typescript
|
# ==============================================
|
||||||
|
# TypeScript
|
||||||
|
# ==============================================
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
|
# Misc
|
||||||
|
# ==============================================
|
||||||
|
.temp
|
||||||
|
.tmp
|
||||||
|
|||||||
Reference in New Issue
Block a user