Bookstore API built using Fastify and Typescript with Optic. Generates an OpenAPI spec using @fastify/swagger
and tracks changes using Optic. We have set up Optic to:
- preview API changes in PRs
- test for breaking changes
- enforce the API style guide
- share our API changelog and documentation with consumers
Take a look at the guides or just dig around the repo. You can start a server or generate an OpenAPI spec from the code.
To run this locally, you will need node >= 16 and yarn.
Get started by installing dependencies:
yarn install
And then run one of the following commands:
yarn start:local
- starts the serveryarn generate-spec
- generates an OpenAPI spec from code definitions
Take a look at the open pull requests of the repo. It's difficult to know how the code changes will impact your API. Optic adds preview documentation and an API changelog to each PR so every developer on your team knows exactly what changes to the API have been proposed.
Here are a couple of examples of what Optic can do:
- Optic caught a breaking change
- A small line of code can change multiple endpoints. Optic makes it easy to see the effective API changes being proposed
- Adding 2 new query parameters that do not follow our team's naming conventions
Every time this repositories main branch is updated, a new version of your API is pushed to Optic. Developers on your team, or your consumers (if public), can see a complete API changelog, and accurate documentation for the API.
- View the Optic Changelog
- View diffs between different API versions
- Preview documentation and changes in pull requests
You can also add badges to your repository that show you how often your API is changing and the number of endpoints you have.
You can follow instructions on how to set up Optic Cloud on our website. If you generate an OpenAPI spec from your code (just like this repo), you should follow our generated spec set up guide.