Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**/node_modules
**/dist
**/build
**/.turbo
**/.cache
**/coverage
**/.next

.git
.github
.vscode
.idea

legacy
docker-compose*.yml
Dockerfile
.dockerignore

**/.env
**/.env.*
!**/.env.example

**/*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Host port mapped to the container (container always listens on 3000).
PORT=3000

# HTTP Basic auth for the /api/qris/* endpoints. Leave BOTH empty to keep the
# API open; set BOTH to require credentials. (Named API_* on purpose — plain
# USERNAME/PASSWORD collide with built-in shell/Windows env vars.)
# Note: the web client (served from the same origin) is exempt and works
# without any login prompt; only direct API access (curl/Postman/other origins)
# is challenged for these credentials.
API_USERNAME=
API_PASSWORD=
# Optional: override the API base URL used by the client at build time.
# Leave empty in production (the Hono server serves both the client and the API).
# VITE_SERVER_URL=http://localhost:3000
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: stevedylandev
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# bhvr/.gitignore
# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# production
dist
build

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.env*.local

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# editor directories and files
.idea
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Bun
bun.lockb

# Turbo
.turbo
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing to create-bhvr

First off, thank you for considering contributing to `bhvr`! This is a true open source project and we welcome community ideas and contributions. In order to keep things clean please follow the contributing guidelines below.

## How Can I Contribute?

### Reporting Bugs

If you find a bug, please make sure the bug has not already been reported by searching on GitHub under [Issues](https://github.com/stevedylandev/bhvr/issues). If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/stevedylandev/bhvr/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.

### Suggesting Enhancements

If you have an idea for an enhancement, please make sure the enhancement has not already been suggested by searching on GitHub under [Issues](https://github.com/stevedylandev/bhvr/issues). If you're unable to find an open issue addressing the suggestion, [open a new one](https://github.com/stevedylandev/bhvr/issues/new). Be sure to include a **title and clear description** of the enhancement you're suggesting.

### Submitting a Pull Request

1. Fork the repository and create your branch from `main`.
2. Run `bun install` to install the dependencies.
3. Make your changes.
4. Run `bun run build` to make sure your changes build correctly.
5. Issue that pull request!

## License

By contributing, you agree that your contributions will be licensed under its MIT License.
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# syntax=docker/dockerfile:1.7

# ---- Builder: install all workspaces and build client + server + shared ----
FROM oven/bun:1.2-alpine AS builder
WORKDIR /app

# Copy workspace manifests first so dep-install can cache.
COPY package.json bun.lock tsconfig.json turbo.json ./
COPY shared/package.json ./shared/
COPY server/package.json ./server/
COPY client/package.json ./client/

# Install all deps. Skip lifecycle scripts because the root postinstall runs
# `turbo build --filter=shared --filter=server`, which needs source files that
# are not in the image yet.
RUN bun install --ignore-scripts

# Copy the rest of the sources, then run the full build once.
COPY shared ./shared
COPY server ./server
COPY client ./client
RUN bun run build

# ---- Runner: minimal image that boots the Hono server ----
FROM oven/bun:1.2-alpine AS runner
WORKDIR /app

ENV NODE_ENV=production \
PORT=3000 \
CLIENT_DIST_DIR=/app/public

# Hop the built artefacts and resolved node_modules out of the builder.
COPY --from=builder /app/package.json /app/bun.lock ./
COPY --from=builder /app/shared/package.json ./shared/
COPY --from=builder /app/server/package.json ./server/
COPY --from=builder /app/shared/dist ./shared/dist
COPY --from=builder /app/server/dist ./server/dist
COPY --from=builder /app/client/dist ./public
COPY --from=builder /app/node_modules ./node_modules

EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -q -O - http://127.0.0.1:${PORT}/healthz || exit 1

# Drop privileges; the oven/bun image ships a non-root "bun" user.
USER bun
CMD ["bun", "run", "server/dist/index.js"]
Loading