From 04d4902fdf1860e6dc0798eb1698d9a30f2dadd7 Mon Sep 17 00:00:00 2001 From: Kirill Mokevnin Date: Wed, 12 Aug 2026 08:47:25 -0400 Subject: [PATCH] docs: explain the repository instead of describing the scaffold The README came from a generator or opened with dead badges: Travis CI, which has not run for years, and in one case a Code Climate badge pointing at a different repository entirely. It now says what the project demonstrates, how to run it, and which files are worth reading first. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8e117cd..fbf326a 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,42 @@ -# Getting Started with [Fastify-CLI](https://www.npmjs.com/package/fastify-cli) +# js-fastify-rest-api-example -This project was bootstrapped with Fastify-CLI. +REST API на [Fastify](https://fastify.dev/), собранный «по-взрослому»: +схема API описана отдельно от кода, база через ORM, валидация по схеме. -## Available Scripts +## Зачем это нужно -In the project directory, you can run: +Пример того, как выглядит API-проект, когда он перерастает один файл с +маршрутами. Отличия от учебной заглушки видны сразу: -### `npm run dev` +- **Контракт первичен.** API описан на [TypeSpec](https://typespec.io/) + в `main.tsp`, из него генерируется OpenAPI, а из OpenAPI — типы для кода. + Документация не расходится с реализацией, потому что порождена из одного + источника. +- **База через [Drizzle](https://orm.drizzle.team/)**: схема в `db/schema.ts`, + миграции генерируются по ней. +- **Валидация входа** отдельным слоем в `validators/`, а не внутри обработчика. -To start the app in dev mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +## Запуск -### `npm start` +```bash +make install +make dev +make test +``` -For production mode +Полезное: -### `npm run test` +```bash +make routes # список маршрутов +make migration-generate # миграция по изменённой схеме +make generate-types # OpenAPI и типы из TypeSpec +make mock # поднять мок-сервер по OpenAPI +``` -Run the test cases. +--- -## Learn More +[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=js-fastify-rest-api-example) -To learn Fastify, check out the [Fastify documentation](https://fastify.dev/docs/latest/). +This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=js-fastify-rest-api-example). + +See most active contributors on [hexlet-friends](https://friends.hexlet.io/).