Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1053026
refactor(backend): rewrite using `hono` framework
zowks Oct 7, 2026
135527d
refactor: add `GET /clusters/:id/logs`
zowks Oct 7, 2026
4f5046e
refactor(auth): add JWT expiration
zowks Oct 7, 2026
5a875ad
style: organize and sort imports
zowks Oct 7, 2026
7419016
refactor: exceptions
zowks Oct 11, 2026
95bf3fe
refactor: missing `await`
zowks Oct 11, 2026
7c31097
fix(bot): await bot lookup before updating its token
a9ex Oct 11, 2026
26437f7
fix(clusters): keep each cluster status when updating the layout
a9ex Oct 11, 2026
9e74638
fix(clusters): return an empty list when no cluster exists
a9ex Oct 11, 2026
cbb9f7b
fix(clusters): allow stopping every cluster when none exists
a9ex Oct 11, 2026
2eb1399
fix(docker): treat a missing container as already stopped
a9ex Oct 11, 2026
d76cbba
fix(clusters): stop a running cluster before removing it
a9ex Oct 11, 2026
612c2b2
fix(clusters): send logs time bounds to docker in seconds
a9ex Oct 11, 2026
5e85ade
fix(clusters): stream cluster logs over server-sent events
a9ex Oct 11, 2026
9df8456
fix(clusters): persist the bot total shards when updating the layout
a9ex Oct 11, 2026
a80809d
fix(discord): build profile cdn urls with the correct paths
a9ex Oct 11, 2026
34acc5a
build(lint): enable type-aware promise safety rules
a9ex Oct 11, 2026
9af025f
refactor(docker): factor docker engine error handling
a9ex Oct 11, 2026
122d4b6
feat(clusters): implement cluster action and stats handlers
a9ex Oct 11, 2026
334ae22
feat(api): return every error as a json body
a9ex Oct 11, 2026
29b0d44
fix(bot): keep the registry password only for the same registry and user
a9ex Oct 11, 2026
ffdb95d
feat(api): read the port from the environment and enable cors
a9ex Oct 11, 2026
2addc25
fix(bot): accept image names without registry and pull images only wh…
a9ex Oct 11, 2026
787d290
refactor(prisma): store the desired cluster status
a9ex Oct 11, 2026
b877afb
feat(clusters): report the cluster status observed in docker
a9ex Oct 11, 2026
cf4724b
build(backend): bundle the hono server with tsdown for production
a9ex Oct 11, 2026
be337ff
test(backend): add unit tests for the services
a9ex Oct 11, 2026
3d652a9
test(backend): add integration tests against postgres and docker
a9ex Oct 11, 2026
0aab207
ci(backend): check formatting and drop the removed prisma-client path
a9ex Oct 11, 2026
cec8dfd
ci(backend): run unit and integration tests in separate steps
a9ex Oct 11, 2026
cf1aeb3
build(pnpm): pin the exact pnpm version
a9ex Oct 11, 2026
4bca8cd
feat(backend): expose the api schemas and the recommended shards
a9ex Oct 11, 2026
89d7d23
refactor(frontend): align the remote functions with the hono api
a9ex Oct 11, 2026
ad3bc7b
test(backend): cover the discord client, the bot routes and the streams
a9ex Oct 11, 2026
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
10 changes: 6 additions & 4 deletions .github/workflows/backend-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- "docker/backend.Dockerfile"
- "secrets/backend/**"
- "packages/backend/**"
- "packages/prisma-client/**"
- ".github/workflows/backend-ci.yaml"
pull_request:
paths: *backend-paths
Expand Down Expand Up @@ -43,13 +42,16 @@ jobs:
run: pnpm --filter=@hallmaster/backend lint

- name: Run format check
run: pnpm --filter=@hallmaster/backend format
run: pnpm --filter=@hallmaster/backend format:check

- name: Test the build process
run: pnpm --filter=@hallmaster/backend build

- name: Run the tests
run: pnpm --filter=@hallmaster/backend test:cov
- name: Run the unit tests
run: pnpm --filter=@hallmaster/backend test:unit

- name: Run the integration tests
run: pnpm --filter=@hallmaster/backend test:integration

