Personal path of a middle developer
- Node.js 22
- pnpm 9+
- Docker and Docker Compose
- mkcert (for SSL certificates)
macOS:
brew install mkcertLinux:
# Follow instructions at: https://github.com/FiloSottile/mkcert#linuxWindows:
# Follow instructions at: https://github.com/FiloSottile/mkcert#windows-
Generate SSL certificates:
./scripts/setup-ssl.sh
-
Add domain to /etc/hosts:
# macOS/Linux sudo sh -c 'echo "127.0.0.1 growtomiddle.lol" >> /etc/hosts' # Windows: Edit C:\Windows\System32\drivers\etc\hosts # Add: 127.0.0.1 growtomiddle.lol
Create a .env.local file in the root directory with the following variables:
# Database
MONGODB_URI=mongodb://admin:password@mongodb:27017/growtomiddle?authSource=admin
# NextAuth Configuration
NEXTAUTH_URL=https://growtomiddle.lol
NEXTAUTH_SECRET=your-secret-key-here-generate-with-openssl-rand-base64-32
# Google OAuth (for authentication)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Application
NODE_ENV=development
BASE_FETCH_URL=https://growtomiddle.lolTo generate a secure NEXTAUTH_SECRET, run:
openssl rand -base64 32-
Start all services:
docker-compose up -d --build
-
Access services:
- Next.js app: https://growtomiddle.lol (with hot reload)
- Mongo Express (database UI): http://localhost:8081
- Username:
admin - Password:
admin
- Username:
-
View logs:
docker-compose logs -f nextjs
-
Stop services:
docker-compose down
-
Clean slate (remove all data):
docker-compose down -v
- nginx (Ports 80, 443): HTTPS reverse proxy
- nextjs (Port 3000): Next.js application
- mongodb (Port 27017): MongoDB database
- mongo-express (Port 8081): Database management UI
The MongoDB service is configured with:
- Host:
mongodb(within Docker network) orlocalhost(from host) - Port:
27017 - Database:
growtomiddle - Username:
admin - Password:
password
Note: Change the default MongoDB credentials in docker-compose.yml for security.
SSL Certificate Issues:
- Ensure mkcert is installed and local CA is installed:
mkcert -install - Verify certificates exist:
ls -la nginx/ssl/
Domain Not Resolving:
- Check
/etc/hostsincludes127.0.0.1 growtomiddle.lol - Try accessing via
https://localhost(if configured in nginx.conf)
Next.js Build Fails:
- Check Docker logs:
docker-compose logs nextjs - Ensure all environment variables are set in
.env.local