Git Product home page Git Product logo

fastapi-svelte-demo's Introduction

Demo Project

Initialize the development environment

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

Run de development environment

docker-compose up

Open http://localhost:300 Or Admin UI at http://localhost:8000/admin with user and password created above

Frontend

It's build with create-svelte; SvelteKit along with TailwindCSS are used for this demo.

Developing

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

API endpoints

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.

Building

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.

Backend

API docs

AP§I docs are generated automatically by FastApi at http://127.0.0.1:8000/docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.