Skip to content

Vike full-stack with Lucia Auth and Prisma

Notifications You must be signed in to change notification settings

skorotkiewicz/vike-stack

Repository files navigation

vike-stack

Next steps

Setup Prisma

Run the following command once:

  1. Run npx prisma init

Then:

  1. Run npx prisma db pull to turn your database schema into a Prisma schema.
  2. Run npx prisma generate to generate the Prisma Client.
  3. Run npx prisma db push to push scheme to database.
  4. Run npx prisma migrate dev to regenerate schema (if scheme change)

Example .env file

# postgres:
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"

# sqlite
DATABASE_URL="file:./dev.db"

Imports

With one simple alias ~/

import { Input } from "~/components/Input";

Run

# yarn dev
or
# bun run dev

About this app

This app is ready to start. It's powered by Vike and React.

/pages/+config.ts

Such files are the interface between Vike and your code. It defines:

Routing

Vike's built-in router lets you choose between:

/pages/_error/+Page.jsx

The error page which is rendered when errors occur.

/pages/+onPageTransitionStart.ts and /pages/+onPageTransitionEnd.ts

The onPageTransitionStart() hook, together with onPageTransitionEnd(), enables you to implement page transition animations.

SSR

SSR is enabled by default. You can disable it for all your pages or only for some pages.

HTML Streaming

You can enable/disable HTML streaming for all your pages, or only for some pages while still using it for others.