|
1 | | -# Nuxt Template (Better Auth + Prisma + SQLite) |
2 | | - |
3 | | -A modern, production-ready Nuxt 4 template featuring a robust authentication system, ORM integration, and a clean UI foundation. |
4 | | - |
5 | | -## Features |
6 | | - |
7 | | -- **Nuxt 4**: The latest and greatest from the Nuxt team. |
8 | | -- **Better Auth**: Comprehensive authentication with **Email OTP** support. |
9 | | -- **Prisma**: Type-safe ORM for interacting with the database. |
10 | | -- **SQLite**: Lightweight, zero-configuration database, ideal for development and small-to-medium projects. |
11 | | -- **Nuxt UI v3**: Beautiful, accessible, and customizable UI components built with Tailwind CSS. |
12 | | -- **Nodemailer**: Pre-configured for sending verification emails via Gmail. |
13 | | - |
14 | | -## Stack |
15 | | - |
16 | | -- **Framework**: [Nuxt](https://nuxt.com/) |
17 | | -- **Auth**: [Better Auth](https://www.better-auth.com/) |
18 | | -- **ORM**: [Prisma](https://www.prisma.io/) |
19 | | -- **Database**: [SQLite](https://sqlite.org/) |
20 | | -- **UI Framework**: [Nuxt UI](https://ui3.nuxt.com/) |
21 | | -- **Email**: [Nodemailer](https://nodemailer.com/) |
22 | | - |
23 | | -## Getting Started |
24 | | - |
25 | | -### 1. Clone the repository |
26 | | - |
27 | | -```bash |
28 | | -git clone <your-repo-url> |
29 | | -cd nuxt-template |
30 | | -``` |
31 | | - |
32 | | -### 2. Install dependencies |
33 | | - |
34 | | -This project uses `pnpm`, but you can use `npm` as well. |
35 | | - |
36 | | -```bash |
37 | | -pnpm install |
38 | | -``` |
39 | | - |
40 | | -### 3. Setup Environment Variables |
41 | | - |
42 | | -Copy the example environment file and fill in your details. |
43 | | - |
44 | | -```bash |
45 | | -cp .env.example .env |
46 | | -``` |
47 | | - |
48 | | -Open `.env` and configure the following: |
49 | | - |
50 | | -- `DATABASE_URL`: The SQLite connection string (default: `file:./dev.db`). |
51 | | -- `BETTER_AUTH_SECRET`: A secure random string for encryption. You can generate one using `openssl rand -hex 32`. |
52 | | -- `BETTER_AUTH_URL`: The base URL of your application (default: `http://localhost:3000`). |
53 | | -- `EMAIL_USER`: Your Gmail address (for OTP delivery). |
54 | | -- `EMAIL_PASS`: Your Gmail App Password. [How to generate an App Password](https://support.google.com/accounts/answer/185833). |
55 | | - |
56 | | -### 4. Database Setup |
57 | | - |
58 | | -Initialize your SQLite database and run migrations. |
59 | | - |
60 | | -```bash |
61 | | -pnpm dlx prisma migrate dev --name init |
62 | | -``` |
63 | | - |
64 | | -To reset the database and run the seed script: |
65 | | - |
66 | | -```bash |
67 | | -pnpm prisma:reset |
68 | | -``` |
69 | | - |
70 | | -### 5. Start the development server |
71 | | - |
72 | | -```bash |
73 | | -pnpm dev |
74 | | -``` |
75 | | - |
76 | | -Your application will be available at `http://localhost:3000`. |
77 | | - |
78 | | -## Project Structure |
79 | | - |
80 | | -- `app/`: Frontend code (pages, components, assets, composables). |
81 | | -- `server/`: Backend code (API routes, authentication logic, database utilities). |
82 | | -- `prisma/`: Database schema, migrations, and seed scripts. |
83 | | -- `public/`: Static assets. |
84 | | - |
85 | | -## License |
86 | | - |
87 | | -MIT |
| 1 | +# WCOA |
0 commit comments