A fully auto-generated REST API for browsing, managing, and extending a collection of classic retro video games. Built with LoopBack 4, the API provides complete CRUD functionality, an interactive Swagger UI for testing, and a clean architecture that’s easy to extend or connect to a real database.
- LoopBack 4 – API framework with auto-generated CRUD endpoints
- TypeScript – typed superset of JavaScript for scalable code
- Node.js (v18+) – backend runtime powering the app
- Swagger – interactive API docs and testing via
/explorer - JSON Boot Seeder – Loads default game data from
./data/db.jsoninto memory on startup (read-only; changes are not persisted)
GET /games– List all gamesGET /games/count– Get total number of gamesPOST /games– Add a new gameGET /games/{id}– View details for a single game by IDPUT /games/{id}– Replace a game entry entirelyPATCH /games/{id}– Update parts of a game entryPATCH /games– Bulk update games matching a conditionDELETE /games/{id}– Delete a game by ID
id(auto-generated)title(full title of the game (e.g., Super Mario World))platform(SNES, Nintendo 64, Sega Genesis, MS-DOS, etc.)genre(game type/category, defaults toMisc)year(year of release, defaults to0)rating(0–10)picture(string URL or file name)
Example:
{
"title": "Sonic the Hedgehog",
"platform": "Sega Genesis",
"genre": "Platformer",
"year": 1991,
"rating": 9,
"picture": "https://upload.wikimedia.org/wikipedia/en/thumb/8/85/Sonic_the_Hedgehog_1_Genesis_box_art.jpg"
}
npm install
npm startThen open:
http://localhost:3000/explorer
You'll see the full Swagger UI for testing your /games endpoints.
This project was generated using the LoopBack CLI:
npm install -g @loopback/cli
lb4Steps taken:
- Created project:
lb4→retro-game-api - Generated model:
lb4 model→Gamewith properties like title, platform, etc. - Created in-memory datasource:
lb4 datasource→db(pre-loads data from./data/db.jsonon startup) - Made repository:
lb4 repository→GameRepositoryto handle data operations - Built controller:
lb4 controller→GameControllerwith full RESTful CRUD endpoints
- Added visible descriptions to all endpoints.
- Enabled editable examples for filters and request payloads.
- Removed
additionalProp1clutter with a strict model schema.
- You can update
db.jsonmanually to add more games - Default values are defined in
game.model.ts
To make this API production-ready or persist changes:
- 🔄 Connect to a real database (e.g., SQLite, PostgreSQL, MongoDB)
- 💾 Add file-based saving logic to persist updates to
db.json - 🔐 Add authentication so users can create/update their own collections
This application was generated using LoopBack 4 CLI with the initial project layout.
Please check out LoopBack 4 documentation to understand how you can continue to add features to this application.
This project is licensed under the MIT License. See the License file for details.