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
10 changes: 5 additions & 5 deletions .claude/rules/build-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,19 @@ bundle exec fastlane ios testflight_deploy # Deploy to TestFlight

```bash
# Initialize Terraform
mise //apps/infra/gcp:init
mise //apps/infra:gcp:init

# Preview changes
mise //apps/infra/gcp:plan
mise //apps/infra:gcp:plan

# Apply changes
mise //apps/infra/gcp:apply
mise //apps/infra:gcp:apply

# Preview production changes
mise //apps/infra/gcp:plan:prod
mise //apps/infra:gcp:plan:prod

# Apply production changes
mise //apps/infra/gcp:apply:prod
mise //apps/infra:gcp:apply:prod
```

### i18n (packages/i18n)
Expand Down
10 changes: 5 additions & 5 deletions .cursor/rules/build-guide.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,19 @@ bundle exec fastlane ios testflight_deploy # Deploy to TestFlight

```bash
# Initialize Terraform
mise //apps/infra/gcp:init
mise //apps/infra:gcp:init

# Preview changes
mise //apps/infra/gcp:plan
mise //apps/infra:gcp:plan

# Apply changes
mise //apps/infra/gcp:apply
mise //apps/infra:gcp:apply

# Preview production changes
mise //apps/infra/gcp:plan:prod
mise //apps/infra:gcp:plan:prod

# Apply production changes
mise //apps/infra/gcp:apply:prod
mise //apps/infra:gcp:apply:prod
```

### i18n (packages/i18n)
Expand Down
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.git
.agents
.serena
.cursor
.claude
.codex
.gemini
.github
.opencode
.qwen
.vscode
apps/mobile
apps/infra
**/.venv
**/node_modules
**/.next
**/.dart_tool
**/__pycache__
**/.ruff_cache
**/.pytest_cache
**/.coverage
**/.terraform
**/.monodep
*.md
docs
15 changes: 9 additions & 6 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
branches: [main]
paths:
- "apps/api/**"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/deploy-api.yml"
workflow_dispatch:

Expand All @@ -34,9 +36,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/api

steps:
- uses: actions/checkout@v6
Expand All @@ -46,21 +45,24 @@ jobs:
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "apps/api/uv.lock"
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --frozen
run: uv sync --frozen --package api

- name: Run linter
working-directory: apps/api
run: uv run ruff check .

- name: Run type checker
working-directory: apps/api
run: uv run mypy src

- name: Run tests
working-directory: apps/api
run: uv run pytest

build-and-deploy:
Expand Down Expand Up @@ -88,7 +90,8 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: apps/api
context: .
file: apps/api/Dockerfile
push: true
tags: ${{ env.IMAGE }}:${{ github.sha }}
cache-from: type=gha,scope=fullstack-starter-api
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
branches: [main]
paths:
- "apps/web/**"
- "package.json"
- "bun.lock"
- ".github/workflows/deploy-web.yml"
workflow_dispatch:

Expand All @@ -36,9 +38,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/web

steps:
- uses: actions/checkout@v6
Expand All @@ -52,12 +51,15 @@ jobs:
run: bun install --frozen-lockfile

- name: Run linter
working-directory: apps/web
run: bun run lint

- name: Run type check
working-directory: apps/web
run: bun run typecheck

- name: Run tests
working-directory: apps/web
run: bun run test

build-and-deploy:
Expand Down Expand Up @@ -85,7 +87,8 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: apps/web
context: .
file: apps/web/Dockerfile
push: true
tags: ${{ env.IMAGE }}:${{ github.sha }}
build-args: |
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/deploy-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
branches: [main]
paths:
- "apps/worker/**"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/deploy-worker.yml"
workflow_dispatch:

Expand All @@ -34,9 +36,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/worker

steps:
- uses: actions/checkout@v6
Expand All @@ -46,21 +45,24 @@ jobs:
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "apps/worker/uv.lock"
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --frozen
run: uv sync --frozen --package worker

- name: Run linter
working-directory: apps/worker
run: uv run ruff check .

- name: Run type checker
working-directory: apps/worker
run: uv run mypy src

- name: Run tests
working-directory: apps/worker
run: uv run pytest

