Skip to content

Commit

Permalink
feat: Ecommerce Platform using Nextjs, Typescript and Tailwind CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
karan0805 committed Apr 29, 2024
0 parents commit 7763dfc
Show file tree
Hide file tree
Showing 123 changed files with 15,062 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
34 changes: 34 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
###############################
###### REQUIRED ENV VARS ######
###############################

# Postgres Database via Supabase
# Get your Postgres Database URL here: https://supabase.com/partners/integrations/prisma
DATABASE_URL=

# Generate a random secret here: https://generate-secret.vercel.app/32
NEXTAUTH_SECRET=
NEXTJWT_SECRET=

NEXTAUTH_URL=
FRONTEND_URL=

# Required for Google Auth
# Learn how to set this up here: https://next-auth.js.org/providers/google
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

###############################
###### ADDITIONAL ENV VARS ####
###############################

# SMTP Creds
# Required for Sending Transaction Emails
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=




28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"react/no-unescaped-entities": "off"
}
}
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
.env*.prod
.env

# vercel
.vercel

# typescript
*.tsbuildinfo

/test-results/
/playwright-report/
/playwright/.cache/
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo 'running commit-msg checks...'

npx --no -- commitlint --edit "${1}"
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo 'running pre-commiting checks...'

npx lint-staged
11 changes: 11 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(' --file ')}`;

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
'*': 'prettier --ignore-unknown --write',
};
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.16.1
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
yarn.lock
node_modules
.next
.mailing
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"editorconfig.editorconfig",
"prisma.prisma",
"bradlc.vscode-tailwindcss",
"ms-playwright.playwright",
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag"
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true, // Tell VSCode to format files on save
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
}, // Tell VSCode to use Prettier as default file formatter
"typescript.tsdk": "node_modules\\typescript\\lib"
}
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Design Palace

Implementing Ecommerce in Next.js(13), Tailwind & Typescript

- **Framework**: [Next.js](https://nextjs.org/)
- **Database**: [PostgreSQL](https://www.postgresql.org/)
- **ORM**: [Prisma](https://prisma.io/)
- **Authentication**: [NextAuth.js](https://next-auth.js.org/)
- **Deployment**: [Vercel](https://vercel.com)
- **Styling**: [Tailwind CSS](https://tailwindcss.com/)

## Environment Variables

To run this project, you will need to add the following environment variables to your `.env` file

```bash
# Database URL for prisma
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"

# URL of the website
NEXTAUTH_URL='http://localhost:3000'
FRONTEND_URL='http://localhost:3000'

# Used to hash tokens, sign/encrypt cookies and ...
# You can quickly create a good value with this command
# openssl rand -base64 32
NEXTAUTH_SECRET=VJmi1XgBd48qWC2xn/kNRc15OIY+P4a1uXgV42uaHuw=
NEXTJWT_SECRET=VDexd3kY#q8W!2o$6vVz9*mr&Np@^gLQ

# Google oAuth
GOOGLE_CLIENT_ID=YOUR_GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRET

# SMTP creds
MAIL_HOST=YOUR_SMTP_HOST
MAIL_PORT=YOUR_SMTP_PORT
MAIL_USERNAME=YOUR_SMTP_USERNAME
MAIL_PASSWORD=YOUR_SMTP_PASSWORD
```

## Run Locally

Clone the project

```bash
git clone https://github.com/karan0805/design-palace.git
```

Go to the project directory

```bash
cd design-palace
```

Install dependencies

```bash
npm install
```

Apply migrations to database

```bash
npm run migrate-dev
```

Seed the database

```bash
npm run db-seed
```

Start the server

```bash
npm run dev
```
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
21 changes: 21 additions & 0 deletions next-seo.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { DefaultSeoProps } from 'next-seo';

const config: DefaultSeoProps = {
defaultTitle: 'Design Palace',
titleTemplate: '%s | Design Palace',
description: `Explore and buy thousands of seamless pattern and textile designs from the world's largest online collection of textile.`,
canonical: 'https://design-palace.vercel.app/',
openGraph: {
type: 'website',
locale: 'en_IE',
url: 'https://design-palace.vercel.app/',
siteName: 'Design Palace',
},
twitter: {
handle: '@handle',
site: '@site',
cardType: 'summary_large_image',
},
};

export default config;
30 changes: 30 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-check
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds.
*/
!process.env.SKIP_ENV_VALIDATION && (await import('./src/env/server.mjs'));

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**.githubusercontent.com',
},
{
protocol: 'https',
hostname: '**.googleusercontent.com',
},
],
},
output: 'standalone',
typescript: {
ignoreBuildErrors: true,
},
};

export default nextConfig;
Loading

0 comments on commit 7763dfc

Please sign in to comment.