Skip to content

Commit

Permalink
initial next.js project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohmdev authored Oct 1, 2024
1 parent 396b825 commit 43df661
Show file tree
Hide file tree
Showing 19 changed files with 12,289 additions and 1,219 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = null
30 changes: 30 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Your Medusa backend, should be updated to where you are hosting your server. Remember to update CORS settings for your server. See – https://docs.medusajs.com/usage/configurations#admin_cors-and-store_cors
NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000

# Your store name, will be displayed across the storefront.
NEXT_PUBLIC_STORE_NAME="Medusa Store"

# Your publishable key that can be attached to sales channels. See - https://docs.medusajs.com/development/publishable-api-keys
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_test

# Your store URL, should be updated to where you are hosting your storefront.
NEXT_PUBLIC_BASE_URL=http://localhost:8000

# Your preferred default region. When middleware cannot determine the user region from the "x-vercel-country" header, the default region will be used. ISO-2 lowercase format.
NEXT_PUBLIC_DEFAULT_REGION=us

# Your Stripe public key. See – https://docs.medusajs.com/add-plugins/stripe
NEXT_PUBLIC_STRIPE_KEY=

# Your PayPal Client ID. See – https://docs.medusajs.com/add-plugins/paypal
NEXT_PUBLIC_PAYPAL_CLIENT_ID=

# Your MeiliSearch / Algolia keys. See – https://docs.medusajs.com/add-plugins/meilisearch or https://docs.medusajs.com/add-plugins/algolia
NEXT_PUBLIC_FEATURE_SEARCH_ENABLED=false
NEXT_PUBLIC_SEARCH_APP_ID=
NEXT_PUBLIC_SEARCH_ENDPOINT=http://127.0.0.1:7700
NEXT_PUBLIC_SEARCH_API_KEY=
NEXT_PUBLIC_INDEX_NAME=products

# Your Next.js revalidation secret. See – https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#on-demand-revalidation
REVALIDATE_SECRET=supersecret
8 changes: 8 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ["next/core-web-vitals"],
root: true,
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
}
3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# IDEs
.idea
.vscode
# .vscode

# dependencies
/node_modules
Expand Down
6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"arrowParens": "always",
"semi": false,
"endOfLine": "auto",
"singleQuote": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
"trailingComma": "es5",
"printWidth": 100,
"plugins": ["prettier-plugin-tailwindcss"]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
20 changes: 20 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/styles/base.css",
"baseColor": "stone",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/ui",
"ui": "@/ui/shadcn",
"lib": "@/lib",
"hooks": "@/lib/hooks",
"utils": "@/lib/util/cn"
}
}
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
32 changes: 0 additions & 32 deletions next.config.js

This file was deleted.

71 changes: 71 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import checkEnvVariables from "./scripts/check-env-variables.js"
import chalk from "chalk"

checkEnvVariables()

/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
experimental: {
turbo: {
rules: {
"*.scss": {
loaders: ["sass-loader"],
},
},
},
scrollRestoration: true,
},
sassOptions: {
silenceDeprecations: ["legacy-js-api"],
},
images: {
unoptimized: false,
remotePatterns: [
{
protocol: "http",
hostname: "localhost",
},
{
protocol: "http",
hostname: "res.cloudinary.com",
},
{
protocol: "https",
hostname: "res.cloudinary.com",
},
{
protocol: "https",
hostname: "medusa-cloud.up.railway.app",
},
{
protocol: "https",
hostname: "medusa-public-images.s3.eu-west-1.amazonaws.com",
},
{
protocol: "https",
hostname: "medusa-server-testing.s3.amazonaws.com",
},
{
protocol: "https",
hostname: "medusa-server-testing.s3.us-east-1.amazonaws.com",
},
],
},
env: {
"Store Name": process.env.NEXT_PUBLIC_STORE_NAME,
"Storefront URL": process.env.NEXT_PUBLIC_BASE_URL,
"Admin Dashboard": `${process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL}/dashboard`,
"Search Enabled": process.env.NEXT_PUBLIC_FEATURE_SEARCH_ENABLED,
},
}

export default nextConfig

console.log(
Object.entries(nextConfig.env)
.map(([key, value]) => ` - ${chalk.green(key)}: ${value}`)
.join("\n")
)
Loading

0 comments on commit 43df661

Please sign in to comment.