- Update verify_counts.py to validate SQLite database records and live Go REST API endpoints directly - Harden E2E test runner with dynamic free port binding (get_free_port) to prevent port collisions - Add exact regex matching for dynamic (ƒ) and static (○) route table allocations - Ignore root build binary artifacts in backend/.gitignore
AI Agent Networking Lab (ANL) — Go/Gin/SQLite Backend API
This module implements the standalone backend REST API server, SQLite database storage, seed ingestion pipeline, and static content exporter for the ANL landing page.
🏛 Architecture Overview
+-------------------------------------------------------------+
| SQLite (anl.db) |
| 11 Relational Tables (Projects, Members, Pubs, Lectures) |
+-------------------------------------------------------------+
▲ ▲
│ (cmd/seed) │ (SQL query)
│ │
+-------------------------------+ +-------------------------+
| seed/data/*.json | | Gin REST API Server |
| (extracted from content/*.ts) | | (cmd/api, :8080) |
+-------------------------------+ +-------------------------+
│
+-------------------------+
| Content Exporter |
| (cmd/export-content) |
+-------------------------+
│
▼
+-------------------------+
| Next.js Static SSG |
| (refer_landing_page/) |
+-------------------------+
🚀 Quick Start
1. Build Binaries
make build
Creates bin/api, bin/seed, and bin/export-content.
2. Run Migrations & Seed Database
make seed
Creates anl.db, executes SQL DDL migrations, inserts seed data, and verifies all 11 table row counts and the 5 designated highlights.
3. Run Backend API Server
make run
# Or with options:
./bin/api --port 8080 --db anl.db
Server starts at http://localhost:8080/api/v1.
4. Run Unit & Integration Tests
make test
5. Export Content to Next.js Frontend
make export-content
Regenerates refer_landing_page/content/*.ts from SQLite with typed isHighlight metadata.
📡 REST API Endpoints (/api/v1)
| Method | Path | Description |
|---|---|---|
GET |
/api/v1/health |
Service health status check |
GET |
/api/v1/research-projects |
3 research project entities |
GET |
/api/v1/research-areas |
14 core research areas ordered by display_order |
GET |
/api/v1/stats/summary |
Aggregated counts (intl_publications, standardization_docs, patents) |
GET |
/api/v1/members |
16 active members (with is_advisor flag) |
GET |
/api/v1/alumni |
60 alumni ordered chronologically |
GET |
/api/v1/publications |
148 publications (supports ?category=intl-journal-conf or domestic-journal-conf) |
GET |
/api/v1/publications/highlights |
5 designated top representative publications (WHERE is_highlight = 1) |
GET |
/api/v1/patents |
75 intellectual property patents |
GET |
/api/v1/semesters |
45 semesters with nested courses, ordered by year DESC and term |
GET |
/api/v1/standards-bodies |
6 standards bodies with nested projects and documents (deterministic ordering) |
⚙️ Environment Configuration (.env)
Copy .env.example to .env to customize runtime settings:
cp .env.example .env
| Variable | Default | Description |
|---|---|---|
HOST |
0.0.0.0 |
Binding host IP address |
PORT |
8080 |
Server listening port |
DB_PATH |
anl.db |
SQLite database file path |
GIN_MODE |
release |
Gin runtime mode (release, debug, test) |
CORS_ALLOW_ORIGINS |
* |
Allowed CORS origins (e.g. https://anl.knu.ac.kr) |
AUTO_MIGRATE |
true |
Apply database migrations automatically on startup |
🐳 Docker & Containerization
Build & Run Container
docker build -t anl-backend-api .
docker run -p 8080:8080 -v anl-data:/app/data anl-backend-api
Docker Compose
Run the full backend service with automated healthchecks and volume persistence from the repository root:
docker compose up -d
📦 Database Schema & Specifications
- Architecture: See ARCHITECTURE.md
- REST API Interfaces: See API_INTERFACE.md
- Database Schema Spec: See DATA_TABLE.md and 000001_init.up.sql