Sst Sveltekit Starter screenshot

Sst Sveltekit Starter

Author Avatar Theme by Okupter
Updated: 27 Sep 2023
18 Stars

SST SvelteKit Starter

Categories

Overview:

The SST SvelteKit Starter is a starter template for building a full stack application using SvelteKit and SST (Serverless Stack). It is designed and maintained by Okupter. SST is a framework that simplifies the process of building serverless applications on AWS by providing a simple, composable, and framework agnostic infrastructure. This starter template includes a SvelteKit application, an SST infrastructure, and various stacks that define the serverless infrastructure components such as API, authentication, RDS database, and S3 bucket.

Features:

  • SvelteKit application: Includes a pre-configured SvelteKit application as the front-end of the full stack application.
  • SST infrastructure: Provides a ready-to-use infrastructure setup using SST to define the serverless components.
  • API stack: Defines the API infrastructure for handling backend requests.
  • Authentication stack: Implements authentication functionality using Google OAuth.
  • RDS Database stack: Sets up an RDS database for storing application data.
  • S3 Bucket stack: Configures an S3 bucket for storing and serving static assets.

Installation:

To install and set up the SST SvelteKit Starter, follow these steps:

  1. Install the dependencies.
  2. Update the environment variables.
  3. Copy the .env.example file to .env and update the values.
  4. Set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables with your AWS account IAM user (with programmatic access) credentials.
  5. Create an IAM user for SST with the necessary permissions by following the guide: Create an IAM User for SST.
  6. After setting the environment variables, SST will automatically load them for the local development setup.
  7. Set up Google OAuth by creating an application, OAuth client, and OAuth consent screen on https://console.cloud.google.com.
  8. Update the .env file with the GOOGLE_API_CLIENT_ID obtained from the Google OAuth setup.
  9. Run the following command to set the secret into SST’s config secrets:
    secret some-stack-gitlab-ci/cicd ~/my-secret-file.txt
    
  10. Update the OAuth authorized domains and callback URL.
  11. Run pnpm sst dev to start the SST environment locally and obtain the API stack URL from the terminal output.
  12. Update the “Authorized domains” option in the OAuth consent screen of your Google application with the API stack URL.
  13. Update the “Authorized redirect URIs” of the OAuth client with the API stack URL suffixed with /auth/google/callback.
  14. In another terminal, run the SvelteKit application.
  15. Access the SST Console at https://console.sst.dev/sst-sveltekit-starter (replace sst-sveltekit-starter with the actual name of the SST infrastructure defined in sst.config.ts).

Summary:

The SST SvelteKit Starter is a comprehensive starter template for building full stack applications with SvelteKit and SST. It provides the necessary infrastructure and configurations to get started quickly. The template includes features such as a pre-configured SvelteKit application, authentication using Google OAuth, and infrastructure stacks for API, RDS database, and S3 bucket. The installation process involves setting up dependencies, environment variables, and configuring Google OAuth. With this starter template, developers can easily start building and deploying serverless applications on AWS.