Sapper Graphql Template screenshot

Sapper Graphql Template

Author Avatar Theme by Eddyvinck
Updated: 4 May 2020
10 Stars

Work in progress: a Svelte Sapper template / boilerplate with Apollo GraphQL and MongoDB built-in

Overview:

The eddyvinck/sapper-graphql-template is a template based on the default Sapper template (Rollup). It allows developers to easily scaffold projects and use GraphQL with Svelte. The template supports server-side rendering and includes features such as svelte-apollo, apollo-server-express, and GraphQL Playground. The template also includes configuration files, authentication via GraphQL, and uses MongoDB with mongoose.

Features:

  • GraphQL Support: Allows developers to use GraphQL with Svelte.
  • Server-Side Rendering: Supports server-side rendering for improved performance and SEO.
  • svelte-apollo: Included package for integrating Apollo Client with Svelte components.
  • apollo-server-express: Enables building GraphQL servers using Express.
  • GraphQL Playground: Included for easy testing and exploring of GraphQL APIs.
  • MongoDB Integration: Uses MongoDB with mongoose for data storage and retrieval.
  • Configuration Files: Includes config configuration files in the /config/ directory.
  • Authentication via GraphQL: Supports authentication using JWT-based directives.

Installation:

To use the eddyvinck/sapper-graphql-template, follow these steps:

  1. Install degit globally: npm install -g degit
  2. Create a new directory for your project: mkdir project-name
  3. Change into the project directory: cd project-name
  4. Use degit to scaffold the project from the template:
degit eddyvinck/sapper-graphql-template#rollup
  1. Start MongoDB on your local machine.
  2. Install dependencies and run the project in development mode:
cd project-name
yarn install
yarn dev
  1. Open your browser and navigate to localhost:3000 to view the project. If everything is working correctly, you should be able to see the blog posts on localhost:3000/blog.

Summary:

The eddyvinck/sapper-graphql-template is a template that builds on the default Sapper template (Rollup) and allows developers to easily scaffold projects using Svelte with GraphQL support. It includes features such as svelte-apollo, apollo-server-express, and GraphQL Playground. The template also supports server-side rendering and integrates MongoDB with mongoose for data storage. With authentication via GraphQL and configuration files, this template provides a solid foundation for building web applications using Sapper and GraphQL.