build-and-deploy:
Expand Down Expand Up @@ -88,7 +90,8 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: apps/worker
context: .
file: apps/worker/Dockerfile
push: true
tags: ${{ env.IMAGE }}:${{ github.sha }}
cache-from: type=gha,scope=fullstack-starter-worker
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jobs:
bun-version: latest

- name: Install dependencies
working-directory: apps/web
run: bun install --frozen-lockfile

- uses: reviewdog/action-setup@v1
Expand Down Expand Up @@ -112,7 +111,7 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: apps/api
run: |
uv sync --frozen
uv sync --frozen --package api
uv run ruff check --output-format=json . 2>&1 | \
jq -r '.[] | {
message: .message,
Expand All @@ -133,7 +132,7 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: apps/worker
run: |
uv sync --frozen
uv sync --frozen --package worker
uv run ruff check --output-format=json . 2>&1 | \
jq -r '.[] | {
message: .message,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dependencies
node_modules/
.monodep/
__pycache__/
*.pyc
.venv/
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ mise dev

```
fullstack-starter/
├── package.json # bun workspace (apps/web, packages/*)
├── pyproject.toml # uv workspace (apps/api, apps/worker)
├── apps/
│ ├── api/ # FastAPI backend
│ ├── web/ # Next.js frontend
Expand Down Expand Up @@ -314,11 +316,11 @@ mise tasks --all

| Command | Description |
|---------|-------------|
| `mise //apps/infra/gcp:init` | Initialize Terraform |
| `mise //apps/infra/gcp:plan` | Preview changes |
| `mise //apps/infra/gcp:apply` | Apply changes |
| `mise //apps/infra/gcp:plan:prod` | Preview production |
| `mise //apps/infra/gcp:apply:prod` | Apply production |
| `mise //apps/infra:gcp:init` | Initialize Terraform |
| `mise //apps/infra:gcp:plan` | Preview changes |
| `mise //apps/infra:gcp:apply` | Apply changes |
| `mise //apps/infra:gcp:plan:prod` | Preview production |
| `mise //apps/infra:gcp:apply:prod` | Apply production |

</details>

Expand Down Expand Up @@ -438,9 +440,8 @@ Push to `main` branch triggers automatic deployment:
### Manual Deployment

```bash
# Build and push Docker images
cd apps/api
docker build -t gcr.io/PROJECT_ID/api .
# Build and push Docker images from the repository root
docker build -f apps/api/Dockerfile -t gcr.io/PROJECT_ID/api .
docker push gcr.io/PROJECT_ID/api

# Deploy to Cloud Run
Expand Down
23 changes: 10 additions & 13 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,25 @@ ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Production stage
FROM base AS production

# Copy dependency files
COPY pyproject.toml uv.lock ./
COPY apps/api/pyproject.toml ./apps/api/pyproject.toml
COPY apps/worker/pyproject.toml ./apps/worker/pyproject.toml

# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-install-project
uv sync --frozen --no-dev --package api --no-install-workspace

# Copy application code
COPY src ./src
COPY alembic ./alembic
COPY alembic.ini .
COPY apps/api/src ./apps/api/src
COPY apps/api/alembic ./apps/api/alembic
COPY apps/api/alembic.ini ./apps/api/alembic.ini

# Create non-root user
RUN useradd --create-home --shell /bin/bash appuser
USER appuser
RUN useradd --create-home --shell /bin/bash --uid 1000 appuser
USER 1000

WORKDIR /app/apps/api
EXPOSE 8000

CMD ["uv", "run", "fastapi", "run", "src/main.py", "--port", "8000"]
CMD ["uv", "run", "--project", "/app", "fastapi", "run", "src/main.py", "--port", "8000"]
2 changes: 1 addition & 1 deletion apps/api/mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tasks]
dev = { run = "uv run poe dev", description = "Start API server" }
install = { run = "uv sync", description = "Install dependencies", sources = ["pyproject.toml", "uv.lock"] }
install = { run = "uv sync --all-packages", description = "Install dependencies", sources = ["pyproject.toml", "../../pyproject.toml", "../../uv.lock"] }
lint = { run = "uv run poe lint", description = "Lint API" }
format = { run = "uv run poe format", description = "Format API" }
test = { run = "uv run poe test", description = "Test API" }
Expand Down
Loading
Loading