Compare commits

..

No commits in common. "main" and "drizzle-supabase" have entirely different histories.

18 changed files with 9266 additions and 15311 deletions

1
.npmrc Normal file
View file

@ -0,0 +1 @@
auto-install-peers = true

View file

@ -35,24 +35,3 @@ This Turborepo has some additional tools already setup for you:
- [Prettier](https://prettier.io) for code formatting - [Prettier](https://prettier.io) for code formatting
- [shadcn/ui](https://ui.shadcn.com/docs/monorepo) for UI components - [shadcn/ui](https://ui.shadcn.com/docs/monorepo) for UI components
- [Tailwind CSS v4](https://tailwindcss.com/) for styling and to use shadcn/ui - [Tailwind CSS v4](https://tailwindcss.com/) for styling and to use shadcn/ui
### Setting up the monorepo
To get started with this monorepo
1. clone the repository:
```bash
git clone git@github.com:afiqzudinhadi/ecommerce-template.git
```
2. Add or remove `apps` and `packages` as needed. You can use the existing apps and packages as a reference for creating new ones.
- For example, to create a new app, you can copy the `next-template` directory and rename it to your desired app name. `admin-panel`, `public-site`, `landing-page`, `server` etc.
- Ensure that the new app's `package.json` has the correct name and version.
- Update the root `package.json` name to match your monorepo's name.
3. Navigate to the root directory of the monorepo and install dependencies:
```bash
npm install
```

View file

@ -1,5 +0,0 @@
# TODO
- [ ] Permissions
- [ ] Stripe integration
- [ ] Docker for deployment

View file

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { getProducts } from "@repo/db/index"; import { getProducts } from "@repo/db/index";
import PageClient from "./page.client"; import PageClient from "./page-client";
import { Product } from "@repo/ui/components/products"; import { Product } from "@repo/ui/components/products";
import { PaginatedResponse } from "@repo/ui/components/template/table-show"; import { PaginatedResponse } from "@repo/ui/components/template/table-show";

View file

@ -27,8 +27,8 @@
"devDependencies": { "devDependencies": {
"@remix-run/dev": "^2.15.2", "@remix-run/dev": "^2.15.2",
"@repo/eslint-config": "*", "@repo/eslint-config": "*",
"@types/react": "^19.0.10", "@types/react": "^18.3.18",
"@types/react-dom": "^19.0.4", "@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^8.34.0", "@typescript-eslint/eslint-plugin": "^8.34.0",
"@typescript-eslint/parser": "^8.34.0", "@typescript-eslint/parser": "^8.34.0",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",

View file

@ -18,8 +18,8 @@
"devDependencies": { "devDependencies": {
"@repo/eslint-config": "*", "@repo/eslint-config": "*",
"@repo/typescript-config": "*", "@repo/typescript-config": "*",
"@types/react": "^19.0.10", "@types/react": "^18.3.18",
"@types/react-dom": "^19.0.4", "@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.5.1", "@vitejs/plugin-react": "^4.5.1",
"eslint": "^9.29.0", "eslint": "^9.29.0",
"typescript": "5.8.2", "typescript": "5.8.2",

View file

@ -1,11 +1,29 @@
{ {
"extends": "@repo/typescript-config/vite.json",
"compilerOptions": { "compilerOptions": {
"types": ["vite/client"], "types": ["vite/client"],
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"paths": { "paths": {
"~/*": ["./src/*"], "~/*": ["./src/*"],
"@repo/ui/*": ["../../packages/ui/src/*"] "@repo/ui/*": ["../../packages/ui/src/*"]
} },
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}, },
"include": ["src"], "include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]

24453
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
"reinstall": "npm run clean:node_modules && npm install", "reinstall": "npm run clean:node_modules && npm install",
"build": "turbo run build", "build": "turbo run build",
"clean": "turbo run clean", "clean": "turbo run clean",
"clean:node_modules": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + && find . -name 'package-lock.json' -type f -delete && npm cache clean --force", "clean:node_modules": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
"dev": "turbo run dev", "dev": "turbo run dev",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "turbo run lint", "lint": "turbo run lint",

View file

@ -1,22 +1,21 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ES2020",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true
"forceConsistentCasingInFileNames": true },
}, "include": ["src"],
"include": ["src"], "references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }]
} }

View file

@ -7,7 +7,7 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"exports": { "exports": {
"./index": "./src/index.ts" "./index.ts": "./src/index.ts"
}, },
"scripts": { "scripts": {
"lint": "eslint . --ext .ts,.tsx", "lint": "eslint . --ext .ts,.tsx",

View file

@ -14,11 +14,7 @@ try {
console.warn("Failed to decode DATABASE_URL, using as is."); console.warn("Failed to decode DATABASE_URL, using as is.");
} }
const maskedUrl = db_url.replace( console.log("Connecting to database URL:", db_url);
/(postgresql:\/\/[^:]+:)[^@]+(@[^\/]+)/,
'$1***$2'
);
console.log("Connecting to database URL:", maskedUrl);
const client = postgres(db_url!); const client = postgres(db_url!);

View file

@ -1,2 +1,2 @@
export * from "./queries/users.ts"; export * from "./queries/users";
export * from "./queries/products.ts"; export * from "./queries/products";

View file

@ -1,6 +1,6 @@
import { db } from "../database.ts";
import { type InsertProduct, products } from "../schema/products.ts";
import { count, desc } from "drizzle-orm"; import { count, desc } from "drizzle-orm";
import { db } from "../database";
import { InsertProduct, products } from "../schema/products";
export async function createProduct(data: InsertProduct) { export async function createProduct(data: InsertProduct) {
await db.insert(products).values(data); await db.insert(products).values(data);

View file

@ -1,5 +1,5 @@
import { db } from "../database.ts"; import { db } from "../database";
import { type InsertUser, users } from "../schema/users.ts"; import { InsertUser, users } from "../schema/users";
import { eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
export async function createUser(data: InsertUser) { export async function createUser(data: InsertUser) {

View file

@ -1,5 +1,5 @@
import { pgTable, serial, text, numeric, boolean } from "drizzle-orm/pg-core"; import { pgTable, serial, text, numeric, boolean } from "drizzle-orm/pg-core";
import { timestamps } from "./column.helpers.ts"; import { timestamps } from "./column.helpers";
export const products = pgTable("products", { export const products = pgTable("products", {
id: serial("id").primaryKey(), id: serial("id").primaryKey(),

View file

@ -1,5 +1,5 @@
import { pgTable, text } from "drizzle-orm/pg-core"; import { pgTable, text } from "drizzle-orm/pg-core";
import { timestamps } from "./column.helpers.ts"; import { timestamps } from "./column.helpers";
export const users = pgTable("users", { export const users = pgTable("users", {
id: text("id").primaryKey(), // Clerk user ID id: text("id").primaryKey(), // Clerk user ID