Vike full-stack with Lucia Auth and Prisma
assets | ||
components | ||
database | ||
layouts | ||
lib | ||
pages | ||
prisma | ||
.gitignore | ||
bun.lockb | ||
hono-entry.ts | ||
package.json | ||
README.md | ||
tsconfig.json | ||
vike.d.ts | ||
vite.config.ts |
vike-stack
- Base
- Auth
- Lucia Auth
- @lucia-auth/adapter-prisma
- Prisma ORM
- Lucia Auth
Next steps
Setup Prisma
Run the following command once:
- Run
npx prisma init
Then:
- Run
npx prisma db pull
to turn your database schema into a Prisma schema. - Run
npx prisma generate
to generate the Prisma Client. - Run
npx prisma db push
to push scheme to database. - 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:
- A default
<Layout>
component (that wraps your<Page>
components). - A default
title
. - Default
<head>
tags.
Routing
Vike's built-in router lets you choose between:
- Filesystem Routing (the URL of a page is determined based on where its
+Page.jsx
file is located on the filesystem) - Route Strings
- Route Functions
/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.