Skip to content

Commit 49fa624

Browse files
authored
refactor: improve monorepo structure with standardized layout (#2087)
1 parent ab50651 commit 49fa624

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+702
-942
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,36 @@ jobs:
4747
- run: bun lint
4848
if: ${{ github.event_name == 'pull_request' }}
4949

50-
- run: bun --filter app build
50+
# Type checking
5151
- run: bun tsc --build
52-
# - run: bun --filter app test
52+
53+
# Testing (commented out - enable as needed)
54+
# - run: bun --filter @repo/web test
55+
# if: ${{ github.event_name == 'pull_request' }}
56+
# - run: bun --filter @repo/api test
5357
# if: ${{ github.event_name == 'pull_request' }}
54-
# - run: bun --filter edge test
58+
# - run: bun --filter @repo/edge test
5559
# if: ${{ github.event_name == 'pull_request' }}
5660

61+
# Build all workspaces
62+
- run: bun --filter @repo/web build
63+
- run: bun --filter @repo/api build
64+
- run: bun --filter @repo/edge build
65+
5766
# Validate Terraform configuration and formatting
5867
- uses: hashicorp/setup-terraform@v3
5968
- run: terraform fmt -check -recursive infra/
6069
# - run: terraform validate infra/environments/preview/
6170

62-
# Compile
63-
- run: bun run build
64-
6571
# Build Docker image (only on main branch pushes or manual triggers)
66-
- run: docker build --tag api:${{ github.sha }} -f ./api/Dockerfile .
72+
- run: docker build --tag api:${{ github.sha }} -f ./apps/api/Dockerfile .
6773
- run: docker save api:${{ github.sha }} | gzip > api-image.tar.gz
6874

6975
# Upload build artifacts
7076
- uses: actions/upload-artifact@v4
7177
with:
7278
name: "build"
73-
path: "app/dist\nedge/dist\napi/dist\napi-image.tar.gz\n"
79+
path: "apps/web/dist\napps/edge/dist\napps/api/dist\napi-image.tar.gz\n"
7480

7581
deploy-preview:
7682
name: "Deploy"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
33

44
# Compiled output
5-
/*/dist/
5+
**/dist/
6+
**/*.tsbuildinfo
67

78
# Bun package manager
89
# https://bun.sh/docs/install/lockfile

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/app/queries/
33
/*/dist/
44
/**/*.generated.ts
5+
/**/*.gen.ts
56

67
# Cache
78
/.cache

CLAUDE.md

Lines changed: 30 additions & 16 deletions

api/Dockerfile renamed to apps/api/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile for the tRPC API Server
2-
# docker build --tag api:latest -f ./api/Dockerfile .
2+
# docker build --tag api:latest -f ./apps/api/Dockerfile .
33
# https://bun.com/guides/ecosystem/docker
44
# https://docs.docker.com/guides/bun/containerize/
55

@@ -16,7 +16,7 @@ ENV NODE_ENV=production
1616
WORKDIR /usr/src/app
1717

1818
# Copy package files for better layer caching
19-
COPY ./api/package.json ./package.json
19+
COPY ./apps/api/package.json ./package.json
2020

2121
# Remove workspace dependencies from package.json
2222
# Workspace dependencies like "workspace:*" or "workspace:^1.0.0" cannot be resolved
@@ -33,7 +33,9 @@ RUN bun install --production
3333

3434
# Copy pre-built server files from dist directory
3535
# The build process should be done outside of Docker
36-
COPY --chown=bun:bun ./api/dist ./dist
36+
# Note: Run `bun --filter @repo/api build` before building the Docker image
37+
# This bundles all dependencies including workspace packages into dist/index.js
38+
COPY --chown=bun:bun ./apps/api/dist ./dist
3739

3840
# Verify dist directory exists and has content
3941
RUN test -f ./dist/index.js || (echo "Error: dist/index.js not found" && exit 1)

api/README.md renamed to apps/api/README.md

Lines changed: 4 additions & 4 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)