{"id":20177246,"url":"https://github.com/kitajs/minimal-example","last_synced_at":"2025-04-10T04:25:26.471Z","repository":{"id":199399477,"uuid":"702796331","full_name":"kitajs/minimal-example","owner":"kitajs","description":"📪 A KitaJS boilerplate with the smallest possible number of files.","archived":false,"fork":false,"pushed_at":"2024-03-31T20:13:57.000Z","size":67,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-24T05:43:46.367Z","etag":null,"topics":["docs","endpoint","example","getting","js","kita","kitajs","minimal","rest","started","typescript"],"latest_commit_sha":null,"homepage":"https://kita.js.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["kitajs","arthurfiorette"]}},"created_at":"2023-10-10T03:17:11.000Z","updated_at":"2024-02-24T21:53:45.000Z","dependencies_parsed_at":"2024-02-25T00:31:05.052Z","dependency_job_id":"b844795e-7a7f-403f-9fa2-164d9baea71f","html_url":"https://github.com/kitajs/minimal-example","commit_stats":null,"previous_names":["kitajs/minimal-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitajs%2Fminimal-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitajs%2Fminimal-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitajs%2Fminimal-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitajs%2Fminimal-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitajs","download_url":"https://codeload.github.com/kitajs/minimal-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248156248,"owners_count":21056808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docs","endpoint","example","getting","js","kita","kitajs","minimal","rest","started","typescript"],"created_at":"2024-11-14T02:14:54.579Z","updated_at":"2025-04-10T04:25:26.449Z","avatar_url":"https://github.com/kitajs.png","language":"TypeScript","readme":"\u003cdiv align=right\u003e\n  \u003ca href='https://codespaces.new/kitajs/minimal-example?quickstart=1'\u003e\n    \u003cimg src='https://github.com/codespaces/badge.svg' alt='Open in GitHub Codespaces' style='max-width: 100%;'\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://kita.js.org\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cimg src=\"https://kita.js.org/logo.png\" width=\"180\" alt=\"Kita JS logo\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr /\u003e\n\n\u003ch1 align=\"center\"\u003eKitaJS Minimal Example\u003c/h1\u003e\n\n\u003cbr /\u003e\n\n## Setup\n\n\u003chr /\u003e\n\n#### 🆕 Try it out in under a minute at [codespaces.new/kitajs/minimal-example](https://codespaces.new/kitajs/minimal-example).\n\n#### 🔴 Test out a live deployment at [kitajs-minimal-example.up.railway.app](https://kitajs-minimal-example.up.railway.app/reference).\n\n\u003chr /\u003e\n\nYou can also clone this repository locally:\n\n```sh\n# clone the repo\ngit clone https://github.com/kitajs/minimal-example.git app\n\n# Cd into it\ncd app\n\n# Install dependencies\nnpm install\n\n# Build the app\nnpm run build\n\n# Start the app\nnpm start\n```\n\n\u003cbr /\u003e\n\n## Documentation\n\nYou can find the documentation at [kita.js.org](https://kita.js.org). This is a minimal example without any boilerplate or custom configuration, making it the best way to bootstrap your app without unnecessary setup.\n\n\u003cbr /\u003e\n\n## Getting Started\n\nFirstly, let's review everything you need to know to get started with KitaJS.\n\n1. Make sure your IDE is using the TypeScript project version. For VSCode, you can check that by opening the command palette and typing `TypeScript: Select TypeScript Version` and selecting `Use Workspace Version`. This will add useful debugging information to your IDE. You can test it by writing `export function post(a: 1) {}` into `src/routes/index.ts`, and you should see an error in your IDE.\n\n2. You can start your server by running `npm run build` and `npm start`.\n\n3. To add more routes, simply create a new file under `src/routes`. The file name will be the route path; for example, `src/routes/users.ts` will be `/users`. Afterward, export a function with one of the following names: `get`, `post`, `put`, `delete`, or `all`. By adding parameters to the newly created method, KitaJS automatically generates route validation, a Swagger schema, and types.\n\n4. You must encapsulate your parameters with one of Kita's generic methods: `Body`, `BodyProp`, `Query`, `Path`, `Header`, and many others that you can find in the documentation. You can also use `FastifyInstance`, `FastifyRequest`, and `FastifyReply` to access the Fastify instance, request, and reply objects. You can hover over each type to see its documentation and usage examples.\n\n\u003cbr /\u003e\n\n## Boilerplate\n\n1. In your tsconfig, we added `\"plugins\": [{ \"name\": \"@kitajs/ts-plugin\" }]` to enable your editor to help you with IntelliSense.\n\n2. We only need `@kitajs/runtime` and `fastify` as production dependencies. You can see the only \"configuration\" file at [src/index.ts](src/index.ts). `@fastify/swagger` and `@fastify/swagger-ui` are only used to generate documentation at `http://localhost:1227/docs`.\n\n3. The `build` script calls `kita build` before `tsc`, which is the correct order because we need to read type information from the source files.\n\n4. You can run the `test` script to check if your code compiles correctly. `--dry-run` and `--noEmit` prevent KitaJS and TypeScript from emitting files, which is useful for testing.\n\n5. You can run `npm run dev` to instantly reflect your changes into your server. This is useful for development.\n\n6. Start your server by running `node dist/index.js` or `npm start`.\n\n7. Done! 🎉\n\n\u003cbr /\u003e\n\n## Swagger\n\nAfter starting your server, you can access [`http://localhost:1227/documentation`](http://localhost:1227/documentation).\n\n![Swagger webpage](https://github.com/kitajs/minimal-example/assets/47537704/534a7d42-a901-40e0-a0c5-a78bf197b9f9)\n\n\u003cbr /\u003e\n","funding_links":["https://github.com/sponsors/kitajs","https://github.com/sponsors/arthurfiorette"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitajs%2Fminimal-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitajs%2Fminimal-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitajs%2Fminimal-example/lists"}