Skip to content

Commit c62d97b

Browse files
authored
Database Setup (#2)
1 parent 2a4c751 commit c62d97b

11 files changed

Lines changed: 286 additions & 108 deletions

File tree

.env.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# When adding additional environment variables, the schema in "/src/env.js"
1010
# should be updated accordingly.
1111

12-
# Drizzle
13-
DATABASE_URL="file:./db.sqlite"
14-
15-
# Example:
16-
# SERVERVAR="foo"
17-
# NEXT_PUBLIC_CLIENTVAR="bar"
12+
# SingleStore
13+
SINGLESTORE_USER="username"
14+
SINGLESTORE_PASSWORD="password"
15+
SINGLESTORE_HOST="localhost"
16+
SINGLESTORE_PORT="1000"
17+
SINGLESTORE_DATABASE="database"

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,39 @@ Visit the
4848
[create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) for
4949
feedback and contributions.
5050

51+
## 🚀 Getting Started
52+
53+
### 🛠️ Environment Variables
54+
55+
To configure the environment variables, copy the example file and update the
56+
values as needed:
57+
58+
```bash
59+
cp .env.example .env
60+
```
61+
62+
Open the `.env` file and fill in the required fields based on the project’s
63+
needs (e.g., database credentials, API keys, etc.).
64+
65+
### 🗄️ Database Setup
66+
67+
This project uses [SingleStore](https://www.singlestore.com/) as the primary
68+
database, with [Drizzle ORM](https://orm.drizzle.team) for type-safe, efficient
69+
data access and schema management.
70+
71+
```bash
72+
pnpm run db:push # Push the schema to the database
73+
pnpm run db:studio # Launch Drizzle Studio
74+
```
75+
76+
### 🕹️ Development Server
77+
78+
To start the local development server:
79+
80+
```bash
81+
pnpm run dev
82+
```
83+
5184
## 🚧 Development Logbook
5285

5386
Tracking progress on key features and tasks for the project.
@@ -56,3 +89,12 @@ Tracking progress on key features and tasks for the project.
5689
- [ ] 🔗 Sync folder open state with the URL
5790
- [ ] 🔐 Implement user authentication
5891
- [ ] 📁 Enable file upload functionality
92+
93+
### 📝 Note from 5-28-2025
94+
95+
Just finished up the database connection, next steps:
96+
97+
- [ ] Update schema to show files and folders
98+
- [ ] Manually insert examples
99+
- [ ] Render them in the UI
100+
- [ ] Push and make sure it all works

drizzle.config.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { env } from "~/env";
44

55
export default {
66
schema: "./src/server/db/schema.ts",
7-
dialect: "sqlite",
7+
dialect: "singlestore",
88
dbCredentials: {
9-
url: env.DATABASE_URL,
9+
host: env.SINGLESTORE_HOST,
10+
port: env.SINGLESTORE_PORT,
11+
user: env.SINGLESTORE_USER,
12+
password: env.SINGLESTORE_PASSWORD,
13+
database: env.SINGLESTORE_DATABASE,
14+
ssl: {},
1015
},
11-
tablesFilter: ["drive-tutorial_*"],
16+
tablesFilter: ["drive_tutorial_*"],
1217
} satisfies Config;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"clsx": "^2.1.1",
2828
"drizzle-orm": "^0.41.0",
2929
"lucide-react": "^0.511.0",
30+
"mysql2": "^3.14.1",
3031
"next": "^15.2.3",
3132
"react": "^19.0.0",
3233
"react-dom": "^19.0.0",

pnpm-lock.yaml

Lines changed: 82 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/file-row.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { FileIcon, Folder as FolderIcon } from "lucide-react";
2+
3+
import type { File, Folder } from "~/lib/mock-data";
4+
5+
export function FileRow(props: { file: File }) {
6+
const { file } = props;
7+
8+
return (
9+
<li
10+
key={file.id}
11+
className="hover:bg-gray-750 border-b border-gray-700 px-6 py-4"
12+
>
13+
<div className="grid grid-cols-12 items-center gap-4">
14+
<div className="col-span-6 flex items-center">
15+
<a
16+
href={file.url}
17+
className="flex items-center text-gray-100 hover:text-blue-400"
18+
target="_blank"
19+
>
20+
<FileIcon className="mr-3" size={20} />
21+
{file.name}
22+
</a>
23+
</div>
24+
<div className="col-span-3 text-gray-400">{"file"}</div>
25+
<div className="col-span-3 text-gray-400">{file.size}</div>
26+
</div>
27+
</li>
28+
);
29+
}
30+
31+
export function FolderRow(props: {
32+
folder: Folder;
33+
onFolderClick: () => void;
34+
}) {
35+
const { folder, onFolderClick } = props;
36+
37+
return (
38+
<li
39+
key={folder.id}
40+
className="hover:bg-gray-750 border-b border-gray-700 px-6 py-4"
41+
>
42+
<div className="grid grid-cols-12 items-center gap-4">
43+
<div className="col-span-6 flex items-center">
44+
<button
45+
onClick={onFolderClick}
46+
className="flex items-center text-gray-100 hover:text-blue-400"
47+
>
48+
<FolderIcon className="mr-3" size={20} />
49+
{folder.name}
50+
</button>
51+
</div>
52+
<div className="col-span-3 text-gray-400"></div>
53+
<div className="col-span-3 text-gray-400"></div>
54+
</div>
55+
</li>
56+
);
57+
}

0 commit comments

Comments
 (0)