Full-stack app with Vue 3 (Vite) frontend and Go (Gin) backend with SQLite. The server serves the built frontend from server/dist and exposes REST + SSE endpoints.
- Frontend build: Vite outputs to
dist/at project root during CI. - Server static files:
server/main.goserves from./distrelative to the server working dir. - Context loader:
server/services/context_loader.goreads../src/pagesto enrich AI prompts. - Database: SQLite file path from
DB_PATH(default./adrian.db, relative to server working dir).
- Install deps
npm install- Run dev (frontend + server)
npm run dev- Build locally
npm run buildThe build will produce dist/ and a server-binary for local runs. The Docker build uses a separate multi-stage process (below).
A root-level multi-stage Dockerfile builds the frontend and the Go server (with CGO for SQLite) and arranges runtime paths:
dist/is copied to/app/server/distsoserver/main.gocan serve it.src/pages/is copied to/app/src/pagesso the context loader can read../src/pagesfrom the server working directory (/app/server).- Default envs are set but can be overridden at runtime.
docker build -t playground:latest .
# Persist DB under ./data on the host; the container will use /data/adrian.db
docker run --rm -p 8080:8080 \
-e ENV=production \
-e PORT=8080 \
-e DB_PATH=/data/adrian.db \
-e OPENAI_API_KEY=your_key_optional \
-v $(pwd)/data:/data \
playground:latestOpen http://localhost:8080 and test GET /api/coffee.
Coolify’s default Nixpacks won’t install Go for this mixed project. Use the provided Dockerfile.
- Create Application in Coolify
- Repository: Connect this repo
- Build:
- Build Type: Docker
- Dockerfile Path:
Dockerfile - Build Context:
.
- Environment variables:
ENV=productionPORT=8080DB_PATH=/data/adrian.db(recommended for persistence)OPENAI_API_KEY=<your-key>(optional; enables AI chat/image)- Optional tuning:
DB_MAX_OPEN_CONNS,DB_MAX_IDLE_CONNS
- Ports:
- Exposed:
8080
- Exposed:
- Volumes:
- Mount a persistent volume to
/data(e.g.playground-data:/data)
- Mount a persistent volume to
Deploy. Coolify will build the multi-stage image and run the server.
.envfile is optional in containers.server/config/config.goprefers process env and does not fail if.envis absent.- Static assets are served from
server/distby these routes inserver/main.go:r.StaticFS("/assets", http.Dir(filepath.Join(".", "dist", "assets")))r.StaticFile("/favicon.png", filepath.Join(".", "dist", "favicon.png"))r.StaticFile("/profile-2.jpg", filepath.Join(".", "dist", "profile-2.jpg"))r.StaticFile("/interview-prompt.png", filepath.Join(".", "dist", "interview-prompt.png"))r.StaticFile("/manifest.json", filepath.Join(".", "dist", "manifest.json"))
- Client-side routing is handled by the catch-all
NoRouteto serveindex.htmlfor non-/apipaths. - SSE streaming for
/api/chat/messageworks behind Coolify’s proxy as standard HTTP; no special config is required.
GET /api/coffeePOST /api/coffee/incrementPOST /api/chat/message(SSE streaming)POST /api/chat/generate-image(requiresOPENAI_API_KEY)
- If you see DB errors on restarts, ensure
DB_PATHpoints to/data/adrian.dband/datais a persistent volume. - If the UI 404s on refresh, confirm the built
dist/is present under/app/server/distin the container (the Dockerfile handles this).