How ch1burek/laba-back-end works
This is a Next.js country-information website with a local SQLite-backed JSON API. The main user workflow loads a country dropdown, fetches selected-country details, and renders a country card. A separate optional city-details endpoint is documented. Relationships below follow the shown route calls, client fetches, and database helper usage; no unsampled implementation is assumed.
Main entry points: countries.ts Country queries · CountryExplorer.tsx Country explorer · db.ts Database setup · page.tsx Home page
Components 11
Country Explorer
- Home page
app/page.tsx - Country explorer
components/CountryExplorer.tsx
JSON API
- Country list route
app/mycountries/v1.1/getcountrieslist/route.ts - Country details route
app/mycountries/v1.1/getcountry/[countryname]/route.ts - City details route
app/mycountries/v1.1/getcity/[cityname]/route.ts
Country Data
- Country queries
lib/countries.ts - Database setup
lib/db.ts - Initial records
lib/seed-data.ts - SQLite database
- Data contracts
lib/types.ts
Other components
- Browser user
Connections 14
- Browser user → Home page: opens
README.md - Home page → Country explorer: renders
app/page.tsx - Country explorer → Country list route: fetches list
README.md - Country explorer → Country details route: fetches details
README.md - Browser user → City details route: requests city
README.md - Country list route → Country queries: calls list query
app/mycountries/v1.1/getcountrieslist/route.ts - Country details route → Country queries: calls detail query
app/mycountries/v1.1/getcountry/[countryname]/route.ts - City details route → Country queries: calls city query
app/mycountries/v1.1/getcity/[cityname]/route.ts - Country queries → Database setup: gets connection
lib/countries.ts - Database setup → Initial records: seeds tables
lib/db.ts - Database setup → SQLite database: creates and caches
README.md - Country queries → SQLite database: queries rows
README.md - Country queries → Data contracts: maps typed rows
lib/countries.ts - Country explorer → Browser user: renders country card
README.md