Giter Club home page Giter Club logo

accretence / next-prisma-tailwind-ecommerce Goto Github PK

View Code? Open in Web Editor NEW
167.0 5.0 19.0 4.44 MB

✨ Open-Source Full-stack E-Commerce Storefront with Admin Panel. Built with Typescript, Next.js 13 App Dir, Tailwind CSS ( @shadcn-ui ) and Prisma.

Home Page: https://store.accretence.com

License: MIT License

JavaScript 1.97% TypeScript 97.15% CSS 0.88%
nextjs react server-side-rendering full-stack serverless authentication httponly-cookie email nodejs postgresql

next-prisma-tailwind-ecommerce's Introduction

Screenshot

Full-Stack E-Commerce Platform

Built using Typescript with Next.js, Prisma ORM and TailwindCSS.

👋 Introduction

Welcome to the open-source Next.js E-Commerce Storefront with Admin Panel project! This project is built with TypeScript, Tailwind CSS, and Prisma, providing a powerful and flexible solution for building and managing your e-commerce website.

🥂 Features

  • Next.js 13 App Router and React Server Components.
  • Custom dynamic Sitemap.xml generation.
  • Admin dashboard with products, orders, and payments.
  • File uploads using next-cloudinary.
  • Authentication using middleware.ts and httpOnly cookies.
  • Storefront with blog, products, and categories.
  • Database-Stored blogs powered by MDX templates.
  • Email verification and invoices using react-email-tailwind-templates.
  • TailwindCSS for utility-first CSS.
  • UI built with Radix and stunning UI components, all thanks to shadcn/ui.
  • Type-Validation with Zod.
  • Next Metadata API for SEO handling.
  • Comprehensive implementations for i18n.

🔐 Authentication

The authentication is handled using JWT tokens stored in cookies and verified inside the middleware.ts file. The middleware function takes in the HTTP request, reads the token cookie and if the JWT is successfully verified, it sets the X-USER-ID header with the userId as the value, otherwise the request is sent back with 401 status.

👁‍🗨 Environment variables

Environment variables are stored in .env files. By default the .env.example file is included in source control and contains settings and defaults to get the app running. Any secrets or local overrides of these values should be placed in a .env file, which is ignored from source control.

Remember, never commit and store .env in the source control, just only .env.example without any data specified.

You can read more about environment variables here.

🏃‍♂️ Getting Started Locally

Clone the repository.

git clone https://github.com/accretence/next-prisma-tailwind-ecommerce

Navigate to each folder in the apps folder and and set the variables.

cp .env.example .env

Get all dependencies sorted.

yarn install

Bring your database to life with pushing the database schema.

yarn db:push
yarn dev

🔑 Database

Prisma ORM can use any PostgreSQL database. Supabase is the easiest to work with. Simply set DATABASE_URL in your .env file to work.

yarn db

This project exposes a package.json script for accessing prisma via yarn db:<command>. You should always try to use this script when interacting with prisma locally.

Making changes to the database schema

Make changes to your database by modifying prisma/schema.prisma.

🛸 How to Deploy the Project

Follow the deployment guides for Vercel, Netlify and Docker for more information.

📄 License

This project is MIT-licensed and is free to use and modify for your own projects. Check the LICENSE file for details.

Created by Amirhossein Mohammadi.

next-prisma-tailwind-ecommerce's People

Contributors

accretence avatar dev-dz27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

next-prisma-tailwind-ecommerce's Issues

Submit Order ?

How can we active order option and customer can submit a order and add to database .

Getting a error when i try to run yarn db:push

Below you see the output of my terminal

USER@DESKTOP-K4G6NPR MINGW64 /c/Development/next-prisma-tailwind-ecommerce/packages/database (main)
$ yarn db:generate
yarn run v1.22.15
$ npx prisma generate
Prisma schema loaded from prisma\schema.prisma
Error: Could not resolve prisma and @prisma/client in the current project. Please install them with yarn add prisma -D and yarn add @prisma/client, and rerun npx "prisma generate" 🙏.
error Command failed with exit code 1.

Let me know if you need more info.

Issues with production build & start

I am not able to deploy the app. So far I have set and tested the smtp and database url.
The db was successfully created and after some tsconfig problems I was able to run the prisma/seeds.ts to fill thedb with dummy data.
Locally I have the problem that login does not work. The seeds admin credentials have been changed though.I am receiving the OTP but im not redirected to the next page.
Is it because the JWT Secret is missing?

When I was trying to deploy the app to vercel, I have been getting too many errors with eslint and module import errors. I have fixed the eslint errors quick and dirty by temporary putting eslint off.

I want to know if there are common tips you may give to notice when building for production. It is all good when I run the development environment.
Is the current app limited in functionality or are the full features working already? (Because the demo app shows limited functionality aswell)

What is the idea behind the admin and storefront directories? I could not really read it somewhere.

Thank you in advance!

Bildschirmfoto 2023-12-29 um 23 19 51

Bildschirmfoto 2023-12-29 um 23 20 06

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.