Use this app as a starting point for your own customized PocketBase backend with SvelteKit frontend. This is a high-performance frontend+backend combination since frontend is static and backend is a single compiled Golang binary (JAMstack baby!).
adapter-static
and ssr
is OFF./api/hello
) and database event
hooks (e.g. executing Go handler functions when a database row is created)vite
)modd
when you edit Go code./pb/pb_hooks
To understand the backend, see ./pb/README.md ("pb" == PocketBase) To understand the frontend, see ./sk/README.md ("sk" == SvelteKit)
Read those README files before proceeding.
Follow these steps CAREFULLY, or else it won't work. Also read the README files referred above before proceeding.
.env.example
to .env
and then edit it to match your environment. And then just run docker compose up -d
. Without Docker, see below ...After you've done the setup in the above two README files, run
the backend and the frontend in dev mode (from sk
directory).
# start the backend
npm run dev:backend
# and then start the frontend ...
npm run dev
Now visit http://localhost:5173 (sk) or http://localhost:8090 (pb)
Now making changes in the Svelte code (frontend) or Go code (backend) will show results (almost) immediately.
To use the app as a user / tester ...
hello
page shows and example of frontend calling a custom backend API implemented in Go.posts
page shows all existing posts. If that page is empty, then you might want to create some posts. You must be logged in to be able to create posts.Login
form, you can enter an existing username/password, or check the register
checkbox to create a new account (it registers the user and log in immediately).The above are just some sample features. Now go ahead and implement all kinds of new features.
See the build process details in the README files for backend and frontend.
Please read about the "hooks" system in ./pb/README.md It is a very easy and powerful way to extend your application with minimal configuration and perhaps no code.
Please provide feedback by opening an issue or starting a discussion.