This is a simple shopping demo app, inspired by the same Angular/React/Vue.js examples in Essential Typescript by Adam Freeman.
- The frontend is built with Svelte and SvelteKit with TypeScript typing. I use
@sveltejs/adapter-staticto generate a static JavaScript production. - The backend is built with Golang: a server/REST APIs using gin and go-sqlite3 for the SQlite3 database.
- A Dockerfile tha uses multi-stage builds (image size ~24 MB). The Dockerfile will update everything to the latest version.
Right now, like all the original examples, the app only reads product lists and write order data.
For local environment, you need
Install Svelte and Golang app dependencies.
npm i
npm prune
go get -u ./...Upgrade all NPM packages using npm-check-updates:
npx npm-check-updates -u
npm install
npm prune
Build Svelte production and Golang executable binary.
npm run build
go build .Start a server at http://localhost:8080.
./mainYou can change the host and port as
./main -host 127.0.0.1 -port 8080Run all the scripts above.
Generate a Docker image then run it.
docker build . -t svelte-ts-go -f Dockerfile
docker run -p 8080:8080 --rm svelte-ts-gogit clone https://github.com/alankrantas/svelteapp-typescript-go.git
git pull origin master
git add .
git commit -m "Updating"
git remote add origin https://github.com/alankrantas/svelteapp-typescript-go.git
git push origin masterAfter that, simply run npm run commit to commit changes.
