Skip to content

Commit 64194a4

Browse files
committed
initial db schema
1 parent 59af240 commit 64194a4

File tree

15 files changed

+300
-237
lines changed

15 files changed

+300
-237
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Build and Push Docker image
3333
env:
3434
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry}}
35-
REPOSITORY: nuxt-template
35+
REPOSITORY: wcoa
3636
IMAGE_TAG: ${{ github.sha}}
3737
DATABASE_URL: "file:./dev.db"
3838
run: |

README.md

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1 @@
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

notes/db.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- user
2+
- attributes
3+
- fName
4+
- lName
5+
- email
6+
- phone
7+
- role
8+
- subclasses
9+
- admin
10+
- client
11+
- address
12+
- rides
13+
- volunteer
14+
- status
15+
- notificationSettings
16+
- rides
17+
18+
- ride

nuxt.config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// https://nuxt.com/docs/api/configuration/nuxt-config
21
export default defineNuxtConfig({
3-
compatibilityDate: '2025-07-15',
4-
devtools: { enabled: true },
5-
modules: ['@nuxt/ui'],
6-
css: ['./assets/css/main.css']
2+
compatibilityDate: '2025-07-15',
3+
devtools: { enabled: true },
4+
modules: ['@nuxt/ui'],
5+
css: ['./assets/css/main.css'],
76
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "epics-template",
2+
"name": "wcoa",
33
"type": "module",
44
"private": true,
55
"scripts": {
@@ -8,7 +8,7 @@
88
"generate": "nuxt generate",
99
"preview": "nuxt preview",
1010
"postinstall": "nuxt prepare",
11-
"prisma:reset": "prisma migrate reset -f && prisma db seed"
11+
"prisma:reset": "prisma migrate dev --name init && prisma generate && prisma migrate reset -f && prisma db seed"
1212
},
1313
"dependencies": {
1414
"@nuxt/ui": "^4.3.0",

prisma.config.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
// This file was generated by Prisma, and assumes you have installed the following:
2-
// npm install --save-dev prisma dotenv
3-
import "dotenv/config";
4-
import { defineConfig } from "prisma/config";
1+
import 'dotenv/config'
2+
import { defineConfig } from 'prisma/config'
53

64
export default defineConfig({
7-
schema: "prisma/schema.prisma",
8-
migrations: {
9-
path: "prisma/migrations",
10-
seed: "tsx prisma/seed.ts"
11-
},
12-
datasource: {
13-
url: process.env["DATABASE_URL"],
14-
},
15-
});
5+
schema: 'prisma/schema',
6+
migrations: {
7+
path: 'prisma/migrations',
8+
seed: 'tsx prisma/seed.ts',
9+
},
10+
datasource: {
11+
url: process.env['DATABASE_URL'],
12+
},
13+
})

prisma/schema.prisma

Lines changed: 0 additions & 71 deletions
This file was deleted.

prisma/schema/auth.prisma

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
model Session {
2+
id String @id
3+
expiresAt DateTime
4+
token String
5+
createdAt DateTime @default(now())
6+
updatedAt DateTime @updatedAt
7+
ipAddress String?
8+
userAgent String?
9+
userId String
10+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
11+
12+
@@unique([token])
13+
@@index([userId])
14+
@@map("session")
15+
}
16+
17+
model Verification {
18+
id String @id
19+
identifier String
20+
value String
21+
expiresAt DateTime
22+
createdAt DateTime @default(now())
23+
updatedAt DateTime @updatedAt
24+
25+
@@index([identifier])
26+
@@map("verification")
27+
}

prisma/schema/client.prisma

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
model Client {
2+
id String @id @default(uuid())
3+
userId String @unique
4+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
5+
6+
homeAddressId String
7+
homeAddress Address @relation(fields: [homeAddressId], references: [id])
8+
9+
rides Ride[]
10+
11+
@@map("client")
12+
}
13+
14+
model Address {
15+
id String @id @default(uuid())
16+
street String
17+
city String
18+
state String
19+
zip String
20+
21+
clients Client[]
22+
23+
// Relations to track historical rides (optional)
24+
ridesStarted Ride[] @relation("PickupRef")
25+
ridesEnded Ride[] @relation("DropoffRef")
26+
27+
@@unique([street, city, state, zip])
28+
@@map("address")
29+
}

prisma/schema/enum.prisma

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
enum Role {
2+
ADMIN
3+
VOLUNTEER
4+
CLIENT
5+
}
6+
7+
enum RideStatus {
8+
CREATED
9+
ASSIGNED
10+
COMPLETED
11+
CANCELLED
12+
}

0 commit comments

Comments
 (0)