docker-compose up -d db
createdb -h localhost -U postgres fastapi-svelte-demo
cd backend/
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
piccolo --diagnose
piccolo migrations forwards session_auth
piccolo migrations forwards user
piccolo user create
Make sure you enter y when asked if it’s an admin user, otherwise the user won’t be able to login to the Piccolo admin GUI.
If there's an issue with piccolo orm init, check what's happening with: piccolo --diagnose
docker-compose up
Open http://localhost:300 Or Admin UI at http://localhost:8000/admin with user and password created above
It's build with create-svelte
;
SvelteKit along with TailwindCSS are used for this demo.
Once you've cloned this project and installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
We use SvelteKit Endpoints for backend API fetching. Endpoints in SvelteKit are files ending with .js (or .ts for typescript) that export functions corresponding to HTTP methods. These endpoint files become API routes in our application.
Before creating a production version of your app, install an adapter for your target environment. Then:
npm run build
You can preview the built app with
npm run preview
, regardless of whether you installed an adapter. This should not be used to serve your app in production.
AP§I docs are generated automatically by FastApi at http://127.0.0.1:8000/docs