Coder Social home page Coder Social logo

aarya-a-patel / svelte-adapter-appengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from halfdanj/svelte-adapter-appengine

0.0 0.0 0.0 553 KB

Utilize the Google Cloud App Engine infrastructure to host SvelteKit content.

License: Apache License 2.0

Shell 12.58% JavaScript 87.42%

svelte-adapter-appengine's Introduction

svelte-adapter-appengine

Easily deploy your SvelteKit applications on Google Cloud App Engine with the svelte-adapter-appengine package.

npm Tests SvelteKit

Getting Started

To set up the adapter in your SvelteKit project:

  1. Install the package as a development dependency:
npm install --save-dev svelte-adapter-appengine
  1. Update your svelte.config.js to use the adapter:
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
+import adapter from "svelte-adapter-appengine";

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: vitePreprocess(),

  kit: {
+   adapter: adapter(),
  },
};

export default config;
  1. Build your application:
npm run build
  1. Deploy your application to App Engine:
gcloud app deploy --project <CLOUD_PROJECT_ID> build/app.yaml

Learn more about the gcloud utility in the official documentation

Configuration Options

Customize the adapter behavior using the following options:

adapter({
  // Build output directory (default: `/build`)
  out: "/build",

  // Enable Google Cloud Tracing Agent for improved logging (default: `false`)
  useCloudTracing: false,

  // Enable or disable Google Cloud Logging (default: `false`)
  // See: https://cloud.google.com/logging/docs/overview
  useCloudLogging: false,

  // Specify external modules for the esbuild step
  external: [],

  // Specify Node modules to be added to the `package.json` file in the build step
  // These modules will be fetched when the application is deployed
  dependencies: [],

  // Set the Node.js version for the App Engine runtime (default: `18`)
  // See available runtimes: https://cloud.google.com/appengine/docs/standard/nodejs/runtime
  nodejsRuntime: 18,
});

You can also customize the generated app.yaml file by creating an app.yaml file in your project root. The adapter will merge your custom configuration with the generated app.yaml, allowing you to define custom machine types, routes, or other app.yaml configurations.

Adapter Output

The Server-Side Rendering (SSR) part of SvelteKit is hosted on App Engine using a Node.js runtime, using polka to mimic @sveltejs/adapter-node .

Static files are served directly from Cloud Storage, bypassing the Node.js web server. The adapter automatically generates routes for all static assets in the app.yaml file.

Example Application

Check out a live example application at https://svelte-adapter-demo.uc.r.appspot.com/. This demo app is the default SvelteKit template deployed with the default adapter settings.

svelte-adapter-appengine's People

Contributors

halfdanj avatar dependabot[bot] avatar github-actions[bot] avatar sfriedel avatar aarya-a-patel avatar abynim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.