Introduction
StorePI is a free, open-source API that was created for use in e-commerce prototyping, Front-End Developer talent evaluations, and anything else you can think of. The API and accompanying documentation was built with Next.js, Typescript, Tailwind CSS, Supabase, and Vercel.
It provides resources such as products, reviews, users, carts, purchases, and more. Endpoints are provided to perform CRUD operations on each of these resources, both as an anonymous user and as an authenticated user.
If you're the Postman type, you can find that version of the documentation here.
A default dataset is provided with this API. It consists of 19 users (each with a cart and wishlist), 50 products, 6 categories, 44 brands, 160 product reviews, and 50 purchases.
That said, you do have the ability to interact with the database and persist your custom data with select resources. Notably, You may sign up as a new user and perform any of the following actions as your new user:
- Log in
- Modify your profile
- Create/edit reviews
- Add/remove cart items
- Add/remove wishlist items
- Create a new purchase
While creating your own user is recommended, you may also perform any of the above actions as one of the users from the original dataset. When doing so, the endpoint will still respond as if the request were successful, but your data will not be persisted. See logging in for information on how to authenticate as one of these users.
Cross-origin resource sharing is enabled for all incoming requests.
Certain requests require a JWT for authorization. Requests that do require the token are indicated as such by the icon. As a general rule, any request that is reading or writing to a current user's resources will require the bearer token:
headers: {
Authorization: "Bearer {your access token}"
}
A bearer token can be obtained via the log in endpoint, where it will be returned in the request body and be valid for 12 hours.
The following query parameters can optionally be appended to all GET requests.
All fields of a given resource are valid for applying filters to a query. A full list of these fields can be found on each resource's page. The following operators are supported for GET requests:
Under the hood, StorePI makes use of PostgREST to provide an intuitive REST API. However, if you prefer to skip a layer and access the data using their syntax, you can do so by making use of the following variables:
Also thanks to its reliance on Supabase, StorePI comes with pg_graphql - a PostgreSQL extension that enables querying the database with GraphQL using a single SQL function. Reference the variables in the PostgREST section to get started.
You may also download the GraphiQL snippet to explore the GraphQL schema in-browser