Auto-generated documentation in Supabase
Tags: supabase, opensource, database
Published: 2022-07-05 15:10:40

## The need for good API documentation 

Every developer knows that documentation is an essential aspect of API adoption. With comprehensive API documentation that explains all features, developers can quickly adapt and integrate them into other applications. In addition to increasing API adoption, good documentation also improves the development process in several ways:

-   Simplified project management

In many projects, tasks are broken down as "Jobs to be done". Using an API to model a job task is common across several projects. Without a well-designed and documented API, you and your team members will be forced to spend more time copying data between tools and completing tasks.

-   Improved development velocity

Good documentation is a perfect way for app builders across your organization to self-serve their application needs. It makes information more accessible and easier to find, empowering new members to figure things out on their own. They can easily see how to work with APIs and quickly get up to speed on projects.

-   Better organizational consistency

Good API documentation fosters better consistency and standards within an organization. Just like designers and writers have a style guide for content, good API documentation serves as the style guide for developers using an API. 

Why you should auto-generate API documentation
----------------------------------------------

Well-written API documentation can make your APIs look and feel professional, but it can be a time-consuming task to maintain manually. Throughout the life-cycle of your application, the API documentation needs to be kept up to date. For example, if you create a new table, or change the schema of an existing table, you will need to update the documentation accordingly. Thanks to Supabase's auto-generated documentation, this can now be done easily. You can now automatically update documentation pages to reflect application changes and reduce the effort needed to keep up with documentation drift.

Stripe is a great example of an organization that has excellent API documentation and is highly regarded by API consumers. Did you know that they also make use of auto-generated documentation?

