Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul how we document the different library flavors #5097

Closed
glasser opened this issue Apr 9, 2021 · 8 comments
Closed

Overhaul how we document the different library flavors #5097

glasser opened this issue Apr 9, 2021 · 8 comments
Labels
📝 documentation Focuses on changes to the documentation (docs)

Comments

@glasser
Copy link
Member

glasser commented Apr 9, 2021

ApolloServer is not a single API: it is provided by a bunch of different packages:

  • The batteries-included apollo-server
  • The most popular "traditional" framework integration apollo-server-express
  • The most popular "serverless" framework integration apollo-server-lambda
  • Other traditional framework integrations (apollo-server-hapi, apollo-server-koa,apollo-server-fastify, apollo-server-micro)
  • Other serverless framework integrations (apollo-server-cloud-functions, apollo-server-azure-functions)
    (There's also apollo-server-cloudflare which seems like it should be serverless but is built more like a traditional integration, and also has been barely touched since its introduction.)

These packages don't all provide the same APIs! In some cases this is due to the distinctions between "batteries-included" and not. In some cases it's the distinction between "traditional" and "serverless". In some cases it's due to differences between the frameworks themselves (eg, the ability to configure features unique to a framework, or argument types that are the framework-specific request/response objects). In some cases it's just that we haven't implemented a feature for all frameworks.

But our docs don't make it easy to understand this. We don't have comprehensive API docs for each package.

Instead, we have:

  • READMEs for individual packages
  • The apollo-server API reference page which is a mish-mosh of documenting shared APIs, apollo-server-specific APIs, and other framework APIs in vague ways
  • The integrations page which just lists the middleware and shows one Express example
  • The deployments pages like the Lambda one which are less about documenting apollo-server-lambda and more about being a guide to using the serverless tool to install AS on Lambda
  • Just reading the source or using your editor's ability to understand the TypeScript types (this is the only way to fully know the methods and options for all the packages now)

Also individual feature doc pages sometimes allude to things that are specific to one API variety; eg, the health checks page provides no hint that onHealthCheck is an argument to applyMiddleware for apollo-server-express rather than the constructor.

We should rework these approaches to have complete and accurate API documentation for each of our integrations, or at the very least for the "top 3" with a clear note that the others may be less fully documented.

@glasser glasser added the 📝 documentation Focuses on changes to the documentation (docs) label Apr 9, 2021
@glasser glasser added this to the Release 3.x milestone Apr 9, 2021
@MentalGear
Copy link

Feature indication of the different "flavors" would be much appreciated!
I'm currently wondering which of the features of apollo are available in the serverless version (apollo-server-lambda) that I want use with netlify.
Maybe we can have some sort of chart/icons for each feature in the guide that indicates where it is available.

@dit7ya
Copy link

dit7ya commented Apr 16, 2021

Slightly offtopic, please point me to another place to ask this if required. I am curious, is there any documentation at all for the apollo-server-cloudflare repo? The usual Readme does not exist. And is it still experimental?

@glasser
Copy link
Member Author

glasser commented Apr 19, 2021

@dit7ya To be honest, I don't know what to make of that package. It was added in a single commit in the middle of the big Apollo Server 2.0 refactoring push 3 years ago. I believe there's only been one change to its source code since then other than just applying the same change to all framework packages. The package doesn't support some of the things the other integrations support like health checks and playground (and uploads, though we are removing that in Apollo Server 3). That we haven't had to iterate on it all either means we did an amazingly perfect job in the first place, or it's not heavily used in practice. That said, the official Cloudflare Workers docs do link to a quickstart repo that uses apollo-server-cloudflare, so it probably has some usage... though that repo has a bunch of open issues suggesting it might not be in perfect shape.

Current stats on npmcharts.com show only 231 weekly downloads, compared to 2K for Azure Functions, 5K for Google Cloud Functions, 94K for Lambda, and 966K for Express. (Though maybe there's something odd about CF workers where using a package from them doesn't count towards your npm stats?)

Filed #5118 to consider the future of this package as part of AS3.

@jaydenseric
Copy link

jaydenseric commented Apr 20, 2021

IMO documentation sites are not appropriate for open source packages. Each package should have a readme containing all documentation required to use that package at that particular commit/version. It should be the primary source of truth for someone trying to figure out how to use that package. When companies go bust or retire software, documentation sites fade from the internet and the open source community using these npm packages without readmes suddenly has no documentation whatsoever.

Documentation sites often get out of sync with package versions, or have tricky UX to look up the right version of the docs. In contrast, readme files are version controlled with the package source and it's very easy to view a particular version on npm or GitHub. If a PR changes the public API, it should also include the necessary documentation updates.

For my packages, I use JSDoc comments in the source code and jsdoc-md (via a package prepare:jsdoc script that updates the readme “API” section) to make sure documentation is colocated with the source code, linted to be present and accurate using eslint-plugin-jsdoc. This also has a pleasant side effect of having nice rich descriptions and code examples, etc. in editor IntelliSense.

Here is an example of one of my packages with a decent readme via JSDoc tooling:

https://github.com/jaydenseric/graphql-upload

Ideally a user discovers a bunch of packages on npm, use their readmes to decide which one is most appropriate for their project, then use that readme there to get started; all without having to go searching through external documentation sites. It's tiresome when you have to remember what particular webpages you have to visit to read docs for what particular packages; when you have a lot of dependencies you just want to take for granted you can visit their npm or github page and look at a readme.

It would be rad if Apollo were to delete their documentation site and focus on quality package readmes. If packages are too complex to understand via even a well maintained readme then that is a huge smell that they are too complex, and should be rewritten to have a more intuitive API or get split into multiple packages with more clearly delineated concerns.

Apollo has some of the worst readme's on npm/github. For example:

https://www.npmjs.com/package/apollo-server-core

Screen Shot 2021-04-20 at 9 41 55 am

Zero actual documentation.

Another Example:

https://www.npmjs.com/package/@apollo/server

Screen Shot 2021-04-20 at 9 42 16 am

What does this package do, why does it exist? There is literally nothing to go off. It does a disservice to the npm community to publish low quality readme's like that; these confusing packages show up in Google/DuckDuckGo and npm search results.

Related: #5090

@glasser
Copy link
Member Author

glasser commented Apr 20, 2021

Thanks for the feedback, @jaydenseric!

Note that @apollo/server specifically is not a released package; we published one alpha once when we were heading down the direction of a package rename, which is no longer planned for v3 (but perhaps for later). I don't know if there's a great option here — perhaps deprecate the package on npm?

Agreed that apollo-server-core is a bad README, thus the #5090 that you found.

@glasser glasser removed this from the Release 3.x milestone Jun 10, 2021
@glasser
Copy link
Member Author

glasser commented Jun 23, 2021

We also need explicit documentation of how to "eject" from apollo-server to apollo-server-core.

@glasser
Copy link
Member Author

glasser commented Jun 26, 2021

And to link to the ejection from a few places in migration.md (search for 5097).

glasser added a commit that referenced this issue Jun 29, 2021
Now the "apollo server" reference page is just about ApolloServer (we
lose docs for `gql` but that's not the biggest deal; we can add a
reference page about other exports later if we want), and the
middleware page provides sample code for every middleware and gives
advice on which middleware to use.

Fixes #5097. (More or less. We could definitely do more work on this
front, but this is a good start.)
glasser added a commit that referenced this issue Jun 30, 2021
Now the "apollo server" reference page is just about ApolloServer (we
lose docs for `gql` but that's not the biggest deal; we can add a
reference page about other exports later if we want), and the
middleware page provides sample code for every middleware and gives
advice on which middleware to use.

Fixes #5097. (More or less. We could definitely do more work on this
front, but this is a good start.)
glasser added a commit that referenced this issue Jul 1, 2021
* docs: refactor middleware and ApolloServer docs

Now the "apollo server" reference page is just about ApolloServer (we
lose docs for `gql` but that's not the biggest deal; we can add a
reference page about other exports later if we want), and the
middleware page provides sample code for every middleware and gives
advice on which middleware to use.

Fixes #5097. (More or less. We could definitely do more work on this
front, but this is a good start.)

* First batch of edits to middleware docs (#5404)

* First batch of edits to middleware docs

* Incorporate feedback from @glasser

* Remaining edits to middleware docs (#5408)

Co-authored-by: Stephen Barlow <stephen@apollographql.com>
@glasser
Copy link
Member Author

glasser commented Jul 1, 2021

Fixed in #5396

@glasser glasser closed this as completed Jul 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📝 documentation Focuses on changes to the documentation (docs)
Projects
None yet
Development

No branches or pull requests

4 participants