Skip to content

Commit 047a2f1

Browse files
authored
Merge pull request #1 from sulujulianto/feat/backend-api
Feat/backend api
2 parents afe6b05 + 32ee718 commit 047a2f1

40 files changed

+1711
-231
lines changed

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
*.log
6+
*.db
7+
.env
8+
.venv
9+
venv/
10+
env/
11+
.python-version
12+
.pytest_cache/
13+
.ruff_cache/
14+
.mypy_cache/
15+
.eggs/
16+
*.egg-info/
17+
.build/
18+
dist/
19+
.git
20+
.gitignore
21+
.vscode/
22+
.idea/
23+
*.swp
24+
Dockerfile

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.txt -r requirements-dev.txt
23+
24+
- name: Lint
25+
run: ruff check .
26+
27+
- name: Type check
28+
run: mypy app
29+
30+
- name: Test
31+
run: pytest -q
32+
33+
- name: Build Docker image
34+
run: docker build -t sistem-wilayah-indonesia-api .

CHANGELOG.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,26 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7-
8-
---
9-
10-
## [2.0.0] - 2025-08-19
7+
8+
---
9+
10+
## [Unreleased]
11+
12+
## [0.1.0-api] - 2025-12-01
13+
14+
### Added
15+
- 🚀 FastAPI service with `/health`, `/v1/stats`, `/v1/provinces`, and `/v1/search` endpoints plus unified error responses
16+
- 🗂️ JSON data file (`app/data/wilayah.json`) with loader fallback in `sistem_wilayah_indonesia.py`
17+
- 🧪 Service layer, Pydantic schemas, and pytest suite (FastAPI TestClient)
18+
- 🛠️ CI workflow (ruff, mypy, pytest), Dockerfile, and backend project scaffolding
19+
20+
### Changed
21+
- 📄 README diperbarui untuk quickstart API, Docker, dan catatan versi (tag CLI `v1.0.0-cli`)
22+
- 📦 Dependencies disederhanakan: runtime FastAPI + dev tools (ruff, mypy, pytest)
23+
24+
---
25+
26+
## [2.0.0-cli] - 2025-08-19
1127

1228
### Added
1329
- 🎉 Complete rewrite with comprehensive kabupaten/kota data
@@ -35,7 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3551

3652
---
3753

38-
## [1.0.0] - 2024-01-16
54+
## [1.0.0-cli] - 2024-01-16
3955

4056
### Added
4157
- 🏛️ Basic province and capital city lookup
@@ -87,4 +103,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
87103
- 🙏 Indonesian Government for providing open administrative data
88104
- 👥 Open source community for tools and inspiration
89105
- 📖 Wikipedia editors for maintaining accurate regional data
90-
- 🇮🇩 Indonesia for being an amazing archipelago to document
106+
- 🇮🇩 Indonesia for being an amazing archipelago to document

DATA_SOURCES.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ Dokumen ini menjelaskan sumber data yang digunakan dalam Sistem Informasi Wilaya
147147
- Kemendagri: [kemendagri.go.id](https://kemendagri.go.id)
148148
- BPS: [bps.go.id](https://bps.go.id)
149149

150-
**Laporan Error**
151-
- 🐛 GitHub Issues
152-
- 📧 Email: *(placeholder: data-verification@project.com)*
150+
**Laporan Error**
151+
- 🐛 GitHub Issues
152+
- Silakan gunakan GitHub Issues untuk laporan error.
153153

154154
**Community Verification**
155155
- 👥 Lihat `CONTRIBUTING.md`
@@ -164,4 +164,4 @@ Data telah diverifikasi dari sumber resmi. Namun, untuk keperluan hukum dan admi
164164

165165
---
166166

167-
*Last Updated: 19 Agustus 2025 — Document Version: 1.0*
167+
*Last Updated: 19 Agustus 2025 — Document Version: 1.0*

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.12-slim AS builder
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1
4+
ENV PYTHONUNBUFFERED=1
5+
WORKDIR /app
6+
7+
COPY requirements.txt ./
8+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
9+
10+
FROM python:3.12-slim
11+
12+
ENV PYTHONDONTWRITEBYTECODE=1
13+
ENV PYTHONUNBUFFERED=1
14+
WORKDIR /app
15+
16+
COPY --from=builder /install /usr/local
17+
COPY app ./app
18+
COPY sistem_wilayah_indonesia.py ./sistem_wilayah_indonesia.py
19+
COPY README.md LICENSE CHANGELOG.md DATA_SOURCES.md ./
20+
21+
EXPOSE 8000
22+
23+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
PYTHON ?= python
2+
UVICORN ?= $(PYTHON) -m uvicorn
3+
APP_MODULE ?= app.main:app
4+
HOST ?= 127.0.0.1
5+
PORT ?= 8000
6+
7+
.PHONY: dev test lint type check
8+
9+
dev:
10+
$(UVICORN) $(APP_MODULE) --host $(HOST) --port $(PORT) --reload
11+
12+
test:
13+
$(PYTHON) -m pytest -q
14+
15+
lint:
16+
ruff check .
17+
18+
type:
19+
mypy app
20+
21+
check: test lint type

0 commit comments

Comments
 (0)