build-and-push:
name: Build and Push Images
Expand Down
20 changes: 5 additions & 15 deletions docker/backend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ COPY package.json \
# Required by pnpm-workspace.yaml `patchedDependencies`
COPY patches/ patches/

# Install packages for Prisma
COPY packages/prisma-client/package.json \
packages/prisma-client/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
--filter=@hallmaster/prisma-client \
--prefer-offline \
--frozen-lockfile

# Install packages for the backend
COPY packages/backend/package.json packages/backend/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
Expand All @@ -38,19 +29,18 @@ COPY packages/backend/prisma/ packages/backend/prisma/
COPY packages/backend/prisma.config.ts packages/backend/
RUN pnpm --filter=@hallmaster/backend prisma:generate

# Build NestJS application
COPY packages/backend/tsconfig.build.json \
packages/backend/tsconfig.json \
packages/backend/nest-cli.json \
# Build Hono application
COPY packages/backend/tsconfig.json \
packages/backend/tsdown.config.ts \
packages/backend/
COPY packages/backend/src/ packages/backend/src/
RUN pnpm --filter=@hallmaster/backend build

# Cleanup the application
RUN rm -rf packages/backend/src \
packages/backend/tsconfig.json \
packages/backend/tsconfig.build.json \
packages/backend/nest-cli.json
packages/backend/tsdown.config.ts \
packages/backend/prisma/generated

# Create the application package
RUN pnpm deploy --filter=@hallmaster/backend --prod --legacy /prod-app
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"packageManager": {
"name": "pnpm",
"version": "^12.6.0"
"version": "12.6.0"
}
},
"devDependencies": {
Expand Down
14 changes: 4 additions & 10 deletions packages/backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
DISCORD_BOT_TOKEN_ENV_NAME=DISCORD_BOT_TOKEN
TOTAL_SHARDS_ENV_NAME=TOTAL_SHARDS
SHARD_ID_LIST_ENV_NAME=SHARD_ID_LIST
DATABASE_URL="postgres://postgres:postgres@localhost:51214/template1?sslmode=disable&connection_limit=10&connect_timeout=0&max_idle_connection_lifetime=0&pool_timeout=0&socket_timeout=0"

DATABASE_URL=postgresql://pguser:pgpassword@hallmaster-postgres:5432/hallmaster
# openssl rand -base64 32
SECRET="change_me"

# python3 -c "import random,string;print(''.join([random.choice(string.hexdigits[:16]) for _ in range(32)]))"
JWT_SECRET=XXX
JWT_EXPIRES_IN=12h # 15m, 1d, ...

# This enables logging of all incoming requests
# LOG_REQUESTS=true
PORT=3000
74 changes: 25 additions & 49 deletions packages/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,34 @@
# compiled output
/dist
/node_modules
/build
# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/

# env
.env
.env.production

# Logs
logs
# logs
logs/
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# OS
# misc
.DS_Store
dist/
coverage/
/.alchemy
/.prisma-composer

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# temp directory
.temp
.tmp

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

/generated
prisma/generated/
5 changes: 5 additions & 0 deletions packages/backend/.oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": [],
"sortImports": true
}
29 changes: 29 additions & 0 deletions packages/backend/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "oxc"],
"categories": {
"correctness": "error"
},
"rules": {
"typescript/await-thenable": "error",
"typescript/no-floating-promises": "error",
"typescript/no-misused-promises": "error",
"typescript/no-unnecessary-condition": "error",
"typescript/require-await": "error"
},
"env": {
"builtin": true
},
"options": {
"typeAware": true,
"typeCheck": true
},
"overrides": [
{
"files": ["tests/**/*.ts"],
"rules": {
"typescript/unbound-method": "off"
}
}
]
}
4 changes: 0 additions & 4 deletions packages/backend/.prettierrc

This file was deleted.

3 changes: 0 additions & 3 deletions packages/backend/README.md

This file was deleted.

67 changes: 0 additions & 67 deletions packages/backend/eslint.config.ts

This file was deleted.

42 changes: 0 additions & 42 deletions packages/backend/jest.config.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/backend/nest-cli.json

This file was deleted.

Loading
Loading