Skip to content

Commit 271ad8d

Browse files
committed
feat: update tech stack latest (node, pnpm, react, next, etc)
1 parent 439fa99 commit 271ad8d

24 files changed

Lines changed: 1779 additions & 4981 deletions

.dockerignore

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules
33

44
# next.js
55
.next
6+
out
67

78
# vercel
89
.vercel
@@ -15,14 +16,27 @@ node_modules
1516
npm-debug.log*
1617
yarn-debug.log*
1718
yarn-error.log*
19+
pnpm-debug.log*
1820

1921
# local env files
20-
.env.local
21-
.env.development.local
22-
.env.test.local
23-
.env.production.local
22+
.env*.local
2423

25-
# docker file
24+
# docker files
2625
Dockerfile
2726
docker-compose.yml
2827
kubernetes-deployment.yml
28+
29+
# git
30+
.git
31+
.gitignore
32+
33+
# IDE
34+
.vscode
35+
.idea
36+
37+
# testing
38+
coverage
39+
40+
# docs
41+
README.md
42+
CLAUDE.md

.eslintrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 70 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,89 @@
1-
# This is a basic workflow to help you get started with Actions
1+
name: CI/CD Pipeline
22

3-
name: CI to Docker Hub
4-
5-
# Controls when the action will run.
63
on:
7-
# Triggers the workflow on push or pull request events but only for the main branch
84
push:
9-
branches: [ main ]
5+
branches: [main]
106
pull_request:
11-
branches: [ main ]
12-
13-
# Allows you to run this workflow manually from the Actions tab
7+
branches: [main]
148
workflow_dispatch:
159

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1710
jobs:
18-
# This workflow contains a single job called "build"
19-
build:
20-
# The type of runner that the job will run on
11+
lint-and-test:
2112
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
2216

23-
# Steps represent a sequence of tasks that will be executed as part of the job
17+
- name: Setup pnpm
18+
uses: pnpm/action-setup@v4
19+
with:
20+
version: 9
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '22'
26+
cache: 'pnpm'
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Run Biome checks
32+
run: pnpm lint
33+
34+
- name: Type check
35+
run: pnpm type-check
36+
37+
- name: Run tests
38+
run: pnpm test
39+
40+
build:
41+
runs-on: ubuntu-latest
42+
needs: lint-and-test
2443
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26-
- name: Check Out Repo
27-
uses: actions/checkout@v2.3.4
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Setup pnpm
48+
uses: pnpm/action-setup@v4
49+
with:
50+
version: 9
2851

29-
# Set up cache for the builder
30-
- name: Cache Docker layers
31-
uses: actions/cache@v2.1.4
52+
- name: Setup Node.js
53+
uses: actions/setup-node@v4
3254
with:
33-
path: /tmp/.buildx-cache
34-
key: ${{ runner.os }}-buildx-${{ github.sha }}
35-
restore-keys: |
36-
${{ runner.os }}-buildx-
37-
38-
# Login to docker
39-
- name: Docker Login
40-
uses: docker/login-action@v1.8.0
55+
node-version: '22'
56+
cache: 'pnpm'
57+
58+
- name: Install dependencies
59+
run: pnpm install --frozen-lockfile
60+
61+
- name: Build application
62+
run: pnpm build
63+
64+
docker:
65+
runs-on: ubuntu-latest
66+
needs: build
67+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Login to Docker Hub
76+
uses: docker/login-action@v3
4177
with:
4278
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4379
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4480

45-
# Set up docker buildx
46-
- name: Docker Setup Buildx
47-
uses: docker/setup-buildx-action@v1.1.1
48-
49-
# Build and push docker images
50-
- name: Build and push Docker images
51-
uses: docker/build-push-action@v2.3.0
81+
- name: Build and push Docker image
82+
uses: docker/build-push-action@v6
5283
with:
53-
context: ./
84+
context: .
5485
file: ./Dockerfile
55-
builder: ${{ steps.buildx.outputs.name }}
5686
push: true
57-
tags: danangekal/next-typescript-pwa-starter:latest
58-
cache-from: type=local,src=/tmp/.buildx-cache
59-
cache-to: type=local,dest=/tmp/.buildx-cache
60-
61-
- name: Image digest
62-
run: echo ${{ steps.docker_build.outputs.digest }}
87+
tags: danangekal/next-typescript-pwa-starter:latest
88+
cache-from: type=gha
89+
cache-to: type=gha,mode=max

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx lint-staged
1+
pnpm lint-staged

.husky/prepare-commit-msg

Lines changed: 0 additions & 4 deletions
This file was deleted.

