Skip to content

Commit bbd8a34

Browse files
authored
Merge pull request #20 from danangekal/feature/update-tech-stacks
feat: update tech stack latest (node, pnpm, react, next, biome, etc)
2 parents 936fd5b + 0388fac commit bbd8a34

21 files changed

+1330
-2696
lines changed

.dockerignore

Lines changed: 23 additions & 0 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
@@ -13,10 +14,12 @@ node_modules
1314

1415
# debug
1516
npm-debug.log*
17+
pnpm-debug.log*
1618
yarn-debug.log*
1719
yarn-error.log*
1820

1921
# local env files
22+
.env*.local
2023
.env.local
2124
.env.development.local
2225
.env.test.local
@@ -25,3 +28,23 @@ yarn-error.log*
2528
# docker file
2629
Dockerfile
2730
docker-compose.yml
31+
32+
# git
33+
.git
34+
.gitignore
35+
36+
# ci/cd
37+
.github
38+
39+
# editor
40+
.vscode
41+
.idea
42+
43+
# testing
44+
coverage
45+
46+
# misc
47+
*.log
48+
README.md
49+
CLAUDE.md
50+
LICENSE

.eslintrc.json

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

.github/workflows/main.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,68 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI to Docker Hub
42

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"
1911
build:
20-
# The type of runner that the job will run on
2112
runs-on: ubuntu-latest
2213

23-
# Steps represent a sequence of tasks that will be executed as part of the job
2414
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2615
- name: Check Out Repo
27-
uses: actions/[email protected]
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
23+
- name: Enable Corepack
24+
run: corepack enable
25+
26+
- name: Install pnpm
27+
run: corepack prepare pnpm@latest --activate
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Run Biome check
33+
run: pnpm check
34+
35+
- name: Type check
36+
run: pnpm type-check
37+
38+
- name: Build Next.js
39+
run: pnpm build
2840

29-
# Set up cache for the builder
3041
- name: Cache Docker layers
31-
uses: actions/cache@v2.1.4
42+
uses: actions/cache@v4
3243
with:
3344
path: /tmp/.buildx-cache
3445
key: ${{ runner.os }}-buildx-${{ github.sha }}
3546
restore-keys: |
3647
${{ runner.os }}-buildx-
3748
38-
# Login to docker
39-
- name: Docker Login
40-
uses: docker/[email protected]
49+
- name: Docker Login
50+
uses: docker/login-action@v3
4151
with:
4252
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4353
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4454

45-
# Set up docker buildx
4655
- name: Docker Setup Buildx
47-
uses: docker/setup-buildx-action@v1.1.1
56+
uses: docker/setup-buildx-action@v3
4857

49-
# Build and push docker images
5058
- name: Build and push Docker images
51-
uses: docker/build-push-action@v2.3.0
59+
uses: docker/build-push-action@v5
5260
with:
5361
context: ./
5462
file: ./Dockerfile
5563
builder: ${{ steps.buildx.outputs.name }}
5664
push: true
57-
tags: danangekal/next-typescript-starter:latest
65+
tags: danangekal/next-typescript-starter:latest
5866
cache-from: type=local,src=/tmp/.buildx-cache
5967
cache-to: type=local,dest=/tmp/.buildx-cache
6068

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121

2222
# debug
2323
npm-debug.log*
24+
pnpm-debug.log*
2425
yarn-debug.log*
2526
yarn-error.log*
2627

2728
# local env files
29+
.env*.local
2830
.env.local
2931
.env.development.local
3032
.env.test.local
@@ -33,5 +35,10 @@ yarn-error.log*
3335
# vercel
3436
.vercel
3537

36-
# package lock
38+
# typescript
39+
*.tsbuildinfo
40+
next-env.d.ts
41+
42+
# package locks (pnpm only)
3743
package-lock.json
44+
yarn.lock

.husky/pre-commit

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

4-
npx lint-staged
3+
pnpm lint-staged

.husky/prepare-commit-msg

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

.lintstagedrc.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
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"
2+
"*": [
3+
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
64
]
75
}

.prettierrc.json

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

