drugz / sveltekit-clickhouse

A simple fun test project to demonstrate how SvelteKit works with Yandex Clickhouse DB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker + SvelteKit + Clickhouse

Test project

Cover

Run docker container with local Clickhouse and SvelteKit

docker-compose -f docker-compose.yml up -d

When Clickhouse starts up (1-5 minutes), you can open the playground localhost:8123/play or open localhost:3000/ in your browser.

Tasks:

1. Create a Clickhouse database (spin a local CH server)

2. Create the following tables (inspired by our Food delivery app):

products: id, price, no_discount_flag (bool)

cart_products: id, product_id, amount

coupons: id, discount_value (% of product price)

  1. Populate it with some random test data

  2. Todo: write an SQL query calculating the final price of a customer's cart, keeping in mind that:

  • cart_products may contain both no_discount and discounted products

  • total_cart_price = discount_total + no_discount_total + tax (10%)

As a bonus, a very simple Svelte home page has been added, illustrating the CH call via the HTTP API. @depyronick/clickhouse-client

About

A simple fun test project to demonstrate how SvelteKit works with Yandex Clickhouse DB


Languages

Language:Svelte 45.6%Language:JavaScript 44.8%Language:HTML 6.7%Language:TypeScript 2.8%Language:Shell 0.1%