.lintstagedrc.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"*.{css,scss,json,md,html}": "prettier --ignore-path .gitignore --write",
3-
"*.{js,ts,tsx}": [
4-
"prettier --ignore-path .gitignore --write",
5-
"eslint --ignore-path .gitignore --quiet --fix"
6-
]
2+
"*": "biome check --no-errors-on-unmatched --files-ignore-unknown=true"
73
}

.prettierrc.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

CLAUDE.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Next.js 15 + React 19 + TypeScript + PWA starter template with strict TypeScript configuration and Biome for code quality.
8+
9+
**Key Technologies:**
10+
- Next.js 15.5.4 (Pages Router) with Turbopack
11+
- React 19.2.0
12+
- TypeScript 5.7 with strict mode enabled
13+
- Serwist (successor to next-pwa) for Progressive Web App functionality
14+
- Biome for linting and formatting
15+
- pnpm for package management
16+
17+
## Common Commands
18+
19+
### Development
20+
```bash
21+
pnpm dev # Start development server with Turbopack (PWA disabled in dev)
22+
pnpm type-check # Run TypeScript type checking without emitting files
23+
pnpm type-check:watch # Run TypeScript type checking in watch mode
24+
pnpm lint # Run Biome lint checks on the codebase
25+
pnpm format # Format all code with Biome
26+
pnpm check # Run Biome lint and format (auto-fix) on the codebase
27+
pnpm telemetry # Check Next.js telemetry status
28+
```
29+
30+
### Build & Production
31+
```bash
32+
pnpm build # Build production bundle
33+
pnpm start # Start production server (requires build first)
34+
```
35+
36+
### Docker
37+
```bash
38+
docker build -t next-typescript-pwa-starter .
39+
docker run --rm -it -p 3000:3000 next-typescript-pwa-starter
40+
docker-compose up
41+
```
42+
43+
## Architecture
44+
45+
### Directory Structure
46+
- `pages/` - Next.js Pages Router
47+
- `_app.tsx` - Custom App component
48+
- `_document.tsx` - Custom Document component
49+
- `api/` - API routes
50+
- `index.tsx` - Home page
51+
- `components/` - React components (e.g., nav.tsx)
52+
- `styles/` - CSS/styling files
53+
- `public/` - Static assets and PWA manifest
54+
- `sw.js` - Service worker source file
55+
56+
### PWA Configuration
57+
PWA functionality is configured using **Serwist** (next-pwa successor):
58+
- Configuration in `next.config.js` using `@serwist/next`
59+
- Service worker source: `sw.js` (root) → builds to `public/sw.js`
60+
- **Disabled** in development mode (only works in production)
61+
- Manifest file: `public/manifest.json`
62+
- PWA meta tags and manifest link in `pages/_document.tsx`
63+
- Icons located in `public/icons/`
64+
65+
### TypeScript Configuration
66+
Strict TypeScript settings enforced:
67+
- `strict: true` with all strict flags enabled
68+
- `noUnusedLocals` and `noUnusedParameters` enabled
69+
- Path alias `@/*` maps to project root
70+
- Target: ES5, Module: ESNext
71+
72+
### Code Quality with Biome
73+
Pre-commit hooks automatically run via Husky + lint-staged:
74+
- Configuration in `biome.json` and `.lintstagedrc.json`
75+
- Husky hook in `.husky/pre-commit` runs `pnpm lint-staged`
76+
- lint-staged runs Biome checks on staged files only
77+
78+
Biome rules of note:
79+
- `noConsoleLog: error` - Console.log statements are errors
80+
- `noUnusedVariables: error` - Unused variables are errors
81+
- `noExplicitAny: warn` - Explicit any types trigger warnings
82+
- Auto-organizes imports
83+
84+
### CI/CD with GitHub Actions
85+
GitHub Actions workflow (`.github/workflows/main.yml`) runs on push/PR:
86+
1. **lint-and-test** job: Runs Biome checks, type checking, and tests
87+
2. **build** job: Builds the Next.js application
88+
3. **docker** job: Builds and pushes Docker image (main branch only)
89+
90+
## Node & Package Manager Requirements
91+
- Node >= 22.0.0
92+
- pnpm >= 9.0.0 (packageManager: pnpm@9.15.3)
93+
94+
## Important Notes
95+
- This project uses the **Pages Router** (Next.js 15), not the App Router
96+
- **Turbopack** is enabled by default for faster development builds (`pnpm dev --turbopack`)
97+
- PWA features only work in production builds (Serwist disabled in dev)
98+
- No test framework is configured yet (test script is a placeholder)
99+
- Console.log statements will fail Biome checks - remove before committing
100+
- Uses Serwist instead of next-pwa for better Next.js 15 compatibility

0 commit comments

Comments
 (0)