Tips and tricks

Here is your content formatted cleanly for a WordPress Gutenberg post (with headings, code blocks, and proper formatting):
π How to Host FE + BE on a Mac Mini with Caddy (Auto SSL)
This setup will:
- Route
zoomitthemes.go.ro/api/*β Backend (port 5437) - Route
zoomitthemes.go.ro/*β Frontend (port 3000) - Automatically generate Letβs Encrypt SSL certificates
1οΈβ£ Install Caddy on the Mac Mini
Add a Code block in Gutenberg:
brew install caddy
2οΈβ£ Create the Caddyfile
Create the file:
/opt/homebrew/etc/Caddyfile
Add this configuration:
zoomitthemes.go.ro {
handle /api/* {
reverse_proxy localhost:5437
} handle {
reverse_proxy localhost:3000
}
}
π What This Does
zoomitthemes.go.ro/api/*β Backend on port 5437zoomitthemes.go.ro/*β Frontend on port 3000
3οΈβ£ Port Forward on Your Router
Forward the following ports (TCP) to your Mac Mini local IP address:
- 80
- 443
This allows Caddy to:
- Receive public traffic
- Automatically generate SSL certificates
4οΈβ£ Start Caddy
Option A β Run Manually
sudo caddy run --config /opt/homebrew/etc/Caddyfile
Option B β Run as a Service (Recommended)
brew services start caddy
5οΈβ£ Run Your Applications
π₯ Terminal 1 β Backend
cd yourname-be
npm start
π Terminal 2 β Frontend
cd yourname-fe
npm start
π Automatic SSL
Caddy will automatically request and install Letβs Encrypt SSL certificates the first time someone accesses your domain.
No manual certificate configuration required.
β οΈ Important: Handle the /api Prefix
Your backend must either:
Option A β Handle /api routes directly
OR
Option B β Strip /api in Caddy (Recommended)
Update your Caddyfile like this:
zoomitthemes.go.ro { handle /api/* {
uri strip_prefix /api
reverse_proxy localhost:5437
} handle {
reverse_proxy localhost:3000
}
}
β Result
- Public request: https://zoomitthemes.go.ro/api/agents
- Internally becomes: http://localhost:5437/agents
Cleaner backend routes, no /api prefix needed in your Node app.
β Final Architecture
Internet
β
Caddy (Mac Mini)
β
βββ FE β localhost:3000
βββ BE β localhost:5437
Run MySQL on Mac Mini with Docker Compose (Full Stack Setup)
This guide shows how to run MySQL using Docker Compose on your Mac Mini and connect it to your Backend + Frontend stack.
1οΈβ£ Create docker-compose.yml
In your project root, create a file named:
docker-compose.yml
Add the following configuration:
services:
db:
image: mysql:8
container_name: yourname-db
restart: unless-stopped
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
MYSQL_DATABASE: yourname
MYSQL_USER: yourname
MYSQL_PASSWORD: yourname
volumes:
- mysql_data:/var/lib/mysqlvolumes:
mysql_data:
2οΈβ£ Start MySQL on Your Mac Mini
Run:
docker compose up -d
This will:
- Pull MySQL 8 image
- Start the container
- Create a persistent Docker volume (
mysql_data) - Expose MySQL on port 3306
3οΈβ£ Run Database Migrations
npm run migrate
4οΈβ£ Start the Backend
npm start
Your backend should now connect to:
localhost:3306
πΎ Data Persistence
Your MySQL data is stored inside a Docker volume:
mysql_data
This means:
- β Data survives container restarts
- β Data survives system reboots
- β Data is removed only if you manually delete the volume
π§© Full Stack Running on Mac Mini
βββββββββββ¬βββββββββ¬ββββββββββββββββββββββββββββ
β Service β Port β Command β
βββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β MySQL β 3306 β docker compose up -d β
βββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β BE β 5437 β npm start β
βββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β FE β 3000 β npm start (in FE folder) β
βββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β Caddy β 80/443 β brew services start caddy β
βββββββββββ΄βββββββββ΄ββββββββββββββββββββββββββββ
π Your .env Configuration
Your environment file remains the same:
DATABASE_URL=mysql://yourname:yourname@localhost:3306/yourname
π Final Architecture on Mac Mini
Internet
β
Caddy (80/443)
β
Frontend (3000)
β
Backend (5437)
β
MySQL Docker (3306)
β
Docker Volume (mysql_data)
Recent Comments
- admin on Disable Windows 11 Autoupdate
- Christina on Disable Windows 11 Autoupdate
- admin on Vimeo Thumbnail Generator
- Robert Moeck on Vimeo Thumbnail Generator
- Rainer on Vimeo Thumbnail Generator