![Stripe documentation is combination of automation and manual work.](https://lh4.googleusercontent.com/FCRcifkqfsKhr_mkuXtqywrJa-2jxf50g4WT8K_3N-RF8jKPepoxIKwP-ZXazK1UVk5E-X3HGgUv36_XmM0jnO5fHaUSOvJp3HF0Egowxt-6nJU7y2ZZZcDpxIi2UuH_Svjmxi2g9ykNEV_Jpg)

Getting started with auto-generated Supabase documentation 
-----------------------------------------------------------

Supabase is built for developers and you can get started for free using your[ existing Github account](https://app.supabase.com). Once your Supabase account is set up, you will be able to access the Supabase dashboard. From here, go to All Project > New Project.

![Creating a new project in Supabase](https://lh3.googleusercontent.com/kF51Eet8_x5ZA-hVCkFJ8SSO-k1uBB_EukimfoGhoBlAhQ_8YKLBYRZ95exKf-a0aeaaXpMw28gVpJCLvV267cc9T-YtKw7YE2O9nn1pLBIyN8t6Y12OVyWst1AHJZWNnc0JiZ90PPMmD-T50g)

Give your project a name and set the database password. You can also choose the region and adjust the [pricing plan](https://supabase.com/pricing) based on the requirements of your project.

![Create a new project in Supabase](https://lh3.googleusercontent.com/2zbhj-iXGBrJZTtx8o1hdceYtFGzuuzBpGsaMaxTkzBWI9qHJWdi2PGeM9iL-r0diBxNB7K4_bBU8p9YZy2-I_n9N9G4whX12z2fbpeaL1XgouOW08Sb2_wQsVnoovuLhInYYVikA7c407AnEw)

Once you create a new project, you will see the services offered by Supabase which includes a hosted database built on top of PostgreSQL. You can start creating tables in your database by clicking the Table editor button.

![Welcome to your new project](https://lh5.googleusercontent.com/S9CxRTDAEHMJks3dzbntQ35o8cNI2FX-2kGFThuesJs2CLxVzt-6Jfs9vtoWXxEdO2S5NXnxc6IdsgmtCVOpaK0wQCVp6qHGfjTNT7qaAPjyx6GEx6xrxb7oVHyU7bAZjkHPphTu4BrOPE490Q)

Here you can create your own tables and start defining your table schema.

![Creating a new table](https://lh5.googleusercontent.com/gjntzl90oaCC4O5ibqlo_RzlP7fUdRndG7Y3uuprP2wLv_D1UI9U4rTgCDcgZWOixPhEP7mgvksg162AHEdbJYtAZEnEgk4ibxOYkUndsRBVa4QkVz_QGVfqOWP26ymfe-OJax-9aZKvGOzMFw)

Once you create a table, you can then add rows to the tables using the Table Editor.

![Insert a new row](https://lh6.googleusercontent.com/TrVE-cR98zt8eOHJt3MoZZevoSakio6NCvzuHX__C9zB9X3frrwe8_NE7SdyYOJHrI7YRJ-jql2reQfdw39-c7Tv5L9bd8srMlNYQj2Up87k3q3EnFAvhVEaHy60_XdMc3JG6_ZdmH0CPpEyow)

If you create tables or update table schemas, API documentation will be auto-generated. You can then view the auto-generated API documents by going to the API section from the left menu.

![API section on the left menu](https://lh3.googleusercontent.com/BycHsR_CkCRanh602MMBRQaAPtN2ZOhCIgNRBvQCZM-D-bYpQyYWgTconVTEEb8b2GNd_XZkWPTsTLkVQiAI_6TnxpOnJxMbiF4bXpwiWcbp3ZNPK0cLLMZqzJCXY_9waQ7RIwUGWizlSoq-IA)

The view on the right shows you how you can connect to your Supabase project from within Node.js applications using the createClient class from the supabase-js [npm package](https://www.npmjs.com/package/@supabase/supabase-js).

![How to connect to your Supabase project](https://lh5.googleusercontent.com/gbIvgjb9OIAzxLng_mjl0b8pM3wKl3fzR-Ou0T5QMa8DpbrvAD8Ma309uU1fnP4CrrYggj2rE059OpymwX57uYBMp9xrbs4iR_WmlIb496QZ1YWzN8FNz_6-6-2ypT7NKMw8H6HJEj3WPT5y2A)

For authentication, you can find your Supabase API keys by going to Settings > Project Settings > API.

![Project API Keys](https://lh4.googleusercontent.com/_OAKvzbS4S45QGZkpcsrcsYCEfcsWpmO2P9MySsAKBUN7zB1okZ-XZgBFgL2_yGMCtwN-8ktiUjfLoYJKgBXXUCU0n9rmY_8tBogdX2tgg7YZ9Eo4N1R0Gcf6McqZN3PBm_SfhNRQRN37Vgrvg)

Once your application has been created, you can use it to interact with your database tables. The table-specific documentation that is auto-generated gives you code snippets for the operations available. To view table-specific API documentation, go to API > API Docs > Tables and Views > {YOUR_TABLE}

![View table-specific API documentation](https://lh6.googleusercontent.com/AeWKvz-BrF6zpuyqllsFbEMCiTgAxWGxlQEFT-co8npQwufV-DgB-u2b85_GrtCaNqYUSIEYzEI3Wu4j0SC715avOa1uazP9txPlrZXztcnAaNOBuh21tuArmcIpoiPCgb5NwaYlj9wMcpPG6A)

As soon as you select the table to view, you'll see the schema definition. You can even add additional descriptions to your table fields to improve the documentation even more.

![Add additional descriptions to your table fields](https://lh4.googleusercontent.com/Yh-9d-xkfbOHsGN96fXj_CtP9tv13O9JlziLScdWro3ZztulLKaX7-XBNWCOFcKR0Or8Bnun_OURqx0CIAaI30x3WhnpSQWkZ66enLXhwtJPZQeNfIv_yhH_ifk15Ia9YtOUsaBeLseCsy5GRA)

The section on the right contains the auto-generated documentation for your table. These are code snippets that can be plugged into the Supabase client application from the previous step to perform database operations. The first set of code snippets shows you how to select all values from the table for a specific field.

![First set of code snippets](https://lh4.googleusercontent.com/IrUfzpjSyU9RTMx1CFf9QrFqGZk-39mTID8L7Erao0LXXVPa_sL8zhrXtWIaNEKpClL5WrSNeSXomhGwuLk6N75SsIx1Ojy0kncANUDi8Z0BR_tqL9vIEHo4EnOcC4PgBSpNxP0UwiOv25pa6w)

Scrolling down further, you can see the auto-generated documentation that lists code snippets for other CRUD operations using the Supabase client.

![The auto-generated documentation](https://lh3.googleusercontent.com/3qbKXpgbGx2BtbNvhlhszjd5DALmkmq80m8h2gb55lvpEIM0bOV7tclJrWzf0gAVw_ltWhBgPCUdfPfHXAQ7-crADCyx67gtWBb3I8m39cB7WNxnrlKyExVIMvxTgY1tqB1uAuTUaU4r_y6nqg)

If you're building a real-time application, the "Subscribe to changes" section might be interesting. The code snippets show how you can subscribe to all or specific events. These events are triggered whenever changes are made to the table.

![Suscribe to changes](https://lh4.googleusercontent.com/dBIS33vCYYVarHqlDc9AabhzLD6L7L3eIxfI3kk6X7yPFsnGzJnNb6_87M6wtPfULDc7Tm0wZQd3foQIM7PsShYekC4UlpP_bdyGSYRpLyxc2n7k5UiOLoW_qvQYlUZ42M-71JG5pgsynD6EYA)

Supabase also auto-generates CURL requests for CRUD operations to run against your tables. This gives users a way to quickly interact with their tables if you're using the Linux command line.

![How Supabase auto-generates CURL requests for CRUD operations to run against your tables](https://lh6.googleusercontent.com/Js2ulwgnMvUD6cDkNXu3bkoRiBTLQcZYglUz_bKDmJ33Yqzc8SXPMlz-uGoStldPPY8FEIN3e7P6xOJC1QkCkfrKYOx1lM8l_QnKhQggjJnESQeOTni8CFqLbM-U5ITK-R_KZE5zy6kwNK3whQ)

Conclusion
----------

The importance of creating good API documentation can't be stressed enough, and 

there's no need to try to reverse engineer code written by others in order to create documentation. With Supabase's API doc auto-generation, you can skip the tedious task of creating documentation and focus more time on building your application.

![Fun meme at the end](https://lh4.googleusercontent.com/npVPFtnECCV1kgFYEGvLF86GcbBoDk85-2BVrXcQoonTt_8Ksx3jdvwbKoeWNFoYMP-rzBOYIB_svg6Ir4mj1PqEOQ30hM9dDiZvZfrGaoqTov41uIy6WyUsqt_7G3qRXfTUCZw7QGME1xuCxw)

It's no surprise why developers are drifting to the Supabase way!

Now, become a Supabase developer today by starting[ a new project on our free tier](https://app.supabase.com/)