Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 2515

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 26, 20242024-11-26T06:07:09+00:00 2024-11-26T06:07:09+00:00

Sky Cart: An Open Source, cloud-agnostic shopping cart using Stripe Checkout

  • 61k

Sky Cart lets you embed Stripe Checkout on your site in a flash

Earlier this month, Josh Nussbaum (@joshnuss) announced Sky Cart, a new open source project, which uses Svelte, Prisma, Vitest and Stripe Checkout to add a shopping cart to a web site:

With a few short lines of code, he created a headless, cloud-agnostic shopping cart embed that takes advantage of the hosted purchase flow provided by Stripe Checkout.

Using Sky Cart

Since Sky Cart is headless, the UI implementation depends on your web app’s framework. Products for Sky Cart are provided through the Stripe API – to get started, create a Stripe account and visit the Products page in the Dashboard to create products for your site.

Under the hood, Sky Cart uses the Stripe API to provide a list of products for sale. These can be made available on your site using Sky Cart’s Catalog API.

You’ll need to build the UI to expose a product list on your site. There are APIs available for creating a cart, as well as adding, removing, and updating items in your cart.

Sky Cart’s README provides additional information about using the library on your own project, as well as instructions for Development and Production deployments.

How Sky Cart was built

SvelteKit

If you’ve used Svelte before, you’ve probably come across SvelteKit, which is a minimal application framework for building Svelte apps. With SvelteKit, the functionality for Sky Cart is provided by way of serverless cloud functions.

Sky Cart uses SvelteKit as an abstraction layer for a variety of common serverless cloud hosting services. SvelteKit allows deployment to providers like CloudFlare, Vercel, and Netlify using plugins called Adapters.

Since functionality for SkyCart is built on top of serverless functions, your web app can scale just like any other serverless project – this means multiple carts can be run in parallel without any fuss or degradation of performance.

Testing

Unit testing for Sky Cart is provided by Vitest, and is used to ensure that the library remains functional even as new changes are merged into future releases. Test cases written with Vitest are in the repo’s /test/ folder – check out cart.test.js to see an example of syntax used for testing.

Data layer

Prisma provides Object-Relation Mapping (ORM) for the data types used by Stripe Checkout for assembling a cart and the associated charges when users make a purchase. This again is a wonderfully simple implementation – you can see the entire object model for Sky Cart in schema.prisma.

Stripe Checkout

Sky Cart is used to coordinate and maintain a list of products to purchase from a Stripe Account. It provides APIs for users to add items to their cart, remove items, and update totals. Once users decide to make a purchase, a call to Sky Cart’s checkout API sends users to a Stripe’s hosted Checkout experience, where they can securely complete their purchase.

Making Sky Cart available as Open Source Software (OSS)

Josh to fill in this section – why make this project available as OSS?

Josh built Sky Cart to learn more about using Prisma & Vitest with SvelteKit. Since SvelteKit is still quite new, this project was a great way to dig a bit deeper into SvelteKit’s developer experience. By building a simple tool with SvelteKit, Josh was able to provide feedback for the SvelteKit team while creating some resources that would help others integrate Prisma with SvelteKit.

The project came around as the result of an idea Josh had for using Stripe to provide catalog and purchasing functionality for an ecommerce site. Because Stripe manages product & pricing data as well as the checkout process, it made sense to experiment with adding a cart between those two resources.

During the process of building Sky Cart, Josh identified and built a few open source utilities, which are published and available as NPM packages:

  • prisma-database-cleaner: A utility to clean your DB between test runs
  • svelte-kit-test-helpers: Helper functions for testing SvelteKit endpoints

If you’re building with SvelteKit, check out these OSS resources as well:

  • A reusable GitHub Action for migrating Prisma and deploying to Vercel.
  • A code example of handling Stripe Webhooks with SvelteKit, and mocking Stripe in test mode.

Contributions Welcome

Since Sky Cart is completely open source, you can propose new features, add new functionality, or help maintain it by heading to GitHub in the repo joshnuss/sky-cart.

Give it a try!

And that’s it! Sky Cart is available for use straight away. You can add it to your site today by following the instructions in the README.md for Sky Cart. Make sure to follow Joshua Nussbaum on twitter @joshnuss, too!

javascriptopensourceshowdevwebdev
  • 0 0 Answers
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.