Skip to content
Merged
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
19 changes: 5 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
.git
node_modules
test-results
safe-artifacts
playwright-report
blob-report
coverage
build
.env
.env.*
.yarn/*
!.yarn/releases
.codex
.agents
*
!build/
!build/**
!deploy/
!deploy/Caddyfile
117 changes: 117 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: EPOCA frontend
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: frontend-${{ github.head_ref || github.ref_name }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
frontend:
name: Frontend checks and image
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version-file: .nvmrc
- run: node .yarn/releases/yarn-4.18.0.cjs install --immutable
- run: node .yarn/releases/yarn-4.18.0.cjs typecheck
- run: node .yarn/releases/yarn-4.18.0.cjs lint
- run: node .yarn/releases/yarn-4.18.0.cjs test --maxWorkers=2
- name: Build public demo
env:
VITE_DEMO_ENABLED: 'true'
VITE_API_BASE_URL: /api/v1
run: node .yarn/releases/yarn-4.18.0.cjs vite build --base=/
- name: Build and smoke test image
run: |
docker build -f Dockerfile.demo -t epoca-frontend:ci .
docker run -d --name epoca-web-ci -p 8080:8080 --memory 64m --pids-limit 64 --read-only --tmpfs /tmp:rw,noexec,nosuid,size=32m epoca-frontend:ci
for attempt in $(seq 1 20); do
if curl --fail --silent http://localhost:8080/working-time | grep -q '<title>Epoca</title>'; then exit 0; fi
sleep 1
done
exit 1
- run: docker save epoca-frontend:ci -o /tmp/epoca-frontend.tar
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: frontend-image
path: /tmp/epoca-frontend.tar
retention-days: 2

secrets:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
persist-credentials: false
- name: Scan Git history for secrets
run: |
set -euo pipefail
archive="$RUNNER_TEMP/gitleaks_8.30.1_linux_x64.tar.gz"
curl --fail --silent --show-error --location --output "$archive" https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
printf '551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb %s\n' "$archive" | sha256sum --check
tar --extract --gzip --file "$archive" --directory "$RUNNER_TEMP" gitleaks
"$RUNNER_TEMP/gitleaks" git . --log-opts='--all --full-history -m' --redact --no-banner

publish:
needs: [frontend, secrets]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
packages: write
outputs:
web: ${{ steps.push.outputs.web }}
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
name: frontend-image
path: ${{ runner.temp }}
- id: push
env:
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
trap 'docker logout ghcr.io >/dev/null' EXIT
printf '%s' "$REGISTRY_TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
docker load -i "$RUNNER_TEMP/epoca-frontend.tar"
image="ghcr.io/bartkozik/epoca-frontend:sha-$GITHUB_SHA"
docker tag epoca-frontend:ci "$image"
docker push "$image"
reference=$(docker image inspect --format '{{index .RepoDigests 0}}' "$image")
digest=${reference##*@}
[[ "$digest" =~ ^sha256:[a-f0-9]{64}$ ]]
printf 'web=%s\n' "$digest" >> "$GITHUB_OUTPUT"

deploy:
needs: publish
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.PRODUCTION_ENABLED == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 12
environment:
name: production
url: https://epoca.kozikowski.it
concurrency:
group: epoca-production
cancel-in-progress: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Deploy tested images
env:
WEB_DIGEST: ${{ needs.publish.outputs.web }}
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
run: bash scripts/deploy-demo.sh
2 changes: 2 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
41df6a20a7c3d647294ca367fa4457aba7be99a8:src/modules/teamSettings/members/invitations/requests.test.ts:generic-api-key:7
41df6a20a7c3d647294ca367fa4457aba7be99a8:tests/e2e/live/metadata.contract.spec.ts:generic-api-key:62
9 changes: 9 additions & 0 deletions Dockerfile.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ghcr.io/bartkozik/portfolio-infra@sha256:1a23c66865a1e81113270900934e615f34bd8a05be409a6a7ddd5272d46bd35d
COPY build/ /srv/
RUN mkdir -p /srv/assets && printf '%s\n' 'window.env = {};' > /srv/assets/env.js
COPY deploy/Caddyfile /etc/caddy/Caddyfile
ENV XDG_CONFIG_HOME=/tmp/config XDG_DATA_HOME=/tmp/data
USER 1000:1000
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O /dev/null http://127.0.0.1:8080/ || exit 1
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ The retained Playwright suite contains mock, controlled integration and live/rel
Original Git history, private CI/deployment configuration, environment values and internal operational notes are excluded. Non-public endpoint/identity literals were anonymized. Imported account/onboarding screenshot assets were replaced with a neutral “Image removed for privacy” resource; application structure and workflows remain intact. Existing test fixtures were retained where synthetic, with identity literals sanitized consistently.

Application names and source attribution are preserved. This snapshot does not include a new project-wide license or claim ownership of third-party resources. Deployment infrastructure, real accounts and client data are not included.

## Public demo

The demo build enables `VITE_DEMO_ENABLED=true` and uses the [EPOCA guest gateway](https://github.com/bartkozik/epoca-backend/tree/main/demo) on the same origin. Visitors can open a temporary workspace, follow a short guide and reset the sample data. The normal application build retains its existing authentication flow.

GitHub Actions checks types, lint, tests and the built container before publishing its image. The demo container serves static assets as an unprivileged user; database credentials and signing keys are never included in the frontend. Deployment configuration lives in [portfolio-infra](https://github.com/bartkozik/portfolio-infra).
15 changes: 15 additions & 0 deletions deploy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
admin off
auto_https off
}
:8080 {
root * /srv
encode zstd gzip
@assets path /static/*
header @assets Cache-Control "public, max-age=31536000, immutable"
@html not path /static/*
header @html Cache-Control "no-cache"
header X-Robots-Tag "noindex, nofollow"
try_files {path} /index.html
file_server
}
15 changes: 15 additions & 0 deletions scripts/deploy-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
umask 077
[[ ${WEB_DIGEST-} =~ ^sha256:[a-f0-9]{64}$ ]]
[[ ${DEPLOY_HOST-} =~ ^[a-zA-Z0-9.-]+$ ]]
[[ -n ${DEPLOY_SSH_KEY-} && -n ${DEPLOY_KNOWN_HOSTS-} ]]
task_dir=$(mktemp -d)
trap 'rm -rf "$task_dir"' EXIT
printf '%s\n' "$DEPLOY_SSH_KEY" > "$task_dir/key"
printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$task_dir/known_hosts"
unset DEPLOY_SSH_KEY DEPLOY_KNOWN_HOSTS
ssh -i "$task_dir/key" -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes \
-o "UserKnownHostsFile=$task_dir/known_hosts" -o ConnectTimeout=15 \
"epoca-deploy@$DEPLOY_HOST" "deploy web $WEB_DIGEST"
curl --fail --silent --show-error --retry 3 https://epoca.kozikowski.it/api/demo/health
10 changes: 9 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { DemoShell } from '@/app/demo/DemoShell';
import { isDemo } from '@/core/config/demo';
import Router from '@/app/routing/Router';
import { queryClient, saveDeviceId } from '@/core/api';
import Toasts, { ToastProvider } from '@/core/providers/toastProvider';
Expand Down Expand Up @@ -49,7 +51,13 @@ function App(): JSX.Element {
<QueryClientProvider client={queryClient}>
<ToastProvider>
<AuthProvider>
<SessionProviders />
{isDemo ? (
<DemoShell>
<SessionProviders />
</DemoShell>
) : (
<SessionProviders />
)}
</AuthProvider>
</ToastProvider>
</QueryClientProvider>
Expand Down
21 changes: 21 additions & 0 deletions src/app/demo/DemoGuide.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styles from './DemoShell.module.scss';

export function DemoGuide(): JSX.Element {
return (
<ol className={styles.guide}>
<li>
<strong>Log your time.</strong> Open Working time, add an entry, choose a project and edit its duration.
</li>
<li>
<strong>Explore the workspace.</strong> Browse fictional clients and projects, or create your own.
</li>
<li>
<strong>Read the reports.</strong> Compare time by person, client or project using the seeded team activity.
</li>
<li>
<strong>Start fresh.</strong> Reset demo restores a new sample workspace, without changing another visitor’s
data.
</li>
</ol>
);
}
86 changes: 86 additions & 0 deletions src/app/demo/DemoShell.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
@use 'core/theme/common-colors' as colors;

.welcome {
min-height: 100dvh;
display: grid;
place-items: center;
padding: 24px;
background: colors.$color-primary-lightest;
}

.panel {
width: min(100%, 720px);
padding: clamp(24px, 5vw, 48px);
border: 1px solid colors.$color-border;
border-radius: 16px;
background: colors.$color-white;
color: colors.$color-font-heading;
line-height: 1.6;

h1,
h2 {
margin-bottom: 16px;
}
h1 {
font-size: clamp(28px, 4vw, 40px);
line-height: 1.2;
}
p {
margin-bottom: 16px;
}
a {
color: colors.$color-primary-dark;
text-decoration: underline;
}
}

.eyebrow {
color: colors.$color-primary-dark;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
}

.guide {
padding-left: 24px;
margin: 24px 0;
list-style: decimal;
li {
padding: 6px 0;
}
}

.banner {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
padding: 12px 24px;
background: colors.$color-primary-lightest;
border-bottom: 1px solid colors.$color-border;
color: colors.$color-primary-dark;
font-size: 14px;
a {
color: inherit;
text-decoration: underline;
}
}

.actions {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
}

.notice {
padding: 24px;
text-align: center;
}

@media print {
.banner {
display: none;
}
}
Loading
Loading