This template should help get you started developing with Vue 3 PWA in Vite, with pocketbase as backend. I've setup to deploy it on fly.io but you can deploy it anywhere.
backend
: backend contains all the backend codebackend/build
: contains all the build related files. Includes Dockerfile.backend/cmd
: contains all the files that direclty provide commands to the program. This would also include the starting point for our app.src
: contains all the front end source codesrc/assets
: contains all the assets you want bundled via vitesrc/components
: contains all the vue componentssrc/composables
: contains all the composables for the appsrc/layouts
: contains all the layouts and it's components for the appsrc/lib
: contains all the module level business logicsrc/main
: main entry point for the appsrc/pages
: contains all the top level page components for the appsrc/stores
: contains pinia storessrc/symbols
: contains symbols to use via provide/inject vue api
@
is root of your frontend source code. i.e../src
- We use lot of plugins to provide us with nice dx while developing the app. It allows us to just focus on the core part of the app. So try to rely on them for most cases. i.e. you don't really need to import components, core apis, functions etc. It just works.
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar) + Go
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
See Vite Configuration Reference.
pnpm install
cd backend
go mod tidy
cp .env.example .env
pnpm dev
cd backend
go run cmd/server/main.go serve
Note that it doesn't hot reload. yet. I'll add a makefile later
pnpm build
cd backend
go build -o server cmd/server/*.go
If you're using flyctl (Highly Recommended!)
cd backend
flyctl deploy --dockerfile build/Dockerfile
Lint with ESLint
pnpm lint