Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Obfuscator SPA, serverless-side rendered on a modern cloud stack which scales from zero

Notifications You must be signed in to change notification settings

albertnis/obfuscator-serverless

Repository files navigation

Obfusactor Serverless

Important

Superseded by albertnis/obfuscator-htmx

There are three deployables in this repo:

Entrypoint Description
src/frontend/index.html Build main JS and CSS bundle to src/frontend/dist/static
src/functions/server/server.js AWS Lambda which does SSR and serves the result
src/functions/translate/translate.ts AWS Labmda which acts as API endpoint to perform translation calls

Running locally

  1. Install dependencies with Yarn

    yarn install
  2. Run mocked function endpoints

    yarn run functions
  3. Run in either front-end or full-stack mode, as below:

Front-end

If you want to develop the frontend with hot-reloading, dev-server is your best bet. Server-side rendering will not occur. Served HTML will be based on src/frontend/index.html.

  1. In a second terminal instance, run the live server

    yarn start:frontend

Then go to localhost:3000. Changes to code will trigger component reloads.

Full-stack

The full stack can also be tested.

  1. In a second terminal instance, build frontend and backend with webpack

    yarn build:functions:dev && yarn build:frontend:dev
  2. In a third terminal instance, start a local mock of the backend with Node. This starts a web server which calls the SSR logic of the translate Labmda.

    yarn start:localserver

Then go to localhost:3000.

While the start script is running, changes to the frontend will require a re-run of the build commands and a restart of localserver.

Build and deploy

  1. Install dependencies with Yarn

    yarn install
  2. Build assets with webpack

    Note: Due to a missing feature in Vite, you need to build each lambda separately. See functions.vite.config.ts for more information

    yarn build:functions && yarn build:frontend
  3. Package functions

    cd deploy
    ./package.sh
  4. Deploy to AWS, passing name of deployment bucket to be created

    cd deploy
    ./deploy.sh unique-deployment-bucket-name

About

Obfuscator SPA, serverless-side rendered on a modern cloud stack which scales from zero

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published