CLAUDE.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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 TypeScript starter template with modern tooling, Docker support, and pre-configured code quality tools.
8+
9+
**Tech Stack:**
10+
- Next.js 15.5.4 (Pages Router) with Turbopack
11+
- React 19.2.0
12+
- TypeScript 5.7.3
13+
- pnpm package manager
14+
- Biome (replaces ESLint + Prettier)
15+
16+
**Requirements:**
17+
- Node.js >= 22.0.0
18+
- pnpm >= 9.0.0 (via Corepack or global install)
19+
- Package manager locked to [email protected] via `packageManager` field
20+
21+
## Development Commands
22+
23+
```bash
24+
# Install dependencies
25+
pnpm install
26+
27+
# Development server with Turbopack (http://localhost:3000)
28+
pnpm dev # Uses --turbopack flag automatically
29+
30+
# Production
31+
pnpm build # Build for production
32+
pnpm start # Start production server
33+
34+
# Code Quality
35+
pnpm lint # Run Biome linter
36+
pnpm format # Format code with Biome
37+
pnpm check # Run Biome check and auto-fix (recommended)
38+
pnpm type-check # TypeScript type checking
39+
pnpm type-check:watch # TypeScript type checking in watch mode
40+
41+
# Testing
42+
pnpm test # Placeholder (no test framework configured)
43+
44+
# Docker
45+
docker build -t next-typescript-starter .
46+
docker run --rm -it -p 3000:3000 next-typescript-starter
47+
docker-compose up
48+
```
49+
50+
## Project Architecture
51+
52+
**Next.js Pages Router Structure:**
53+
- `pages/` - File-based routing (Pages Router, not App Router)
54+
- `pages/_app.tsx` - Custom App component, imports global styles
55+
- `pages/_document.tsx` - Custom Document for HTML structure
56+
- `pages/index.tsx` - Home page
57+
- `pages/api/` - API routes (serverless functions)
58+
- `components/` - Reusable React components
59+
- `styles/` - CSS files (globals.css, CSS Modules)
60+
- `public/` - Static assets
61+
62+
**Path Aliases:**
63+
- `@/*` resolves to project root (configured in tsconfig.json)
64+
- Example: `import '@/styles/globals.css'`
65+
66+
## Code Quality Tools
67+
68+
### Biome (Linter + Formatter)
69+
70+
**Configuration**: `biome.json`
71+
72+
Biome replaces both ESLint and Prettier for better performance and consistency.
73+
74+
**Linting Rules:**
75+
- `noConsole: error` - Console statements not allowed in production code
76+
- `noUnusedVariables: error` - Unused variables not allowed
77+
- `noUnusedImports: error` - Unused imports not allowed
78+
- `useImportType: error` - Enforce type-only imports when applicable
79+
- Auto-organizes imports
80+
81+
**Formatting Style:**
82+
- Single quotes for JS/TS
83+
- Double quotes for JSX
84+
- 2-space indentation
85+
- 80 character line width
86+
- Trailing commas everywhere
87+
- Semicolons always
88+
- Arrow function parentheses always
89+
90+
**Usage:**
91+
- Run `pnpm check` before committing (auto-fixes most issues)
92+
- Pre-commit hooks will enforce these rules automatically
93+
94+
### TypeScript
95+
96+
**Configuration**: `tsconfig.json`
97+
98+
- Strict mode enabled (all strict type-checking options)
99+
- `noUnusedLocals: true` - Error on unused local variables
100+
- `noUnusedParameters: true` - Error on unused function parameters
101+
- `noImplicitReturns: true` - Error when not all code paths return a value
102+
- `noImplicitAny: true` - Error on implicit any types
103+
- Path alias: `@/*` → project root
104+
105+
### Git Hooks
106+
107+
**Husky 9.1.7 + lint-staged 16.2.3**
108+
109+
- **Pre-commit**: Runs Biome check on staged files (`.husky/pre-commit`)
110+
- **Configuration**: `.lintstagedrc.json`
111+
- Uses `pnpm lint-staged` command
112+
- Automatically formats and fixes issues before commit
113+
- Note: `prepare-commit-msg` hook removed (commitizen not installed)
114+
- **Requires Node.js >= 20.17** (lint-staged v16 requirement)
115+
116+
## Important Notes
117+
118+
- **Routing**: Uses Next.js Pages Router (not App Router)
119+
- **Testing**: No test framework configured (test script is a placeholder)
120+
- **React**: Strict mode enabled in next.config.js
121+
- **Dev Server**: Uses Turbopack for faster builds (`--turbopack` flag in dev script)
122+
- **Package Manager**: Must use pnpm (not npm or yarn)
123+
- **Node Version**: Requires Node.js >= 22.0.0
124+
- **Deprecated Options**: `swcMinify` removed from next.config.js (enabled by default in Next.js 15)
125+
- **Docker**: Pre-built images available at `danangekal/next-typescript-starter`
126+
- **Biome vs ESLint/Prettier**: This project uses Biome exclusively - do not add ESLint or Prettier
127+
128+
## Migration Notes
129+
130+
This project was recently upgraded from:
131+
- React 18 → React 19
132+
- Next.js 13 → Next.js 15
133+
- Node 16 → Node 22
134+
- Yarn → pnpm
135+
- ESLint + Prettier → Biome
136+
- Husky 8 → Husky 9

Dockerfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
# Set image from base on offical node lts alpine
2-
ARG VERSION=lts-alpine
1+
# Set image from base on official node 22 alpine
2+
ARG VERSION=22-alpine
33
FROM node:$VERSION
44

55
# Set label maintainer, version & description
66
LABEL maintainer="[email protected]"
77
LABEL version="0.1.0"
88
LABEL description="Unofficial Next.js + Typescript starter with a latest package"
99

10+
# Install pnpm
11+
RUN corepack enable && corepack prepare pnpm@latest --activate
12+
1013
# Set working directory
1114
WORKDIR /app
1215

13-
# Copy all files
14-
COPY . .
16+
# Copy package files
17+
COPY package.json pnpm-lock.yaml ./
1518

1619
# Install dependencies
17-
RUN yarn install --frozen-lockfile
20+
RUN pnpm install --frozen-lockfile
21+
22+
# Copy all files
23+
COPY . .
1824

1925
# Build app
20-
RUN yarn build
26+
RUN pnpm build
2127

2228
# Expose the listening port
2329
EXPOSE 3000
2430

25-
# Run yarb start script when container starts
26-
CMD yarn start
31+
# Run pnpm start script when container starts
32+
CMD pnpm start

0 commit comments

Comments
 (0)