This project is a template for a web application consisting of a FastAPI backend and a SvelteKit frontend. It provides a user authentication system with email and password login, as well as token-based authentication. The frontend is styled using TailwindCSS and includes login and registration pages.
Backend:
Frontend:
Database:
Follow the steps below to download the template and set up the project for local development.
Clone the repository from GitHub:
git clone https://github.com/faulander/fastapi-sveltekit-templage.git
cd fastapi-sveltekit-template
Ensure you have Python 3.12+ and Node.js 18+ installed on your computer.
Navigate to the backend directory:
cd backend
Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
Install the required packages:
pip install -r requirements.txt
(I highly recommend using uv instead of pip/poetry etc.)
Create a .env
file in the backend directory and configure the following environment variables:
ACCESS_TOKEN_EXPIRE_MINUTES =
Navigate to the frontend directory:
cd ../frontend
Install the dependencies:
npm install
From the backend directory, run the FastAPI application:
python main.py
http://localhost:8000
.From the frontend directory, start the SvelteKit application:
npm run dev
http://localhost:5173
.http://localhost:5173
).Contributions are welcome! Please feel free to submit issues and pull requests to enhance the application's functionality or improve the documentation.
This project is licensed under the MIT License. See the LICENSE file for more details.