This project builds a GraphQL API that is consumed by a Svelte fronted created with SvelteKit. SvelteKit is a serverless-first Svelte metaframework for building web applications with filesystem-based routing.
You'll need to create a StepZen account first. Once you've got that set up, git clone this repository onto your machine and open the working directory:
git clone https://github.com/stepzen-dev/examples.git
cd examples/with-sveltekitBefore you can run this example, you need to have a free DEV.to Community API Key, which you can find on this page. This API Key is used to pull data from DEV.to that will be consumed by the example you're going to build.
You can copy the file stepzen/sample.config.yaml to a new stepzen/config.yaml file:
cp stepzen/sample.config.yaml stepzen/config.yamlAnd add your DEV.to Community API Key to it:
# stepzen/config.yaml
configurationset:
- configuration:
name: devto_config
devto_api_key: xxxxOpen your terminal and install the StepZen CLI:
npm install -g stepzenYou need to login here using the command:
stepzen loginAfter you've installed the CLI and logged in, run:
stepzen startA proxy of the GraphiQL playground becomes available at http://localhost/5001 (in example http://localhost:5001/api/with-sveltekit), which you can use to explore the GraphQL API. Also, the endpoint at which your GraphQL API is deployed gets logged in the terminal. You can query your GraphQL API from any application, browser, or IDE by providing the API Key linked to your account.
Include your StepZen endpoint and API keys in .env, by copying then file .env.sample to .env:
cp .env.sample .envAnd add the endpoint and API Key for Stepzen:
STEPZEN_ENDPOINT=
STEPZEN_API_KEY=
Install the dependencies using npm or Yarn:
npm i
npm run devOpen localhost:3000 to see the project.
You can learn more in the StepZen documentation. Questions? Head over to Discord or GitHub Discussions to ask questions.